Skip to content

Commit

Permalink
Merge pull request #94 from Alteqa/branch-updatedg
Browse files Browse the repository at this point in the history
Update DG queryPatient and queryDoctor
  • Loading branch information
ararchch authored Mar 28, 2024
2 parents b8cc855 + 2a3977e commit 22e8046
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,33 @@ The sequence diagram below closely describes the interaction between the various




### Query `doctor` and `patient`

Queries a 'doctor' or 'patient' entry by indicating their name or a substring of their name.
This command is implemented through the `QueryDoctor` and `QueryPatient` classes which extend the `Command` class.

* Step 1. User enters an `querypatient` or `querydoctor` command.
* Step 2. The `AddressBookParser` will call `parseCommand` on the user's input string and return an instance of `queryDoctorCommandParser` or `queryPatientCommandParser`.
* Step 3. The `parse` command in `queryDoctorCommandParser` or `queryPatientCommandParser` calls `ParserUtil` to create instances of objects for each of the fields.
* If there are any missing fields, a `CommandException` is thrown.
* If input arguments does not match contraints for the fields, a `IllegalArgumentException` is thrown.

The activity diagram below demonstrates this error handling process in more detail.

<img src="images/QueryPersonActivityDiagram.png" width="800" />

* Step 4. The `parse` command in `queryDoctorCommandParser` or `queryDoctorCommandParser` return an instance of `queryPatientCommand` or `queryPatientCommand` respectively.
* Step 5. The `LogicManager` calls the `execute` method in `queryDoctorCommandParser` or `queryDoctorCommandParser`.
* Step 6. The `execute` method in `queryDoctorCommandParser` or `queryDoctorCommandParser` executes and calls `updateFilteredPersonList` in model to get a filtered list of `Doctor` or `Patient`.
* Step 7. Success message gets printed onto the results display to notify user and the list of matching results is produced.


Why is this implemented this way?
1. Making both `Doctor` and `Patient` class extend the `Person` class makes it easier to execute query operations.
2. `Doctor` and `Patient` all exhibit similar qualities, and thus can inherit from the `Person` superclass.


### \[Proposed\] Undo/redo feature

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

start
:User enters command to query doctor or patient;


if () then ([missing required fields])
:Show error message\nfor missing required fields;
else ([else])
:Search Doctor/Patient from person list;
:Update the 'person' panel\nin the GUI to display the list;
:Show success message\nwith removed doctor/patient information;
endif


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

0 comments on commit 22e8046

Please sign in to comment.