-
Notifications
You must be signed in to change notification settings - Fork 103
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
[CS2113-F11-4] OneDoc #18
base: master
Are you sure you want to change the base?
Changes from 213 commits
0b4e0fb
e96013d
5ba3ea9
8b35304
edde5bb
204b7b9
98cee24
26394ca
8103783
4509c18
18b12db
c31d1bd
c6d0cd4
1931c27
aec2f50
14a3ee0
aea222f
710b825
d6d5574
5f2ca79
bca5f80
fac9a06
4faf1e8
64b4fc0
bcfc4a2
2d1df4c
0117623
c88ce51
b7857e7
0911559
4da0df0
d818517
2258c09
48a806e
b78ad6c
ff3a960
84d17d3
bea7275
b691425
5fca922
d9c0bc7
a5ee4e6
1c8b17d
0503fe8
b2bf5b5
8529eda
a83d4fe
7cba87d
2ed9adb
3df31f2
1c526b8
f61265e
a00eba7
23d816d
5efe197
772fe34
ad26d5b
df24f31
0a92d65
8b4f970
25b871f
11b84c5
b6f1e0c
b669875
cded4d4
ea1b29a
f4be8f3
38fbee3
203474a
c4a4514
4307258
711d611
ede05f8
8bf9513
7755a5f
9d39485
d5b0c99
19fa5dc
f81fe30
91933e1
938ed17
f76ba63
d7ab5f9
7f7ce54
be52914
157d3c6
42cd338
d4e8ad4
7aa4162
657486c
34350ed
33edb74
918ed0f
cf10a21
fdae550
97033a0
8197871
53af65c
b652594
187ef7e
6c5faa2
a57bd38
9a86a4f
c5b4638
08c3177
d45f5df
7d4ef74
f6702a9
813cc2f
5d43a09
3affda4
9c3a6d9
05a1a6d
f643090
4e7b222
0d7259d
f34d9e4
0905820
46d58cc
99012fe
89f33b7
77325a4
b78d0d2
ff7be73
9e14d4a
4047132
d87a34e
03826f7
be970c6
9a1c76d
dea19f8
a42ece9
5e6f41f
b0fc744
c8b94f6
6fa3b87
ac7af68
783e005
684811d
636325f
adf4191
e4ff4ad
336f624
7283ca8
736773f
20c3a91
970f9b7
1033494
385914d
c7f9e4e
f53dc10
cca6b1c
0985847
1971737
5b80bcf
029813d
e2a92e4
d4c839a
0e7292f
7245665
4c22a17
e1637f2
bd098b1
cb7ccbb
bac808b
1608e89
e5e6118
1a07d61
a83ce98
ef8fa06
9964c38
5b8689e
871f4c2
b20fb57
988e8a6
6446074
af4cd8b
dddd334
4959bbe
b91b0a0
8014102
803834a
721344e
c253c75
b2b1054
28dce41
3a404d2
702c66b
35a9968
d8c1dd0
62f6d1c
eaff1c7
a75a468
a639af7
254d05f
ed18e3b
8a9c15d
63aae07
3eb79db
63bd07a
ff3b416
a65fd7c
6f878cc
e2810b8
db6d945
d7f724f
100aac2
814a2a1
89211b7
b0b6b93
402933f
a9d5179
43b1771
8f1ad22
4f90385
e33d838
a8b1fa0
8b341db
e6c4b6b
daf1bee
fa79c1f
b73e961
d6b98c9
3cd2ffb
a882364
55d5159
93eae29
2f58fb2
402bb1a
28046f6
8d40b6a
0d049cf
1bd6755
d7c7c39
371c324
e5be161
118984c
284e439
33a1493
9c9d15e
73f7b4f
858ba7d
6357370
d9221ba
f6a6e0b
93863cd
f5af290
c0932f6
272cb2d
5509507
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@startuml | ||
class PrescriptionList { | ||
+ void add(ui:UI, patientId:String, medicine:String, dosage:String, timeInterval:String) | ||
+ void add(ui:UI, patientId:String, medicine:String, dosage:String, timeInterval:String, isActive:boolean) | ||
+ void viewAll(ui:UI) | ||
+ void viewPatientPrescription(ui:UI, patientId:String) | ||
+ void viewActivePatientPrescription(ui:UI, patientId:String) | ||
+ void edit(ui:UI, prescriptionNumber:int, medicine:String, dosage:String, timeInterval:String) | ||
+ void activatePrescription(ui:UI, prescriptionNumber:String) | ||
+ void deactivatePrescription(ui:UI, prescriptionNumber:String) | ||
} | ||
|
||
class Prescription { | ||
} | ||
|
||
class UI {} | ||
|
||
PrescriptionList *-down-> "*" Prescription : "contains" > | ||
PrescriptionList .right.> UI | ||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@startuml | ||
Class01 <|-- Class02 | ||
Class03 *-- Class04 | ||
Class05 o-- Class06 | ||
Class07 .. Class08 | ||
Class09 -- Class10 | ||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:----------:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | Dhanish | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Kasey Kwok | [Github](https://github.com/kaseykwok) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Mor Ben Ami | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,96 @@ | |
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
Storage class and its functions are largely adapted from Dhanish's IP on Duke. | ||
|
||
## Design & implementation | ||
|
||
The Patient and PatientList classes are used in conjunction to manage patients, and the list of patients. Each patient has a name, | ||
an ID, a date of birth and gender. The PatientList class holds an ArrayList of Patients and manipulates them accordingly. | ||
|
||
At the start of the program, a new PatientList object is instantiated. Through methods in the Storage class, data is read from the | ||
relevant text files to create Patients that existed prior to the last closure of the program, and then adds these patients to the | ||
ArrayList in PatientList. This finishes the initial set-up. | ||
|
||
Methods in PatientList class: | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a sequence diagram could be added to better give an understanding on the methods |
||
addPatient - this method takes in the aforementioned variables through UI class and parses them. If they are all valid, a new | ||
Patient is created and added to the ArrayList in PatientList. | ||
|
||
findPatient - this method takes in an ID, iterates through the ArrayList of Patients and compares the ID with the ID of each of the | ||
existing Patients in the list. If there is a match, the corresponding Patient is returned. Else, returns null. | ||
|
||
retrievePatient - this method is very similar to findPatient, but instead of returning the Patient found, it prints out the details | ||
of the Patient using the toString method in the Patient class. | ||
|
||
listPatients - this method first checks if the ArrayList of Patients is non-empty. If not so, it prints a message that there are | ||
no patients in the system currently and terminates. | ||
Else, it iterates through the ArrayList of Patients and uses the toString method in Patient to print out the details of each Patient. | ||
|
||
modifyPatientDetails - this method takes in name, birthDate, gender and ID. It tries to find the patient with a matching ID. | ||
If the patient is not found, returns. Else, if the name is not an empty String, replace the existing name with the input name. | ||
Repeat for birthDate and gender. | ||
|
||
### VisitList Component | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there could be a class diagram used here for a better visual understanding of the design and implementation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a class diagram for the VisitList Component as well. |
||
The `VisitList` Component, | ||
* stores the list of visits | ||
* can add new visit to the list | ||
* can edit reason for an existing visit in the list | ||
* can view all visits in the list | ||
* can view all visits for a patient | ||
* can view a specific visit | ||
* depends on `UI` class (as the `VisitList` component interacts with user through the UI component, and makes use of its methods to print details) | ||
|
||
**Methods in `VisitList` class:** | ||
* `addVisit` - This method allows user to add a visit to the `VisitList` by specifying `id` of patient, `dateOfVisit`, and `timeOfVisit`. | ||
* `editReason` - This method allows user to edit reason for an existing visit, by specifying `id` of patient and `reason` for visit | ||
* `viewAll` - This method iterates through the list of all visits, and prints each visit record | ||
* `viewPatient` - This method iterates through the list of all visits, and prints the visit records that match the specified `id` of patient | ||
* `viewVisit` - This method iterates through the list of all visits, and prints the visit record that matches the specified `index` of the visit | ||
|
||
### PrescriptionList component | ||
**API**: `PrescriptionList.java` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The composition of the Prescription object is already shown by the prescription arrow and the unidirectional navigability. The "contains" might be redundant. |
||
![](../diagrams/PrescriptionListClassDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
The `PrescriptionList` component, | ||
* stores the list of prescriptions | ||
* can add new prescription to the list | ||
* can edit existing prescriptions inside the list | ||
* can change the status of prescription inside the list | ||
* can view all prescriptions, view a patient's prescription or view a patient's active prescription | ||
* depends on `UI` class (because the `PrescriptionList` component needs to interact with user through the `UI` | ||
component) | ||
|
||
**Methods in `PrescriptionList` class:** | ||
|
||
* **`add`** - This method allow user to add prescription into the list by specifying `patientId`, `medicine`, `dosage` and | ||
`timeInterval`. | ||
* **`viewAll`** - This methods iterates through the list of all prescriptions and print the details of prescriptions from | ||
all patients. | ||
* **`viewPatientPrescription`** - This method iterates through the list of prescriptions and print the details of | ||
prescriptions from the specified `patientId`. | ||
* **`viewActivePatientPrescription`** - This method iterates through the list of prescriptions and print the details of | ||
all active prescriptions with the specified `patientId` | ||
* **`edit`** - This method allows user to edit the `medicine`, `dosage` or `timeInterval` of the prescription of the | ||
specified index | ||
* **`activatePrescription`** - This method allows user to set the prescription of specified index as active. | ||
* **`deactivatePrescription`** - This method allows user to set the prescription of specified index as inactive. | ||
|
||
### Prescription component | ||
The `Prescription` component, | ||
* stores the medicine name | ||
* the medicines timeInterval | ||
* patient ID | ||
* dosage | ||
* if the Prescription is active or not | ||
|
||
**Methods in `Prescription` class:** | ||
* 'add' - creates a new Prescription - needs to insert all the components except if active or not (if not included the default is active ) | ||
* Getters and Setters for each of the components | ||
* Print format | ||
* method that checks if a patient has the Prescription | ||
* method that checks if a patient has the Prescription and if the Prescription is active | ||
## Product scope | ||
### Target user profile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should add more details for these part in the future |
||
|
||
|
@@ -27,8 +112,18 @@ | |
|
||
## Non-Functional Requirements | ||
|
||
{Give non-functional requirements} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think this is a non-functional requirements |
||
Parser: | ||
|
||
The parsing class utilizes regex for each of the commands for two main reasons: usability and error-catching. | ||
|
||
For usability, the input is automatically separated into distinct groups through the Java regex library, which allows | ||
input such as ID, name, etc. to be pulled out in multi-word or one word parts. | ||
|
||
For error-catching, the input is checked to be in a certain format (i.e. DOB is DD-MM-YYYY) | ||
or of a certain type (i.e. the ID is one word made up of letters and numbers). | ||
|
||
If there is an error, the regex also helps with identifying the exact error issue, and | ||
sending that back to the user. | ||
## Glossary | ||
|
||
* *glossary item* - Definition | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public enum MainMenuState { | ||
PATIENT, | ||
VISIT, | ||
PRESCRIPTION, | ||
INVALID, | ||
EXIT | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
public class OneDoc { | ||
|
||
private static UI ui; | ||
protected PatientList patientsList; | ||
protected VisitList visitsList; | ||
protected PrescriptionList prescriptionsList; | ||
protected static Parser parser; | ||
protected static Storage storage; | ||
private static MainMenuState mainMenuState; | ||
|
||
public OneDoc() { | ||
ui = new UI(); | ||
patientsList = new PatientList(); | ||
visitsList = new VisitList(); | ||
prescriptionsList = new PrescriptionList(); | ||
storage = new Storage(); | ||
storage.loadData(patientsList, visitsList, prescriptionsList); | ||
parser = new Parser(patientsList, visitsList, prescriptionsList, ui, storage); | ||
mainMenuState = MainMenuState.INVALID; | ||
} | ||
|
||
public static void main(String[] args) { | ||
new OneDoc(); | ||
run(); | ||
} | ||
|
||
public static void subMenuRun() { | ||
SubMenuState subMenuState = SubMenuState.IN_SUB_MENU; | ||
|
||
ui.printSubMenu(mainMenuState); | ||
while (true) { | ||
String input = ui.readLine(); | ||
switch (mainMenuState) { | ||
case PATIENT: | ||
subMenuState = parser.patientParser(input); | ||
break; | ||
case VISIT: | ||
subMenuState = parser.visitParser(input); | ||
break; | ||
case PRESCRIPTION: | ||
subMenuState = parser.prescriptionParser(input); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
if (subMenuState == SubMenuState.BACK_TO_MAIN) { | ||
break; | ||
} else if (subMenuState == SubMenuState.EXIT) { | ||
mainMenuState = MainMenuState.EXIT; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public static void mainMenuRun() { | ||
while (mainMenuState != MainMenuState.EXIT) { | ||
ui.printMainMenu(); | ||
String input = ui.readLine(); | ||
mainMenuState = parser.mainMenuParser(input); | ||
|
||
if (mainMenuState == MainMenuState.EXIT) { | ||
break; | ||
} else if (mainMenuState == MainMenuState.INVALID) { | ||
ui.printInvalidMainMenuErrorMessage(); | ||
continue; | ||
} | ||
|
||
subMenuRun(); | ||
} | ||
} | ||
|
||
public static void run() { | ||
ui.printWelcomeMessage(); | ||
mainMenuRun(); | ||
ui.printExitMessage(); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class OneDocException extends Exception { | ||
|
||
public OneDocException(String message) { | ||
super(message); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a diagram showing the overall structure of the program could be added.