Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Developer Guide with the latest documentation #58

Merged
merged 4 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 67 additions & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,73 @@ The following activity diagram summarizes what happens when a user executes a ne
* Pros: Will use less memory (e.g. for `delete`, just save the person being deleted).
* Cons: We must ensure that the implementation of each individual command are correct.

_{more aspects and alternatives to be added}_
_{more aspects and alternatives to be added}

### Add a patient

#### Implementation

The add patient feature is facilitated by `AddCommand`, `AddCommandParser` and `Person`.

Given below is an example usage scenario and how the add patient feature behaves at each step.

Step 1. The user launches the application for the first time.

Step 2. The user executes an Add Command (e.g. 'add n\Alice ic\A0055679T ad\01/01/2022 dob\01/01/2002 w\WA') to add a new patient to the address book.

n\: Indicates the name of the patient
ic\: Indicates the NRIC of the patient
ad\: Indicates the admission date of the patient
dob\: Indicates the date of birth of the patient
w\: Indicates the ward of the patient is currently in

The `AddCommandParser` parses the user input, creating a new `AddCommand` object.
The `AddCommand` object then creates a new `Person` object with the parsed details.


### List by tags and/or ward feature

#### Implementation

The filter by tags and/or ward mechanism is facilitated by `ListCommand`, `ListCommandParser` and `ListKeywordsPredicate`. Additionally, it implements the following operations:

* `ListCommandParser#parse()` — Parses user input and creates a `ListCommand` object.

Given below is an example usage scenario and how the filter by tags and/or ward mechanism behaves at each step.

Step 1. The user launches the application for the first time.

Step 2. The user executes `list t\diabetes` command to list patients with the diabetes tag in the address book. The `ListCommandParser` parses the user input, creating a new `ListCommand` and `ListKeywordPredicate` object as `predicate` (since there are keywords provided). `predicate` will filter the list of patients in the address book to only show patients with the diabetes tag.

![ListObjectDiagram](images/ListObjectDiagram.png)

Step 3. For each patient in the address book, the `predicate` object will be passed to `Model#updateFilteredPersonList` check if the patient has the diabetes tag. If the patient has the diabetes tag, the patient will be shown in the list of patients.

The following activity diagram summarizes what happens when a user executes a new command:

<img src="images/ListCommandActivityDiagram.png" width="250" />

#### Design considerations:

**Aspect: Command to filter:**

* **Alternative 1 (current choice):** Add the parameters to list command instead of find.
* Pros: More appropriate as `list` will produce a useful list of relevant contacts, whereas `find` implies that only one useful result is expected.
* Cons: May not have such a clear distinction between `list` and `find`, as user just wants to search for results.

* **Alternative 2:** Add parameters to find command instead of list.
* Pros: Easy to use, one command will perform all search.
* Cons: Unable to differentiate usefulness.

**Aspect: Filter by a ward or many wards:**

* **Alternative 1 (current choice):** Allow filtering only by at most 1 ward input.
* Pros: More targeted; Nurses will only refer to the ward that they are in or are visiting. Otherwise, will filter across all wards.
* Cons: Does not allow looking at specific, multiple wards.

* **Alternative 2:** Allow multiple ward tags.
* Pros: Easy to be more specific.
* Cons: Not relevant for the nurses use case. Allowing more wards also make it harder to filter fast.

### \[Proposed\] Data archiving

Expand Down
21 changes: 21 additions & 0 deletions docs/diagrams/ListCommandActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12

start
:User executes command;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([command has parameters])
:Create a new predicate;
:Filter the addressbook
using the predicate;
:Show the filtered contacts;
else ([else])
: Show all contacts;
endif
stop
@enduml
16 changes: 16 additions & 0 deletions docs/diagrams/ListObjectDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml
!include style.puml
skinparam arrowThickness 1.1
skinparam arrowColor MODEL_COLOR
skinparam classBackgroundColor MODEL_COLOR

class State1 as "<u>:ListCommand</u>"
class State2 as "<u>:ListKeywordPredicate</u>"
class State3 as "<u>wardKeyword:String</u>"
class State4 as "<u>tagKeywords:List<String></u>"

State1 -down-> "0..1" State2
State2 -right-> "1" State3
State2 -down-> "1" State4

@enduml
Binary file added docs/images/ListCommandActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ListObjectDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading