PROJECT: CoderLifeInsights

CoderLifeInsights is a CLI (Command Line Interface) driven desktop application that a programmer can use to record his or her social interactions with individual friends, or group of friends.
CoderLifeInsights gives the programmer insights into his or her social life, and provides suggestions to liven up their social life by analysing the social events recorded in CoderLifeInsight through the CLI.

My Role

I was tasked to implement the AddEventCommand with its relevant classes, namely the Time, PlaceList and ActivityList classes. I also made the inputs from the aforementioned command savable to the hard disk. This command and its implementation is the backbone of all our relevant features. I also made minor changes to the GUI displays, as well as contributions to the Developers' Guide and User Guide.

Listed in the table below are some notations that are used throughout the document.

Table 1. Legend table
Icon Description

command

Command that can be executed, or a component, class or object in the architecture of the application

Tips that might be helpful in navigating the application

Important information that should be noted

Useful information for a deeper understanding of the command

As shown in Table 1, “Legend table”, these icons associated to their following descriptions, such as commands, tips, important information and useful information, enable greater clarity in understanding the document. Note that useful information will have text enclosed in its box.

Summary of contributions

Major enhancements:

  • Major enhancement #1: Implemented Add Event feature for a Person

    • What it does: It allows the user to add an event with a person. An event consists of an activity, a place, and a time. These relevant fields and information, namely the [ACTIVITY], [PLACE], and [TIME], are added to the person the event is created with and are saved to the hard disk.

    • Justification: This feature improves the product significantly as the user may add events with persons in CoderLifeInsights. The relevant information from the events added are used in other features. The information being saved to the hard disk allows the user to make use of features through different uses.

    • Highlights: This enhancement functions well with existing commands as it updates each Person with a Time, PlaceList and ActivityList variable that represents the time the user has spent with that person, the activities done with that person, and the places been to with that person respectively, in CoderLifeInsights which is displayed in each person’s details. It also saves the added information to the hard disk. Many improvements and features such as Insights and Suggest stem from the data recorded by this command in the Person and Group objects. It required an in-depth analysis of design alternatives.
      This major enhancement took much effort as it required the implementation of 3 new classes. These 3 classes were used in the two entities, Person and Group. Also, the attributes added to the Person and Group class were also implemented in a way such that it would be saved to the Json file, as well as work with the import and exporting features. Significant architectural analysis was required to ensure these classes worked they way they were intended and did not break existing features of AB3 as they were integrated into the Person object. Furthermore, the data stored in these attributes were the backbone of a majority of all other features, which generated output through analysis of the data stored.

Minor enhancements:

  • Minor enhancement #1: Integrated the Add Event feature with the Import and Export feature.

    • What it does: This enhancement made the Add Event feature work with the Import and Export features, allowing the information added and saved by this command to be imported and exported.

    • Justification: This feature allows the user to not lose information from events added when switching computers.

    • Highlights: This enhancement functions well with existing commands. It required an in-depth analysis of design alternatives.
      This allowed the Time, PlaceList and ActivityList of each person saved in the Json file to be converted successfully to the CSV file.

  • Minor enhancement #2: Made the Add Event feature function properly with groups.

    • What it does: This enhancement made the Add Event feature work with a Group object, and made information keyed in by users with the AddEventCommand function savable to the hard disk

    • Justification: This feature allows the user to add events with groups, on top of persons. The relevant information saved to the hard disk is required for other functions to generate their output.

    • Highlights: This enhancement functions well with existing commands. It required an in-depth analysis of design alternatives.

  • Minor enhancement #3: Implementation of Insights feature for groups view_groups [Refactored into the view command by @terencemah in PR: #173]

    • What it does: This enhancement allows the user to view the places visited and the activities done with a particular group. It also lists the number of times been to each place and number of times each activity is carried out with the group.

    • Justification: This feature gives the user insights on the favourite places and activities of each group of friends in CoderLifeInsights.

    • Highlights: This enhancement functions well with existing commands. It required an in-depth analysis of design alternatives.

  • Minor enhancement #4: Integration of the PlaceList and ActivityList classes with the Group entity

    • What it does: This enhancement integrated the PlaceList and ActivityList into the Group object.
      It allowed relevant information to be added to a Group object, as well as ensured that the relevant data was stored to the Group object and Json file as well.

    • Highlights: This enhancement functions well with existing commands and features. It required an in-depth analysis of design alternatives.

  • Code contributed:[RepoSense]

  • Other contributions:

    • Project management:

      • Tasked to ensure deliverables were submitted and deadlines were met by all members of the group.

      • Tasked to test and discover potential bugs in the software.

      • Tasked to ensure documentation for all code is written, as well as ensuring that the User Guide is understandable and not confusing.

    • Enhancements to existing features:

      • Created the interim Event container class

      • Implemented the AddEventCommand which adds an Event( which consists of an Activity, a Place and a Time) to a Person

      • Created a Time variable and made it savable for each Person object through updates via the AddEventCommand

      • Created a PlaceList variable and made it savable for each Person object through updates via the AddEventCommand

      • Created an ActivityList variable and made it savable for each Person object through updates via the AddEventCommand

      • Added the PlaceList and ActivityList variables to groups and made them savable for each Group object through updates via the AddEventCommand

    • Documentation:

      • Added and revised contents of the User Guide (Pull requests: #53, #94, #128, #160, #172)

      • Added contents of the Developer Guide (Pull requests: #79, #160, #172)

    • Community:

    • Tools:

Contributions to the User Guide

Shown below are the sections I contributed to in the User Guide. They showcase my ability to write documentation targeting end-users.

Listing saved data : list

[written by: Ernest Lian Qi Quan]

Shows a list of recorded information in CoderLifeInsights.
Format: list_LIST_PARAMETER

  • LIST_PARAMETER include persons,groups.

  • CoderLifeInsights will display an indexed list of the saved LIST_PARAMATER.

Examples:

Example Command Result

Show all persons

list_persons

Returns a list of the saved persons in CoderLifeInsights.

Show all groups

list_groups

Returns a list of the saved groups in CoderLifeInsights.

Adding an Event: add_event

[written by: Ernest Lian Qi Quan]

Adds an event to a person or a group at the specified INDEX.
Format for adding to a person: add_event ACTIVITY_NAME place/PLACE_NAME time/TIME m/INDEX
Format for adding to a group: add_event ACTIVITY_NAME place/PLACE_NAME time/TIME g/INDEX
Remarks:

  • TIME has to be in entered in the format HHMM:
    Input for a time of 1 hour and 5 minutes would be: time/105
    Input for a time of 9 minutes would be: time/09

  • MM entered has to be between 00 and 60 (01 to 59).

  • The INDEX refers to the index number shown in the displayed person list. The INDEX must be a positive integer.

  • CoderLifeInsights uses 1-indexing.

CoderLifeInsights will store the input ACTIVITY and PLACE in the Json file so that all events added are kept even through termination of CoderLifeInsights. The input TIME will be added to the respective persons or events and the cumulative time spent with a person or a group is recorded and displayed. This cumulative TIME is also stored to the Json file. Insights and suggestions will be generated from the saved PLACES, ACTIVITIES and TIME

Examples:

Example Command Result

Adding an event with a person from the fully listed persons list

list_persons

add_event Date Night place/MBS time/300 m/2

Creates an Event Date Night at MBS with a time spent of 3 hours and adds it to the second person in CoderLifeInsights.

Adding an event with a group from the fully listed groups list

list_groups

add_event Dancing lessons place/Changi Country Club time/130 g/1

Creates an Event Dancing lessons at Changi Country Club with a time spent of 1 hour and 30 minutes and adds it to the first group in CoderLifeInsights.

Adding an event to a person after using the find function

find Betsy

add_event Date Night place/MBS time/300 m/1

Creates an Event Date Night at MBS with a time spent of 3 hours and adds it to the first result returned by the find Betsy command in CoderLifeInsights.

Insights: view

[written by: Ernest Lian Qi Quan and Mah Cai Jun, Terence]

Displays various insights about the person’s, groups and events stored in Coder Life Insights. (You might need to enlarge the application window for the best view.)

This feature encompasses a range of functions which share the following format: view INSIGHT_PARAMETER [m/PERSON_INDEX] [g/GROUP_INDEX] Note that the application will only accept EITHER a person index OR a group index, never both. Also, whether an index is required or possibly not allowed depends on the insight parameter.

  • The available insight parameters are: places, activities, recent, all, and time.

    • Places (must enter an index)

      • This function lists all the places that the user has visited with the target person or target group, and their frequencies, in descending order of frequency.

][pdfwidth="50%"
Figure 1. View Places example
  • Activities (must enter an index)

    • This function lists all the activities that the user has done with the target person or target group, and their frequencies, in descending order of frequency.

][pdfwidth="50%"
Figure 2. View Activities example
  • Recent (can have an index or no index)

    • If an index is entered, this function lists the user’s last 5 events with the target person or target group, in reverse chronological order.

    • If no index is entered, this function lists the user’s last 5 events overall, in reverse chronological order.

    • The event display features each event’s place, activity, duration, and serial number.

][pdfwidth="50%"
Figure 3. View Recent example
  • 'All' (cannot have an index)

    • This function lists all events that the user has added, in chronological order.

    • The event display features each event’s place, activity, duration, and serial number.

][pdfwidth="50%"
Figure 4. View All example
  • Time (cannot have an index)

    • This function compares the user’s total time spent with individuals against his/her total time spent with groups, in the form of a pie chart.

][pdfwidth="50%"
Figure 5. View Time example

Take note that Places and Activities are case-sensitive: * Swimming Pool and swimming pool are considered different places * SWIMMING and swimming are considered different activities

The examples below provide an exhaustive list of permissible command formats:

Command Result

view places m/1

View places visited with person 1 from the active person list.

view places g/1

View places visited with group 1 from the active group list.

view activities m/1

View activities done with person 1 from the active person list.

view activities g/1

View activities done with group 1 from the active group list.

view recent

View the last 5 events overall.

view recent m/1

View the last 5 events with person 1 from the active person list.

view recent g/1

View the last 5 events with group 1 from the active group list.

view all

View all events the user has added to Coder Life Insights.

view time

View a pie chart displaying the proportion of individual time vs group time spent.

Contributions to the Developer Guide

Shown below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project.

Add Event Feature

[written by: Ernest Lian Qi Quan]

The add event feature allows users to add an event to a saved contact or group in CoderLifeInsights specified using the member m/ tag or the group g/ tag.

Implementation

Command: add_event ACTIVITY m/INDEX time/TIME place/PLACE or add_event ACTIVITY g/INDEX time/TIME place/PLACE

Remarks:

  • TIME is the variable used to store the time the user has spent with a saved contact or group.

  • TIME parameter must contain at least 2 digits. For example: A time of 1 hour and 30 minutes will be input as 130.

  • An event added must have time of at least 1 minute. e.g. time/01

  • PLACE and ACTIVITY are case-sensitive

Example usage: add_event date night m/1 time/230 place/Gardens by the Bay

The command above will add the following to the Person whose index is 1 on the filtered or unfiltered list:

  • Activity date night into the Person’s activityList.

  • Place Gardens by the Bay into the Person’s placeList.

  • Time 230 which equals 2 hours and 30 minutes, will be added to the Person’s time.

It will also create an Event with the following attributes:

  • Activity: date night

  • Place: Gardens by the Bay

  • Time: 2h 30m

The sequence diagram below showcases how the command works with a valid input:

addEventSequence

Depicted below is the class diagram of the Event class, displaying how the UniqueEventList and Event classes are associated to the AddressBook class:

EventClassDiagram

The Event created is stored in an UniqueEventList, which is saved to the Json file as well. The Events saved are used to generate output for features.

The following class diagram shows how the Time, PlaceList and ActivityList are associated with a Person object. The Person class only displays relevant information to the Time, PlaceList and ActivityList classes:

AddEventClassDiagram

The Time, ActivityList and PlaceList classes were implemented similar to a Person’s Name or Address. A Person’s Time is displayed on the GUI as well for users to know how much time they have spent with that Person. The reason behind this implementation was to ensure that information added from the AddEventCommand would be saved through changes to Persons or Groups in CoderLifeInsights. The pertinent information would then be used in following features which require these data to generate output.
A Group object also has the same implementation of Time, PlaceList and ActivityList and its class diagram is similar to the diagram above, with the Person class being substituted by the Group class. These information are also saved for the Group object when an Event is added to a Group object.


The following activity diagram depicts the following scenario:

  1. User enters add_event date night m/1 time/230 place/Gardens by the Bay into the command prompt.

  2. The LogicManager calls AddressBookParser#parseCommand().

  3. The method AddressBookParser#parseCommand() creates a AddEventCommandParser and calls the AddEventCommandParser#parse() method.

  4. AddEventCommandParser#parse() checks if input is valid.

  5. AddEventCommandParser#parse() then creates a new instance of an Event.

  6. AddEventCommandParser#parse() then creates a new instance of AddEventCommand, with the created Event as it’s parameter.

  7. AddEventCommand calls the AddEventCommand#execute() method.

  8. AddEventCommand#execute() retrieves the filtered list with the call to model#getFilteredPersonList().

  9. AddEventCommand#execute() then retrieves the Person object to be edited with the call to model#getFilteredPersonList()#get().

  10. AddEventCommand#execute() then computes the new Time by retrieving the Person’s current Time with the call to person#getTime() ,then adding it to the input Time.

  11. AddEventCommand#execute() then creates a new ActivityList by retrieving the Person’s ActivityList with the call to person#getActivityList2(), followed by ActivityList#addActivity(), which returns a new ActivityList with the new activity added.

  12. AddEventCommand#execute() then creates a new PlaceList by retrieving the Person’s PlaceList with the call to person#getPlaceList2(), followed by PlaceList#addPlace(), which returns a new PlaceList with the new place added.

  13. AddEventCommand#execute() then creates a new Person object with all the same attributes except for the Time, PlaceList, and ActivityList which is replaced by the new Time computed, the new PlaceList and the new ActivityList with the call to the Person constructor.

  14. AddEventCommand#execute() then replaces the existing Person object with the new Person object with the call to model#setPerson().

  15. AddEventCommand#execute() then updates the filtered list with the call to model#updateFilteredPersonList().

  16. AddEventCommand#execute() then updates the UniqueEventList with the call to model#addEvent(), which adds the created Event to the UniqueEventList.

  17. AddEventCommand returns the CommandResult to AddressBookParser.

  18. AddressBookParser returns the CommandResult to LogicManager.

addEventActivity

Justification

The Add Event feature and the relevant classes were added and implemented to add and store Events and relevant data that are used to generate output for other features such as insights.

Use case: Add an event with a person

[written by: Ernest Lian Qi Quan]

MSS

  1. User wants to add an Event with the following details to the first person displayed on the Person List on CoderLifeInsights:
    Activity: swimming Place: pool Time: 1 hour and 30 minutes

  2. User enters correct command with valid input and prefixes

  3. Event is created and added to the Person
    Use case ends

Extensions

  • 2a. User enters incorrect command

    • 2a1. Invalid command error is displayed

    • 2a2. User re-enters valid command with valid input
      Use case resumes at 3.

  • 2b. User enters correct command but invalid input

    • 2b1. Invalid command error is displayed

    • 2b2. User re-enters valid and correct command with valid input
      Use case resumes at 3.

  • 2c. Person index specified is out of bounds

    • 2c1. Invalid person index error message is displayed

    • 2c2. User re-enters command with correct and valid person index
      Use case resumes at 3.

Use case: Add an event with a group

[written by: Ernest Lian Qi Quan]

MSS

  1. User wants to add an Event with the following details to the first group displayed on the Group List on CoderLifeInsights:
    Activity: dancing Place: dance studio Time: 1 hour and 30 minutes

  2. User enters correct command with valid input and prefixes

  3. Event is created and added to the Group
    Use case ends

Extensions

  • 2a. User enters incorrect command

    • 2a1. Invalid command error is displayed

    • 2a2. User re-enters valid command with valid input
      Use case resumes at 3.

  • 2b. User enters correct command but invalid input

    • 2b1. Invalid command error is displayed

    • 2b2. User re-enters valid and correct command with valid input
      Use case resumes at 3.

  • 2c. Group index specified is out of bounds

    • 2c1. Invalid group index error message is displayed

    • 2c2. User re-enters command with correct and valid group index
      Use case resumes at 3.