Skip to content

[CS2113-T11b-4] ClinicEase#32

Open
chwenyee wants to merge 329 commits into
nus-cs2113-AY2425S2:masterfrom
AY2425S2-CS2113-T11b-4:master
Open

[CS2113-T11b-4] ClinicEase#32
chwenyee wants to merge 329 commits into
nus-cs2113-AY2425S2:masterfrom
AY2425S2-CS2113-T11b-4:master

Conversation

@chwenyee

Copy link
Copy Markdown

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.

@nus-se-bot nus-se-bot closed this Feb 21, 2025
@damithc damithc reopened this Feb 21, 2025
rchlai added a commit to rchlai/tp that referenced this pull request Mar 16, 2025
Ashertan256 pushed a commit to Ashertan256/tp that referenced this pull request Mar 18, 2025
Add assert statements in DataStorage.java

@xenthm xenthm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job overall! Keep up the good work! However, consider using assertions and adding some JavaDoc comments to your classes and methods.

Comment thread README.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this to fit your app.

Comment thread src/main/java/miscellaneous/Parser.java Outdated
Comment on lines +77 to +82
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/");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the command prefixes (e.g. n/, ic/) so they can be reused. It also helps cut down on "magic strings".

Comment thread src/main/java/miscellaneous/Parser.java Outdated
}

start += prefix.length();
String[] possible = {"n/", "ic/", "dob/", "g/", "p/", "a/", "dt/", "t/", "dsc/", "h/"};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +79 to +82
Ui.showLine();
System.out.println("-".repeat(43)+ "Patient Details" + "-".repeat(43));
System.out.println(patients.get(nric).toString());
Ui.showLine();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ID in DuplicatePatientIDException should be Id instead, according to the course coding standards.

Comment on lines +47 to +69
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
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation for these two method are inconsistent.

Comment on lines +31 to +32
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";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting commonly used test inputs to avoid duplicated string definitions.

Comment on lines +45 to +65
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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the significance of the numbers 15 and 13? Consider extracting the logic for these "magic numbers" out.

Comment thread src/main/java/miscellaneous/Parser.java Outdated
Comment on lines +11 to +18
public static boolean isAddPatient(String input) {
return input.toLowerCase().startsWith("add-patient");
}


public static boolean isDeletePatient(String input) {
return input.toLowerCase().startsWith("delete-patient");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

chwenyee and others added 24 commits March 27, 2025 23:19
…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
# Conflicts:
#	src/main/java/storage/patient_data.txt
Adjusted the patient_data file, implemented save feature to delete-patient, added assertions in ManagementSystem
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.