From 49ef6a9308b44694641c62b4288c1ebb8a78adf1 Mon Sep 17 00:00:00 2001 From: alfaloo Date: Sat, 13 Apr 2024 22:09:09 +0800 Subject: [PATCH 1/2] Add more info/tip bands --- docs/UserGuide.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index f6999f526dd..1d30e575473 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -145,6 +145,9 @@ MediCLI has 4 primary components in its main window. Detailed descriptions of ea Results Display - MediCLI will respond to you here with either a success message or a detailed description of what went wrong. +
:bulb: **TIP**: The results display may be too narrow to show the entire message. You can scroll in the results display to see the whole message. +All error messages due to invalid formatting will end with an example usage.
+ Persons Panel - This is where you will see a list of the filtered patients and patients. Appointments Panel - This is where you will see a list of the filtered patients and patients. @@ -167,9 +170,11 @@ MediCLI is operated using typed commands to the command line interface (CLI). Do ### Quick Tutorial on a Sample Use Case -1. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
+1. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
' + +
:exclamation: **DANGER**: 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.
- Some example commands you can try (Assuming MediCLI is opened for the first time and is in its initial state with the default sample data): +Some example commands you can try (Assuming MediCLI is opened for the first time and is in its initial state with the default sample data): * `list` : Lists all contacts. @@ -177,6 +182,8 @@ MediCLI is operated using typed commands to the command line interface (CLI). Do * `addappt ad/2024-06-09 10:15 dn/S1234567B pn/S1234567A` : Schedules an appointment between the doctor `Amy Smith` and the patient `John Doe`. +
:information_source: **INFO**: MediCLI cannot schedule an appointment in the past, so change the date-time field if necessary.
+ * `delete 2` : Deletes the 2nd person currently listed in the MediCLI system (patient named David Li). * `exit` : Exits the app. @@ -201,7 +208,6 @@ MediCLI is operated using typed commands to the command line interface (CLI). Do * Extraneous parameters for commands that do not take in parameters (such as `help`, `list`, `exit` and `clear`) will be ignored.
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. ## Person Related Commands @@ -301,6 +307,8 @@ Examples: ![result for 'find John David'](images/findPerson.png) +
:bulb: **TIP**: You can use the find command to filter people for commands that require a person's `INDEX`.
+ ### Querying patients by name : `patient` Finds `Patient`(s) whose details contain any of the given keywords. @@ -372,6 +380,8 @@ Note that while you cannot create a new appointment with the date and time in th Format: `addappt ad/DATETIME dn/DOCTOR_NRIC pn/PATIENT_NRIC` +
:bulb: **TIP**: You can use the patient and doctor commands to retrieve their NRIC number if you only remember their name.
+ Field Constraints: - **DATETIME**: Input must be in the format `yyyy-MM-dd HH:MM`. Specified date and time must be later than the current date and time. i.e. appointment cannot be scheduled in the past. - **DOCTOR_NRIC**: Follows the correct Singapore NRIC format. Begin with one of S, T, G, F, or M, followed by 7 numerical digits, then ended by an alphabetical letter. This field is non-case-sensitive. From d77cd9c6e92eb56d5a149bff59765eb624c81783 Mon Sep 17 00:00:00 2001 From: alfaloo Date: Sat, 13 Apr 2024 22:14:19 +0800 Subject: [PATCH 2/2] Undo/redo --- docs/DeveloperGuide.md | 174 ++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 70550f45e74..761f5539095 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -529,140 +529,140 @@ Why is this implemented this way? 2. The rationale behind excluding substring searches for `appointment`(s) is that if a hospital clerk is searching for a specific `patient`'s scheduled `appointment`(s), the hospital clerk already has the `patient`'s unique `Nric` and hence including substring querying is irrelevant. -[//]: # (### \[Proposed\] Undo/redo feature) +### \[Proposed\] Undo/redo feature -[//]: # () -[//]: # (#### Proposed Implementation) -[//]: # () -[//]: # (The proposed undo/redo mechanism is facilitated by `VersionedMediCLI`. It extends `MediCLI` with an undo/redo history, stored internally as an `mediCLIStateList` and `currentStatePointer`. Additionally, it implements the following operations:) +#### Proposed Implementation -[//]: # () -[//]: # (* `VersionedMediCLI#commit()` — Saves the current MediCLI state in its history.) -[//]: # (* `VersionedMediCLI#undo()` — Restores the previous MediCLI state from its history.) +The proposed undo/redo mechanism is facilitated by `VersionedMediCLI`. It extends `MediCLI` with an undo/redo history, stored internally as an `mediCLIStateList` and `currentStatePointer`. Additionally, it implements the following operations: -[//]: # (* `VersionedMediCLI#redo()` — Restores a previously undone MediCLI state from its history.) -[//]: # () -[//]: # (These operations are exposed in the `Model` interface as `Model#commitMediCLI()`, `Model#undoMediCLI()` and `Model#redoMediCLI()` respectively.) +* `VersionedMediCLI#commit()` — Saves the current MediCLI state in its history. -[//]: # () -[//]: # (Given below is an example usage scenario and how the undo/redo mechanism behaves at each step.) +* `VersionedMediCLI#undo()` — Restores the previous MediCLI state from its history. -[//]: # () -[//]: # (Step 1. The user launches the application for the first time. The `VersionedMediCLI` will be initialized with the initial MediCLI state, and the `currentStatePointer` pointing to that single MediCLI state.) +* `VersionedMediCLI#redo()` — Restores a previously undone MediCLI state from its history. -[//]: # () -[//]: # (![UndoRedoState0](images/UndoRedoState0.png)) -[//]: # () -[//]: # (Step 2. The user executes `delete 5` command to delete the 5th person in the MediCLI. The `delete` command calls `Model#commitMediCLI()`, causing the modified state of the MediCLI after the `delete 5` command executes to be saved in the `mediCLIStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state.) +These operations are exposed in the `Model` interface as `Model#commitMediCLI()`, `Model#undoMediCLI()` and `Model#redoMediCLI()` respectively. -[//]: # () -[//]: # (![UndoRedoState1](images/UndoRedoState1.png)) -[//]: # () -[//]: # (Step 3. The user executes `addpatient i/S1234567A n/John Doe d/2003-01-30 p/98765432` to add a new person. The `add` command also calls `Model#commitMediCLI()`, causing another modified MediCLI state to be saved into the `mediCLIStateList`.) +Given below is an example usage scenario and how the undo/redo mechanism behaves at each step. -[//]: # () -[//]: # (![UndoRedoState2](images/UndoRedoState2.png)) -[//]: # () -[//]: # (
:information_source: **Note:** If a command fails its execution, it will not call `Model#commitMediCLI()`, so the MediCLI state will not be saved into the `mediCLIStateList`.) +Step 1. The user launches the application for the first time. The `VersionedMediCLI` will be initialized with the initial MediCLI state, and the `currentStatePointer` pointing to that single MediCLI state. -[//]: # () -[//]: # (
) -[//]: # () -[//]: # (Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoMediCLI()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous MediCLI state, and restores the MediCLI to that state.) +![UndoRedoState0](images/UndoRedoState0.png) -[//]: # () -[//]: # (![UndoRedoState3](images/UndoRedoState3.png)) -[//]: # () -[//]: # (
:information_source: **Note:** If the `currentStatePointer` is at index 0, pointing to the initial MediCLI state, then there are no previous MediCLI states to restore. The `undo` command uses `Model#canUndoMediCLI()` to check if this is the case. If so, it will return an error to the user rather) +Step 2. The user executes `delete 5` command to delete the 5th person in the MediCLI. The `delete` command calls `Model#commitMediCLI()`, causing the modified state of the MediCLI after the `delete 5` command executes to be saved in the `mediCLIStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state. -[//]: # (than attempting to perform the undo.) -[//]: # () -[//]: # (
) +![UndoRedoState1](images/UndoRedoState1.png) -[//]: # () -[//]: # (The following sequence diagram shows how an undo operation goes through the `Logic` component:) -[//]: # () -[//]: # (![UndoSequenceDiagram](images/UndoSequenceDiagram-Logic.png)) +Step 3. The user executes `addpatient i/S1234567A n/John Doe d/2003-01-30 p/98765432` to add a new person. The `add` command also calls `Model#commitMediCLI()`, causing another modified MediCLI state to be saved into the `mediCLIStateList`. -[//]: # () -[//]: # (
:information_source: **Note:** The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.) -[//]: # () -[//]: # (
) +![UndoRedoState2](images/UndoRedoState2.png) -[//]: # () -[//]: # (Similarly, how an undo operation goes through the `Model` component is shown below:) -[//]: # () -[//]: # (![UndoSequenceDiagram](images/UndoSequenceDiagram-Model.png)) +
:information_source: **Note:** If a command fails its execution, it will not call `Model#commitMediCLI()`, so the MediCLI state will not be saved into the `mediCLIStateList`. -[//]: # () -[//]: # (The `redo` command does the opposite — it calls `Model#redoMediCLI()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the MediCLI to that state.) -[//]: # () -[//]: # (
:information_source: **Note:** If the `currentStatePointer` is at index `mediCLIStateList.size() - 1`, pointing to the latest MediCLI state, then there are no undone MediCLI states to restore. The `redo` command uses `Model#canRedoMediCLI()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.) +
+ + +Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoMediCLI()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous MediCLI state, and restores the MediCLI to that state. + + +![UndoRedoState3](images/UndoRedoState3.png) + + +
:information_source: **Note:** If the `currentStatePointer` is at index 0, pointing to the initial MediCLI state, then there are no previous MediCLI states to restore. The `undo` command uses `Model#canUndoMediCLI()` to check if this is the case. If so, it will return an error to the user rather + +than attempting to perform the undo. + + +
+ + +The following sequence diagram shows how an undo operation goes through the `Logic` component: + + +![UndoSequenceDiagram](images/UndoSequenceDiagram-Logic.png) + + +
:information_source: **Note:** The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. + + +
+ + +Similarly, how an undo operation goes through the `Model` component is shown below: -[//]: # () -[//]: # (
) -[//]: # () -[//]: # (Step 5. The user then decides to execute the command `list`. Commands that do not modify the MediCLI, such as `list`, will usually not call `Model#commitMediCLI()`, `Model#undoMediCLI()` or `Model#redoMediCLI()`. Thus, the `mediCLIStateList` remains unchanged.) +![UndoSequenceDiagram](images/UndoSequenceDiagram-Model.png) + + +The `redo` command does the opposite — it calls `Model#redoMediCLI()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the MediCLI to that state. + + +
:information_source: **Note:** If the `currentStatePointer` is at index `mediCLIStateList.size() - 1`, pointing to the latest MediCLI state, then there are no undone MediCLI states to restore. The `redo` command uses `Model#canRedoMediCLI()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. + + +
+ + +Step 5. The user then decides to execute the command `list`. Commands that do not modify the MediCLI, such as `list`, will usually not call `Model#commitMediCLI()`, `Model#undoMediCLI()` or `Model#redoMediCLI()`. Thus, the `mediCLIStateList` remains unchanged. + + +![UndoRedoState4](images/UndoRedoState4.png) + + +Step 6. The user executes `clear`, which calls `Model#commitMediCLI()`. Since the `currentStatePointer` is not pointing at the end of the `mediCLIStateList`, all MediCLI states after the `currentStatePointer` will be purged. Reason: It no longer makes sense to redo the `addpatient i/S1234567A n/John Doe d/2003-01-30 p/98765432` command. This is the behavior that most modern desktop applications follow. + + +![UndoRedoState5](images/UndoRedoState5.png) + + +The following activity diagram summarizes what happens when a user executes a new command: + + + + + +#### Design considerations: -[//]: # () -[//]: # (![UndoRedoState4](images/UndoRedoState4.png)) -[//]: # () -[//]: # (Step 6. The user executes `clear`, which calls `Model#commitMediCLI()`. Since the `currentStatePointer` is not pointing at the end of the `mediCLIStateList`, all MediCLI states after the `currentStatePointer` will be purged. Reason: It no longer makes sense to redo the `addpatient i/S1234567A n/John Doe d/2003-01-30 p/98765432` command. This is the behavior that most modern desktop applications follow.) +**Aspect: How undo & redo executes:** -[//]: # () -[//]: # (![UndoRedoState5](images/UndoRedoState5.png)) -[//]: # () -[//]: # (The following activity diagram summarizes what happens when a user executes a new command:) +* **Alternative 1 (current choice):** Saves the entire MediCLI. -[//]: # () -[//]: # () + * Pros: Easy to implement. -[//]: # () -[//]: # (#### Design considerations:) + * Cons: May have performance issues in terms of memory usage. -[//]: # () -[//]: # (**Aspect: How undo & redo executes:**) -[//]: # () -[//]: # (* **Alternative 1 (current choice):** Saves the entire MediCLI.) +* **Alternative 2:** Individual command knows how to undo/redo by -[//]: # ( * Pros: Easy to implement.) + itself. -[//]: # ( * Cons: May have performance issues in terms of memory usage.) + * Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). -[//]: # () -[//]: # (* **Alternative 2:** Individual command knows how to undo/redo by) + * Cons: We must ensure that the implementation of each individual command are correct. -[//]: # ( itself.) -[//]: # ( * Pros: Will use less memory (e.g. for `delete`, just save the person being deleted).) +_{more aspects and alternatives to be added}_ -[//]: # ( * Cons: We must ensure that the implementation of each individual command are correct.) -[//]: # () -[//]: # (_{more aspects and alternatives to be added}_) +### \[Proposed\] Data archiving -[//]: # () -[//]: # (### \[Proposed\] Data archiving) -[//]: # () -[//]: # (_{Explain here how the data archiving feature will be implemented}_) +_{Explain here how the data archiving feature will be implemented}_ ## Planned Enhancements