Skip to content

Commit 1b36bf3

Browse files
authored
Update Medical History of DG (#99)
* Update DG for Medical History feature * Update class diagrams for MedicalHistory * Update MedicalHistory class diagram into images * Add MedicalHistory Class Diagram into DG
1 parent 907001d commit 1b36bf3

File tree

4 files changed

+44
-7
lines changed

4 files changed

+44
-7
lines changed

docs/DeveloperGuide.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ How the parsing works:
121121

122122
The `Model` component,
123123

124-
* stores the address book data and appointment book data (both upcoming and archived) i.e., all `Person`, `Appointment` objects (which are contained in `UniquePersonList` and `UniqueAppointmentList` objects).
125-
* stores the currently 'selected' `Person` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
124+
* stores the address book data and appointment book data (both upcoming and archived) i.e., all `Patient`, `Appointment` objects (which are contained in `UniquePersonList` and `UniqueAppointmentList` objects).
125+
* stores the currently 'selected' `Patient` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
126126
* stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` objects.
127127
* does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components)
128128

129-
<div markdown="span" class="alert alert-info">:information_source: **Note:** An alternative (arguably, a more OOP) model is given below. It has a `Tag` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Tag` object per unique tag, instead of each `Person` needing their own `Tag` objects.<br>
129+
<div markdown="span" class="alert alert-info">:information_source: **Note:** An alternative (arguably, a more OOP) model is given below. It has a `Tag` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Tag` object per unique tag, instead of each `Patient` needing their own `Tag` objects.<br>
130130

131131
<img src="images/BetterModelClassDiagram.png" width="450" />
132132

@@ -154,9 +154,36 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa
154154

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

157+
### Recording a Patient's Medical History feature
158+
159+
Having relatable medical history entries of a patient can help clinic staff provide more contextual service to patients. Therefore, a patient management record system should have a feature for clinic staff to add, edit, and delete medical history options of the patient.
160+
161+
#### How Medical History is implemented
162+
The proposed medical history mechanism was built with a class, ```MedicalHistory```. Within the ```MedicalHistory``` class, each entry of a pateint's medical history is stored under a private variable ```listOfEntries```. An entry of ```MedicalHistory``` is a private inner (nested) class within the ```MedicalHistory``` class, ```MedicalHistoryEntry```.
163+
164+
These are the following methods created for the MedicalHistory feature:
165+
* ```MedicalHistory#addEntry(String s)```- adds a new entry of medical history into the patient.
166+
* ```MedicalHistory#editEntry(int index, String s)```- edits an entry of medical history that has been recorded and saved.
167+
* ```MedicalHistory#removeEntry(int index, String s)```- removes an entry of medical history, so the entry is no longer recorded.
168+
169+
These operations are exposed via the ```Patient``` class as `Patient#addMedicalHistory(String s)`, `Patient#editMedicalHistory(int i, String s)` and `Patient#removeMedicalHistory(int i)` respectively.
170+
171+
#### Reason for implementation of MedicalHistory
172+
```Patient``` and ```MedicalHistory``` share a whole-part relationship, that is, when a ```Patient``` object is destroyed, the corresponding ```MedicalHistory``` object is also destroyed. There is a 1...1 multiplicity relationship between a ```Patient``` and a ```MedicalHistory```, as one patient can only have one medical history. Hence, applying the Composition principle, a single ```MedicalHistory``` is composed within ```Patient```.
173+
174+
Since the whole-part relationship also exists between ```MedicalHistory``` and ```MedicalHistoryEntry```, ```MedicalHistoryEntry``` is composed within ```MedicalHistory``` as well. However, since the multiplicity of the relationship between ```MedicalHistory``` and ```MedicalHistoryEntry``` is 1 to any number, that is, a medical history can have any number of medical history entries, the composition is wrapped by an ArrayList<MedicalHistoryEntry>, which stores an expandable list of medical history entries.
175+
176+
<img src="images/MedicalHistoryClassDiagram.png" width="150" />
177+
178+
### Alternatives considered
179+
180+
1. Storing an entry of MedicalHistory as a String
181+
182+
An alternative implementation to record MedicalHistory would be to not break down ```MedicalHistory``` into a list of ```MedicalHistoryEntries```, and instead store each entry as a String. This alternative results in a simpler build. However, this limits the information that an entry of medical history can store. For example, a clinic staff will not be able to tell from a String that this medical history is from 10 years ago, unless explicitly indicated by the staff. On the other hand, we can better handle more information of each entry and build more features for each entry accordingly, depending on the complexity requirement of a medical history entry from the cliic staff.
183+
157184
### Appointment composed of a Valid Patient when added, loaded and stored
158185

159-
#### Implementation
186+
#### How Appointment is implemented
160187

161188
Each `Appointment` in memory contains a reference to a valid `Patient` object. To ensure this valid reference is maintained while the app is running and between different running instances, modifications were made to how `Appointment` is added, loaded and stored.
162189

@@ -226,9 +253,6 @@ After every command that the user makes, appointments are saved. In `LogicManage
226253
* **Cons:** Takes more computational work when loading compared to finding the `Patient` at an index at O(1) time.
227254

228255

229-
230-
231-
232256
### \[Proposed\] Undo/redo feature
233257

234258
#### Proposed Implementation
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@startuml
2+
!include style.puml
3+
skinparam arrowThickness 1.1
4+
skinparam arrowColor MODEL_COLOR
5+
skinparam classBackgroundColor MODEL_COLOR
6+
7+
Patient *--> MedicalHistory
8+
MedicalHistory *--> "*" MedicalHistoryEntry
9+
10+
ModelManager -->"~* filtered" Patient
11+
@enduml

docs/diagrams/ModelClassDiagram.puml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Class Name
2929
Class Phone
3030
Class Tag
3131
Class MedicalHistory
32+
Class MedicalHistoryEntry
3233

3334
Class Appointment
3435
Class Date
@@ -62,6 +63,7 @@ Patient *--> Email
6263
Patient *--> Address
6364
Patient *--> MedicalHistory
6465
Patient *--> "*" Tag
66+
MedicalHistory *--> "*" MedicalHistoryEntry
6567

6668
UniqueAppointmentList --> "~* all" Appointment
6769
Appointment *--> Date
7.62 KB
Loading

0 commit comments

Comments
 (0)