[CS2113-T11b-4] ClinicEase#32
Conversation
Add assert statements in DataStorage.java
xenthm
left a comment
There was a problem hiding this comment.
Great job overall! Keep up the good work! However, consider using assertions and adding some JavaDoc comments to your classes and methods.
| String name = extractValue(temp, "n/"); | ||
| String nric = extractValue(temp, "ic/"); | ||
| String birthdate = extractValue(temp, "dob/"); | ||
| String gender = extractValue(temp, "g/"); | ||
| String phone = extractValue(temp, "p/"); | ||
| String address = extractValue(temp, "a/"); |
There was a problem hiding this comment.
Consider extracting the command prefixes (e.g. n/, ic/) so they can be reused. It also helps cut down on "magic strings".
| } | ||
|
|
||
| start += prefix.length(); | ||
| String[] possible = {"n/", "ic/", "dob/", "g/", "p/", "a/", "dt/", "t/", "dsc/", "h/"}; |
There was a problem hiding this comment.
[continued from the other comment about magic string extraction] If you choose to put the command prefixes in an Enum, you can use the built-in values() method instead of listing everything.
There was a problem hiding this comment.
Consider having another way of differentiating your exceptions other than just the class type. For example, all InvalidInputFormatExceptions can have a default message while still allowing for an additional custom message to be input into its constructor.
| Ui.showLine(); | ||
| System.out.println("-".repeat(43)+ "Patient Details" + "-".repeat(43)); | ||
| System.out.println(patients.get(nric).toString()); | ||
| Ui.showLine(); |
There was a problem hiding this comment.
Since most of your messages are sandwiched between two showLine()s, consider creating a method in Ui that does it for you.
| @@ -0,0 +1,7 @@ | |||
| package exception; | |||
|
|
|||
| public class DuplicatePatientIDException extends Exception { | |||
There was a problem hiding this comment.
The ID in DuplicatePatientIDException should be Id instead, according to the course coding standards.
| public String toString() { | ||
| return String.format( | ||
| "Patient ID: %s\n" + | ||
| "Name: %s\n" + | ||
| "Date of Birth: %s\n" + | ||
| "Gender: %s\n" + | ||
| "Address: %s\n" + | ||
| "Contact: %s", | ||
| id, name, dob, gender, address, contactInfo | ||
| ); | ||
| } | ||
|
|
||
| public String toStringForListView() { | ||
| return String.format( | ||
| "Patient ID: %s\n " + | ||
| "Name: %s\n " + | ||
| "Date of Birth: %s\n " + | ||
| "Gender: %s\n " + | ||
| "Address: %s\n " + | ||
| "Contact: %s", | ||
| id, name, dob, gender, address, contactInfo | ||
| ); | ||
| } |
There was a problem hiding this comment.
The indentation for these two method are inconsistent.
| String input1 = "add-patient n/John Doe ic/S1234567A dob/01-01-1990 g/M p/98765432 a/123 Main St"; | ||
| String input2 = "add-patient n/John Smith ic/S1234567A dob/01-10-1999 g/M p/91207878 a/123 High St"; |
There was a problem hiding this comment.
Consider extracting commonly used test inputs to avoid duplicated string definitions.
| if (line.length() < 15) { | ||
| throw new InvalidInputFormatException("Invalid command format. Use: delete-patient [NRIC]"); | ||
| } | ||
|
|
||
| String nric = line.substring(15).trim(); // Trim whitespace | ||
|
|
||
| if (patients.containsKey(nric)) { | ||
| Patient removedPatient = patients.remove(nric); | ||
| Ui.showLine(); | ||
| System.out.println("Patient removed successfully: " + removedPatient.getName() | ||
| + " (NRIC: " + nric + ")"); | ||
| Ui.showLine(); | ||
| } else { | ||
| Ui.showLine(); | ||
| System.out.println("Patient with NRIC " + nric + " not found."); | ||
| Ui.showLine(); | ||
| } | ||
| } | ||
|
|
||
| public void viewPatient(String line) throws InvalidInputFormatException{ | ||
| if (line.length() < 13) { |
There was a problem hiding this comment.
What is the significance of the numbers 15 and 13? Consider extracting the logic for these "magic numbers" out.
| public static boolean isAddPatient(String input) { | ||
| return input.toLowerCase().startsWith("add-patient"); | ||
| } | ||
|
|
||
|
|
||
| public static boolean isDeletePatient(String input) { | ||
| return input.toLowerCase().startsWith("delete-patient"); | ||
| } |
There was a problem hiding this comment.
Consider extracting these command strings to reduce the amount of "magic strings". This will help in maintaining the codebase if you decide to update them (e.g. when printing help messages to the user upon detecting a wrong input format).
…stAppointment and SortAppointment
restored junit and authored
…into fix2 # Conflicts: # src/main/java/manager/ManagementSystem.java
# Conflicts: # src/main/java/manager/ManagementSystem.java # src/main/java/manager/Patient.java # src/main/java/miscellaneous/Parser.java
Yukuan edit patients detail
# Conflicts: # src/main/java/storage/patient_data.txt
Adjusted the patient_data file, implemented save feature to delete-patient, added assertions in ManagementSystem
Mark find appointments
# Conflicts: # src/main/java/manager/ManagementSystem.java # src/main/java/manager/Patient.java # src/main/java/miscellaneous/Parser.java # src/main/java/miscellaneous/Ui.java # src/test/java/manager/ManagementSystemTest.java
Update PPP with clickable full URL
Final DG pushes
Added table content for DG
Updated DG and UG some more, updated PPP
Branch ppp
Emptying data files
Small change in PPP
ClinicEase helps doctors manage patient details and their respective appointment schedules. It is optimized for CLI users so that frequent tasks, such as adding patients and scheduling appointments, can be done efficiently using commands.