PROJECT: Doctor On Call


Overview

Doctor On Call is a application intended for hospital doctor who has several long-term patients he has to take care of. It is written in Java.

Summary of contributions

  • Major enhancement: added the ability to sort the list by different attributes

    • What it does: allows the user to view the list sorted by desired attribute. The attribute can be name, status or appointment.

    • Justification: This feature improves the product significantly because a user might need to sort his patient according to his desired attribute so that he can prioritize the allocation of his resources.

    • Highlights: This enhancement affects the internalList only when user sort by name. It also required an in-depth analysis of design alternatives.

  • Minor enhancement: added a status column that allows the user to track the status of all the patients so that the user can know the stage of treatment in which the patient is undergoing. .

  • Code contributed: [RepoSense]

  • Other contributions:

    • Project management:

      • Managed releases v1.1 - v1.3 (3 releases) on GitHub

      • Create milestones and set deadlines

    • Enhancements to existing features:

      • Updated tests for existing features

    • Documentation:

      • Wrote the README page.

      • Drew the class diagram.

    • Community:

      • PRs reviewed (with non-trivial review comments)

      • Contributed to forum discussions

      • Reported bugs and suggestions for other teams in the class

    • Tools:

      • Enable Travis CI for the team repo.

Contributions to the User Guide

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

Listing all persons in sorted order : sort

Shows a list of all persons sorted by desired attribute in alphabetical order in the address book.
Desired attribute could be name, appointment or status.
Format: sort DESIRED_ATTRIBUTE

Examples:

  • sort name
    Shows a list of all persons sorted by name in alphabetical order in the address book.

  • sort status
    Shows a list of all persons sorted by status according to the degree of urgency in the address book. The sequence of the status in this order is as follows: Critical, Waiting for Surgery, Life-support, Waiting for doctor appointment, Therapy and Observation.

  • sort appointment
    Shows a list of all persons sorted by appointment date in chronological order in the address book.

Contributions to the Developer Guide

Given 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.

Design

ClassDiagram

Testing

Running Tests

There are two ways to run tests.

Method 1: Using IntelliJ JUnit test runner

  • To run all tests, right-click on the src/test/java folder and choose Run 'All Tests'

  • To run a subset of tests, you can right-click on a test package, test class, or a test and choose Run 'ABC'

Method 2: Using Gradle

  • Open a console and run the command gradlew clean allTests (Mac/Linux: ./gradlew clean allTests)

Types of tests

  1. Non-GUI Tests - These are tests not involving the GUI. They include,

    1. Unit tests targeting the lowest level methods/classes.
      e.g. seedu.addressbook.common.UtilsTest

    2. Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
      e.g. seedu.addressbook.storage.StorageFileTest

    3. Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together.
      e.g. seedu.addressbook.logic.LogicTest

Implementation

This section describes some noteworthy details on how certain features are implemented.

Sort feature

Current Implementation

The sort mechanism is facilitated by UniquePersonList and SortCommand. UniquePersonList stores a list of all persons in the address book as an internalList. Additionally, it implements the following operations:

  • UniquePersonList#SortByName() — Sort internalList by name column in alphabetical order

  • SortCommand#getPersonsSortedByDate() — Return a list sorted by appointment column in chronological order

  • SortCommand#getPersonsSortedByStatus() — Return a list sorted by status column according to the degree of urgency. The sequence of the status in this order is as follows: Critical, Waiting for Surgery, Life Support, Waiting for doctor appointment, Therapy and Observation.

These operations are exposed in AddressBook as AddressBook#sorted(String attribute). Corresponding operation will be called depending on attribute the user wants to sort the list by.

Given below is two examples usage scenario and how the sort mechanism behaves at each step.

Example 1:

Step 1. The user launches the application for the first time. The UniquePersonList will be initialized with the initial address book state.

Step 2. The user executes add n/… to add some new people. These people will be added sequentially to the end of the list.

Step 3. The user then decides to execute the command list. Commands that do not modify the address book, such as list, will usually not call AddressBook#sorted(String attribute) . Thus, the internalList remains unchanged.

Step 4. The user decides to view the list sorted by their name by executing the sort name command. This command will call AddressBook#sorted(String attribute) and pass the string “name” to the method. Since the value of parameter is “name”, SortByName() will be called. internalList will then be sorted by name column in alphabetical order. At last, internalList will be returned and displayed to the user.

Example 2:

Step 1. The user launches the application for the first time. The UniquePersonList will be initialized with the initial address book state.

Step 2. The user executes add n/… to add some new people. These people will be added sequentially to the end of the list.

Step 3. The user then decides to execute the command list. Commands that do not modify the address book, such as list, will usually not call AddressBook#sorted(String attribute) . Thus, the internalList remains unchanged.

Step 4. The user decides to view the list sorted by their name by executing the sort appointment command. This command will call SortCommand#execute() and pass the string “appointment” to the method. Since the value of parameter is “appointment”, SortCommand#getPersonsSortedByDate() will be called. A list sorted by appointment column in chronological order will be returned and displayed to the user.

Add Status feature

Current Implementation

the add status feature facilitated by the Status class, it implements the following operations:

  • status(String) — The constructor for the class Status.

  • toString() — Returns a String containing the name of the patient’s status.

  • isValidStatus() — Checks if if a given string is a valid status.

  • equals(Object) — Checks if two patients' status are equal.

  • isCorrectStatus() — Checks if if a given string is any of following status: Critical / Waiting for Surgery / Life Support / Waiting for doctor appointment / Therapy / Observation.

In addition to the Appointment class, we update the ReadOnlyPerson interface and the Person class (which implements the interface) to ensure that every Person object is constructed with an Appointment class. To be specific, the following operations are added or updated.

  • Person(Status status) —  The class Person now requires a Status object during its construction.

  • getStatus() — The class Person implements a method that returns the Status object of a Person.

Sort feature

  1. Prerequisites: Please add some patient entries.

  2. Test case 1: sort name
    Expected: Prints out a list of all patients sort by name in lexicographically order.

  3. Test case 2: sort status
    Expected: Prints out a list of all patients sort by status according to the degree of urgency.

  4. Test case 3: sort appointment
    Expected: Prints out a list of all patients sort by appointment in chronological order.

  5. Other incorrect commands to try: sort, sort abc
    Expected: An error message: Invalid command format! is displayed on the screen, with the displays the correct format below.

Add Status feature

  1. Prerequisites: The user has logged in to the system.

  2. Test case 1: add John p/98765432 e/john@gmail.com a/John street, block 123, #01-01 m/2019 12 11 12 30 d/DoctorTan s/Observation
    Expected: New person added: John Phone: 98765432 Email: john@gmail.com Address: John street, block 123, #01-01 Appointment: 2019 12 11 12 30 Doctor: DoctorTan Status: Observation Tags:

  3. Test case 2: add Amy p/98765432 e/john@gmail.com a/John street, block 123, #01-01 m/2019 12 11 12 30 d/DoctorTan s/Waiting for Surgery
    Expected: New person added: Amy Phone: 98765432 Email: john@gmail.com Address: John street, block 123, #01-01 Appointment: 2019 12 11 12 30 Doctor: DoctorTan Status: Waiting for Surgery Tags:

  4. Other incorrect commands to try: add Sherry p/98765432 e/john@gmail.com a/John street, block 123, #01-01 m/2019 12 11 12 30 d/DoctorTan s/nothing
    Expected: An error message: Status should be Observation/ Critical / Waiting for Surgery / Therapy / Life Support / Waiting for doctor appointment