Skip to content

Commit

Permalink
Merge pull request #235 from tanveersingh10/master
Browse files Browse the repository at this point in the history
Update UG and DG
  • Loading branch information
kohkaijie committed Nov 13, 2023
2 parents 8e56446 + 1ba18c5 commit a600608
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 52 deletions.
46 changes: 26 additions & 20 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ The following sequence diagram shows how the add patient works:
### Edit Patient/Doctor Feature

This feature allows users to edit patients or doctors to the address book. The person must already
exist in the address book. There
are many fields for each patient/doctor to be edited which can be found in the user guide.
exist in the address book. There are many fields for each patient/doctor to be
edited which can be found in the user guide.

#### Implementation

Expand All @@ -275,37 +275,43 @@ address book state.
Step 2. The user types `edit T0123456H` (or the relevant ic number) as command, with the appropriate arguments for the person, for
example, `edit T0123456H n/John Doe g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 d/T0123456H c/pneumothorax b/O+`.

Step 3. The `AddressBookParser` parses the arguments and determine the required command parser based on the first word
Step 3. The `AddressBookParser` parses the arguments and determines the that EditCommandParser is required based on the first word
of the arguments.

Step 4. Then `editCommandParser` parses the remaining arguments and creates an `EditCommand` with the
details of the patient given.

:information_source: **Note:** If the details of the person added does not match the correct format for any fields,
there will be an error telling user that the attributes are in the wrong format. Also, if there are no edited fields,
i.e. no attributes provided or the edited attributes are the same as the original attributes, there will be an error.
Lastly, if the nric cannot be found within the list of doctors and patients, there will be an error.
:information_source: **Note:** If the details of the person added does not match the correct format for any fields,
there will be an error telling user that the attributes are in the wrong format. Also, if there are no attributes passed there will be an error.
It's ok if the attributes are the same as the original attributes.
Lastly, an NRIC must be provided and if the nric cannot be found within the list of doctors and patients, there will be an error.

Step 5. The `EditCommand` then gets executed and calls the Model#setPerson() with the original person and the new
edited person. The original person will be replaced by the edited person.

Step 6. The UI should display using the updated list of patients and the newly edited person should reflect the changes
in the GUI.

The following sequence diagram shows how the add patient works:

![EditPatientSequenceDiagram](images/EditPatientSequenceDiagram.png)

### Design Considerations

1. Option 1 (Current Choice): Use a single EditCommand for both doctors and patients
- Pros: Easier for the user. Can use a single command to edit both.
- Cons: The program has to check whether the person is a doctor or patient. This uses the assumption that
a person cannot be both. The program might be slightly slower since it has to check through both lists.
- Pros: Easier for the user. Can use a single command to edit both.
- Cons: The program has to check whether the person is a doctor or patient. This mandates that a person cannot
be both a patient as a doctor, as patients have additional attributes. The program also might be slightly slower
since it has to check through both the doctors and patients list to locate the person.
2. Option 2: Use 2 commands edit-patient and edit-doctor
- Pros: The program might be faster. If you call edit-doctor you only need to search through a few doctors
rather than all the patients as well.
- Cons: Harder to implement, and there's a need to create new classes and add repeated code.
More commands for the user to remember as well.

### Delete Patient/Doctor Feature

This feature allows users to delete the desired patient or doctor based on the
This feature allows users to delete the desired patient or doctor based on the
nric provided.

#### Implementation
Expand All @@ -315,18 +321,18 @@ of Index.

Given below is an example usage scenario and how the delete mechanism behaves at each step.

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

Step 2. The user populates the AddressBook with patients and doctors using the appropriate commands, if not already
Step 2. The user populates the AddressBook with patients and doctors using the appropriate commands, if not already
done.

Step 3. The user types `delete` as the command, with the appropriate nric of the patient/doctor to be deleted, for
Step 3. The user types `delete` as the command, with the appropriate nric of the patient/doctor to be deleted, for
example `delete S9567312G`.

Step 4. The `deleteCommandParser` parses the delete command and creates a `deleteCommand` with the target Ic.

Step 5. The PatientCard / DoctorCard then processes the deletion and The UI should display the updated list without the
Step 5. The PatientCard / DoctorCard then processes the deletion and The UI should display the updated list without the
deleted Doctor/Patient.

### Create New Appointment Feature
Expand Down Expand Up @@ -515,7 +521,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
| `* * *` | Hospital Staff | delete a patient/doctor | remove entries that I no longer need |
| `* * *` | Hospital Staff | add an appointment | tell which patient/doctor is coming at what time |
| `* * *` | Hospital Staff | update patient's details | information remains accurate |
| `* * *` | Hospital Staff | update doctor's details | information remains accurate |
| `* * *` | Hospital Staff | update doctor's details | information remains accurate |
| `* * *` | Hospital Staff | find a patient/doctor by NRIC | locate details of persons without having to go through the entire list |
| `* * *` | Hospital Staff | reassign patients to doctors/nurses | account for changes in the people treating the patients |
| `* *` | Hospital Staff | hide private contact details | minimize chance of someone else seeing them by accident |
Expand Down Expand Up @@ -584,7 +590,7 @@ otherwise)
**Extensions**

* 1a. No person with matching attribute found.
* 1a1. Medilink Contacts lists 0 persons.
* 1a1. Medilink Contacts lists 0 persons.

Use case ends.

Expand All @@ -610,14 +616,14 @@ otherwise)
* 3a1. Medilink Contacts shows an error message.

Use case resumes at step 2.

* 4a. There are no edited fields, i.e. either no fields provided or new fields are the same as the previous ones

* 4a1. Medilink Contacts shows an error message.

Use case resumes at step 2.

* 4b. The edited fields include invalid inputs.
* 4b. The edited fields include invalid inputs.

* 4b1. Medilink Contacts shows an error message.

Expand Down
55 changes: 32 additions & 23 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ The list below contains the parameters that are used in various commands as well
* Parameters can be in any order.<br>
e.g. if the command specifies `n/NAME p/PHONE_NUMBER`, `p/PHONE_NUMBER n/NAME` is also acceptable.

* Extraneous parameters for commands that do not take in parameters (such as `help`, `list`, `exit` and `clear`) will be
ignored.<br>
e.g. if the command specifies `help 123`, it will be interpreted as `help`.
* Extraneous parameters for commands that do not take in parameters (such as `help`, `list`, `exit`,
`clear`, `undo` and `redo`) will be
ignored.<br>
e.g. if the command specifies `help 123`, it will be interpreted as `help`.

* If you are using a PDF version of this document, be careful when copying and pasting commands that span multiple lines
as space characters surrounding line-breaks may be omitted when copied over to the application.
Expand All @@ -116,7 +117,7 @@ Format: `help`

### Adding a Doctor: `add-doctor`

Adds a Doctor to the clinic database.
Adds a Doctor to MediLink Contacts.

Format: `add-doctor n/NAME ic/IC g/GENDER p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​`

Expand Down Expand Up @@ -153,21 +154,21 @@ Error Message: `Invalid command format!` <br>
`add-doctor: Adds a person to MediLink Contacts. Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS g/GENDER ic/NRIC [t/TAG]...`
2. Invalid/Empty Field <br>
Fields have specific formats to be followed. Failure to adhere to this format will lead to an error message
that specifies the format to be used for that field. Usage of flags without any message will lead to the same
that specifies the format to be used for that field. Usage of flags without any message will lead to the same
corresponding error message since no field supports empty inputs.
```
add-doctor n/ ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/Surgeon
Names should only contain alphanumeric characters and spaces, and it should not be blank
add-doctor n/Betsy Crowe ic/999 g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/Surgeon
Ic should start with S or T, followed by 7 numbers, and ends with a letter. Letters inputs are case-insensitive. Empty strings are not allowed
add-doctor n/Betsy Crowe ic/S9851586G g/B p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/Surgeon
Gender should only be M for Male or F for Female
Gender should only be M for Male or F for Female
add-doctor n/Betsy Crowe ic/S9851586G g/F p/phoneNumber e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/Surgeon
Phone numbers should only contain numbers, and it should be at least 3 digits long
add-doctor n/Betsy Crowe ic/S9851586G g/F p/98765433 e/ a/#104-C, Wakanda St 42 t/Surgeon
Emails should be of the format local-part@domain and adhere to the following constraints:
1. The local-part should only contain alphanumeric characters and these special characters, excluding the parentheses, (+_.-). The local-part may not start or end with any special characters.
Expand All @@ -176,10 +177,10 @@ corresponding error message since no field supports empty inputs.
- end with a domain label at least 2 characters long
- have each domain label start and end with alphanumeric characters
- have each domain label consist of alphanumeric characters, separated only by hyphens, if any.
add-doctor n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/ t/Surgeon
Addresses can take any values, and it should not be blank
add-doctor n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/BestDoctor
Doctor tag should be a valid specialisation.
```
Expand All @@ -203,7 +204,7 @@ Example:

### Adding a Patient: `add-patient`

Adds a Patient to the clinic database.
Adds a Patient to MediLink Contacts.

Format: `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e/EMAIL a/ADDRESS c/CONDITION b/BLOODTYPE [t/TAG] ​`

Expand Down Expand Up @@ -239,9 +240,9 @@ Format: `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm`
**:information_source: Take Note:**<br>

- All fields are Required.
- PATIENT must contain the valid IC of a Patient in the Database.
- DOCTOR must contain the valid IC of a Doctor in the Database.
- There must not be conflicting Appointments. (eg. the doctor already has an appointment with another patient at the same time). However, the duration of each appointment is flexible and up to the users. As long as appointments are not at the exact same time, users can add it in.
- PATIENT must contain the valid IC of a Patient in MediLink Contacts.
- DOCTOR must contain the valid IC of a Doctor in MediLink Contacts.
- There must not be conflicting Appointments. (eg. the doctor already has an appointment with another patient at the same time) However, the duration of each appointment is flexible and up to the users. As long as appointments are not at the exact same time, users can add it in.

</div>

Expand All @@ -267,7 +268,7 @@ Examples:

* `delete-appt 1`

### Finding a Appointment : `find-appt`
### Finding an Appointment : `find-appt`

Finds all appointments that involve a specific patient/doctor.

Expand All @@ -277,7 +278,7 @@ Format: `find-appt NRIC`
**:information_source: Take Note:**<br>

- All fields are Required.
- NRIC must contain the valid NRIC of a Patient or Doctor in the Database and **must** be in caps.
- NRIC must contain the valid NRIC of a Patient or Doctor in MediLink Contacts and **must** be in caps.
- Either Doctor NRIC or Patient NRIC can be used in the search
- It is recommended to use `list` to restore the view of all data after a `find` command.

Expand All @@ -299,17 +300,25 @@ Edits an existing person in the MediLink Contacts.

Format: `edit NRIC [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`

<div markdown="block" class="alert alert-info">
**:information_source: Take Note:**<br>

* Edits the person with the specified `NRIC`. The NRIC provided **must be a valid IC number** and is not case-sensitive.
* At least one of the optional fields must be provided.
* If the provided fields are the same as the original, the command will still work.
* Must edit appropriate fields based on whether the person is a patient or doctor (e.g. can't update condition of a
doctor).
* Existing values will be updated to the input values.
* You cannot change a person's IC number. If the provided ic number is the same as the original it will work.
However, if it is different, there will be an error.
* Must edit appropriate fields based on whether the person is a patient or doctor (e.g. can't update condition, blood type or
emergency contact of a doctor).
* Existing values will be updated to the input values.g
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `t/` without
specifying any tags after it.
* If extraneous parameters are provided, it may lead to an error.
* Note: In our app, the Remark Section will be left blank by default. The edit Command can be used to add any miscellaneous info not captured by other fields such as possible allergies, medical history, etc.

</div>

Examples:

* `edit T0123456A p/91234567 e/johndoe@example.com g/F` edits the phone number and email address of the 1st person to
Expand Down Expand Up @@ -368,7 +377,7 @@ Examples:

Finds all Patients with query blood type.

Format: `find Blood Type QUERY`
Format: `find Blood Type QUERY`

* It is recommended to use `list` to restore the view of all data after a `find` command.

Expand Down Expand Up @@ -427,7 +436,7 @@ Format: `undo`

</div>

Restores the effects of actions that were previously undone using the undo command.
Restores the effects of actions that were previously undone using the undo command.

Format: `redo`

Expand Down
92 changes: 92 additions & 0 deletions docs/diagrams/EditSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":EditCommandParser" as EditCommandParser LOGIC_COLOR
participant "e:EditCommand" as EditCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
participant ":EditPersonDescriptor" as EditPersonDescriptor USER_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box


[-> LogicManager : execute("edit args")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("edit args")
activate AddressBookParser

create EditCommandParser
AddressBookParser -> EditCommandParser
activate EditCommandParser

EditCommandParser --> AddressBookParser
deactivate EditCommandParser

AddressBookParser -> EditCommandParser : parse("args")

activate EditCommandParser

create EditPersonDescriptor
EditCommandParser -> EditPersonDescriptor : new
activate EditPersonDescriptor

EditPersonDescriptor --> EditCommandParser : editPersonDescriptor
deactivate EditPersonDescriptor

create EditCommand
EditCommandParser -> EditCommand : EditCommand(nric, editPersonDescriptor)
activate EditCommand

EditCommand --> EditCommandParser : e
deactivate EditCommand

EditCommandParser --> AddressBookParser : e
deactivate EditCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
EditCommandParser -[hidden]-> AddressBookParser
destroy EditCommandParser

AddressBookParser --> LogicManager : e
deactivate AddressBookParser

LogicManager -> EditCommand : execute()
activate EditCommand

EditCommand -> Model : getFilteredDoctorList()
activate Model

Model -> EditCommand : filteredDoctorList
deactivate Model

EditCommand -> Model : getFilteredPatientList()

activate Model
Model -> EditCommand : filteredPatientList
deactivate Model

EditCommand -> Model : setPerson(personToEdit, editedPerson)
activate Model
Model -> EditCommand
deactivate Model

create CommandResult
EditCommand -> CommandResult
activate CommandResult

CommandResult --> EditCommand : result
deactivate CommandResult

EditCommand --> LogicManager : result
deactivate EditCommand

[<--LogicManager
deactivate LogicManager


@enduml
Binary file added docs/images/EditSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/team/chonguschonguschongus.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Given below are my contributions to the project.
* **New Feature**: Enhanced the Find feature to function with NRIC, blood type, gender as well as name.
* What it does: Allows users to search for Patients/Doctors by their NRIC, blood type, gender or simply name
* Justification: Users can search by a specific attribute, increasing convenience

* **New Feature**: Added a Find Appointment function to locate a specific appointment by NRIC of people involved
* **New Feature** Added a Delete Appointment function to delete a specific appointment by NRIC of people involved

Expand All @@ -26,7 +26,7 @@ Given below are my contributions to the project.
* Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub

* **Enhancements to existing features**:
* Wrote an abstract UniqueObjectList that can be inherited to form UniqueLists of Patients, Doctors and Appointments
* Wrote an abstract UniqueObjectList that can be inherited to form UniqueLists of Patients, Doctors and Appointments
* Updated the GUI color scheme (Pull requests [\#33](), [\#34]())
* Wrote additional tests for existing features (Pull requests [\#36](), [\#38]())

Expand Down
Loading

0 comments on commit a600608

Please sign in to comment.