From 454fe44ca95803fc495091157ae38a41a76e0dd1 Mon Sep 17 00:00:00 2001 From: Mohammed-Faizzzz <110959467+Mohammed-Faizzzz@users.noreply.github.com> Date: Fri, 3 Nov 2023 07:28:42 +0800 Subject: [PATCH 01/10] Make final changes --- docs/UserGuide.md | 61 ++++++++++++------- .../java/seedu/address/logic/Messages.java | 4 +- .../model/appointment/Appointment.java | 17 +----- .../storage/JsonAdaptedAppointment.java | 16 +---- .../seedu/address/ui/AppointmentCard.java | 5 +- .../address/model/person/AppointmentTest.java | 8 --- .../address/testutil/AppointmentBuilder.java | 5 +- 7 files changed, 49 insertions(+), 67 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 7d825fe55a0..3c0fc3f07ca 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -100,13 +100,21 @@ A person can have any number of tags (including 0) - Phone Numbers and Emails have to be in a valid format. - PHONE_NUMBER must have exactly 8 digits. - EMAIL must contain email domain (eg. `@gmail.com`). -- PATIENT must contain the valid IC of a Patient in the Database. +- TAG must be a valid specialisation and one of the following: + 1. Cardiologist + 2. Orthopedic + 3. Pediatrician + 4. Dermatologist + 5. Neurologist + 6. General_Practitioner + 7. Psychiatrist + 8. Surgeon Examples: -* `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 pt/T0123456H` +* `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 t/Pediatrician` * `add-doctor n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/Surgeon` ### Adding a Patient: `add-patient` @@ -124,7 +132,10 @@ Format: `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e - Phone Numbers and Emails have to be in a valid format. - PHONE_NUMBER must have exactly 8 digits. - EMAIL must contain email domain (eg. `@gmail.com`). -- DOCTOR must contain the valid IC of a doctor in the Database. +- TAG must indicate Priority Level of the Patient and be one of the following: + - Low + - Medium + - High - EMERGENCY_CONTACT must contain valid emergency contact number, which needs to be a valid phone number. - Blood type must be a combination of A/B/AB/O and +/- @@ -132,28 +143,29 @@ Format: `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e Examples: -* `add-patient n/John Doe ic/S9851386G g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 d/T0123456H c/pneumothorax b/O+` -* `add-patient n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/High Priority pt/T0123556H` +* `add-patient n/John Doe ic/S9851386G g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 c/pneumothorax b/O+ t/Low` +* `add-patient n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 c/AIDS b/O+ t/High` ### Creating an Appointment : `new-appt` Creates a new appointment for patients. -Format: `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm:ss` +Format: `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm`
**:information_source: Take Note:**
- All fields are Required. -- TIME must follow the specified format (ie. `yyyy-MM-dd HH:mm:ss`). +- TIME must follow the specified format (ie. `yyyy-MM-dd HH:mm`), where `HH:mm` follows the 24hr format. - PATIENT must contain the valid IC of a Patient in the Database. - DOCTOR must contain the valid IC of a Doctor in the Database. +- There must not be conflicting Appointments (eg the doctor already has an appointment with another patient at the same time)
Examples: -* `new-appt pic/T0123456H dic/S9851586G time/2023-10-30T13:00:00` +* `new-appt pic/T0123456H dic/S9851586G time/2023-10-30 13:00` ### Deleting an Appointment : `delete-appt` @@ -213,12 +225,13 @@ Format: `edit NRIC [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​` * When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative. * You can remove all the person’s tags by typing `t/` without specifying any tags after it. +* Note: In our app, the Remark Section will be left blank by default. Edit Command can be used to add any misc info not captured by other fields such as possible allergies, medical history, etc. Examples: * `edit T0123456A p/91234567 e/johndoe@example.com g/F` Edits the phone number and email address of the 1st person to be `91234567` and `johndoe@example.com` respectively. -* `edit S9876543B pt/T0123456A n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all +* `edit S9876543B ic/T0123456A n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags. ### Locating persons by name: `find` @@ -332,17 +345,19 @@ the data of your previous MediLink Contacts home folder. ## Command summary -| Action | Format, Examples | -|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **New Doctor** | `add-doctor n/NAME ic/IC g/GENDER p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​`
e.g., `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 pt/T0123456H` | -| **New Patient** | `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e/EMAIL a/ADDRESS [t/TAG] [d/DOCTOR] [c/CONDITION] [b/BLOODTYPE] …​`
e.g., `add-patient n/John Doe ic/S9851386G g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 d/T0123456H c/pneumothorax b/O+` | -| **New Appointment** | `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm:ss`
e.g., `new-appt pic/T0123456H dic/S9851586G time/yyyy-MM-dd 13:00:00` | -| **Clear** | `clear` | -| **Undo** | `undo` | -| **Redo** | `redo` | -| **Delete** | `delete INDEX`
e.g., `delete 3` | -| **Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`
e.g.,`edit 2 n/James Lee e/jameslee@example.com` | -| **Find** | `find KEYWORD [MORE_KEYWORDS]`
e.g., `find James Jake` | -| **List** | `list` | -| **Help** | `help` | - +| Action | Format, Examples | +|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **New Doctor** | `add-doctor n/NAME ic/IC g/GENDER p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​`
e.g., `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 t/Pediatrician` | +| **New Patient** | `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e/EMAIL a/ADDRESS [t/TAG] [d/DOCTOR] [c/CONDITION] [b/BLOODTYPE] …​`
e.g., `add-patient n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 c/AIDS b/O+ t/High` | +| **New Appointment** | `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm`
e.g., `new-appt pic/T0123456H dic/S9851586G time/2023-10-30 13:00` | +| **Delete Appointment** | `delete-appt INDEX`
e.g., delete-appt 1 | +| **Find Appointment** | `find-appt NRIC`
e.g., find-appt T00012220 | +| **Clear** | `clear` | +| **Undo** | `undo` | +| **Redo** | `redo` | +| **Delete** | `delete INDEX`
e.g., `delete 3` | +| **Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`
e.g.,`edit 2 n/James Lee e/jameslee@example.com` | +| **Find** | `find KEYWORD [MORE_KEYWORDS]`
e.g., `find James Jake` | +| **List** | `list` | +| **Help** | `help` | +| **Exit** | `exit` | diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/seedu/address/logic/Messages.java index 45e29a8ac0a..2a2c08675c7 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/seedu/address/logic/Messages.java @@ -64,9 +64,7 @@ public static String format(Appointment appointment) { .append("; Doctor involved: ") .append(appointment.getDoctor()) .append("; Time of appointment: ") - .append(appointment.getAppointmentTime()) - .append("; Status: ") - .append(appointment.getStatus()); + .append(appointment.getAppointmentTime()); return builder.toString(); } diff --git a/src/main/java/seedu/address/model/appointment/Appointment.java b/src/main/java/seedu/address/model/appointment/Appointment.java index 036f80be1d6..550cc6d2cbe 100644 --- a/src/main/java/seedu/address/model/appointment/Appointment.java +++ b/src/main/java/seedu/address/model/appointment/Appointment.java @@ -14,11 +14,10 @@ * Doctor and patient ic should not be the same. */ public class Appointment { - public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); private Ic doctorIc; private Ic patientIc; private LocalDateTime appointmentTime; - private String status = "scheduled"; /** * Constructs a new appointment with the specified doctor, patient, and appointment time. @@ -52,7 +51,6 @@ public Appointment(Ic doctorIc, Ic patientIc, LocalDateTime appointmentTime, Str this.doctorIc = doctorIc; this.patientIc = patientIc; this.appointmentTime = appointmentTime; - this.status = status; } public LocalDateTime getAppointmentTime() { @@ -67,10 +65,6 @@ public Ic getPatient() { return patientIc; } - public String getStatus() { - return status; - } - public void setAppointmentTime(LocalDateTime appointmentTime) { this.appointmentTime = appointmentTime; } @@ -83,10 +77,6 @@ public void changePatient(Ic newPatientIc) { this.patientIc = newPatientIc; } - public void changeStatus(String newStatus) { - this.status = newStatus; - } - @Override public boolean equals(Object other) { if (other == this) { @@ -101,13 +91,12 @@ public boolean equals(Object other) { Appointment otherAppointment = (Appointment) other; return this.doctorIc.equals(otherAppointment.doctorIc) && this.patientIc.equals(otherAppointment.patientIc) - && this.appointmentTime.equals(otherAppointment.appointmentTime) - && this.status.equals(otherAppointment.status); + && this.appointmentTime.equals(otherAppointment.appointmentTime); } @Override public int hashCode() { - return Objects.hash(doctorIc, patientIc, appointmentTime, status); + return Objects.hash(doctorIc, patientIc, appointmentTime); } @Override diff --git a/src/main/java/seedu/address/storage/JsonAdaptedAppointment.java b/src/main/java/seedu/address/storage/JsonAdaptedAppointment.java index dbe0e03deb3..c2f8048a35f 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedAppointment.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedAppointment.java @@ -24,7 +24,6 @@ class JsonAdaptedAppointment { private final String doctorIc; private final String patientIc; private final String appointmentTime; - private final String status; /** * Constructs a {@code JsonAdaptedTag} with the given {@code tagName}. @@ -32,12 +31,10 @@ class JsonAdaptedAppointment { @JsonCreator public JsonAdaptedAppointment(@JsonProperty("doctorIc") String doctorIc, @JsonProperty("patientIc") String patientIc, - @JsonProperty("appointmentTime") String appointmentTime, - @JsonProperty("status") String status) { + @JsonProperty("appointmentTime") String appointmentTime) { this.doctorIc = doctorIc; this.patientIc = patientIc; this.appointmentTime = appointmentTime; - this.status = status; } /** @@ -47,14 +44,6 @@ public JsonAdaptedAppointment(Appointment source) { doctorIc = source.getDoctor().value; patientIc = source.getPatient().value; appointmentTime = source.getAppointmentTime().format(formatter); - status = source.getStatus(); - } - - public String checkStatus() throws IllegalValueException { - if (status == null) { - throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, "Status")); - } - return status; } public LocalDateTime checkAppointmentTime() throws IllegalValueException { @@ -101,8 +90,7 @@ public Appointment toModelType() throws IllegalValueException { final Ic modelDoctor = checkIc(doctorIc); final Ic modelPatient = checkIc(patientIc); final LocalDateTime modelAppointmentTime = checkAppointmentTime(); - final String modelStatus = checkStatus(); - return new Appointment(modelDoctor, modelPatient, modelAppointmentTime, modelStatus); + return new Appointment(modelDoctor, modelPatient, modelAppointmentTime); } } diff --git a/src/main/java/seedu/address/ui/AppointmentCard.java b/src/main/java/seedu/address/ui/AppointmentCard.java index d67a060106d..fd462f7e85f 100644 --- a/src/main/java/seedu/address/ui/AppointmentCard.java +++ b/src/main/java/seedu/address/ui/AppointmentCard.java @@ -1,5 +1,7 @@ package seedu.address.ui; +import java.time.format.DateTimeFormatter; + import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.layout.HBox; @@ -12,6 +14,7 @@ public class AppointmentCard extends UiPart { private static final String FXML = "AppointmentListCard.fxml"; + public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); /** * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. @@ -42,6 +45,6 @@ public AppointmentCard(Appointment appointment, int displayedIndex) { id.setText("APPOINTMENT " + displayedIndex); patientIc.setText("Patient IC: " + this.appointment.getPatient().toString()); doctorIc.setText("Doctor IC: " + this.appointment.getDoctor().toString()); - appointmentTime.setText("Time of appointment: " + this.appointment.getAppointmentTime().toString()); + appointmentTime.setText("Time of appointment: " + this.appointment.getAppointmentTime().format(FORMATTER)); } } diff --git a/src/test/java/seedu/address/model/person/AppointmentTest.java b/src/test/java/seedu/address/model/person/AppointmentTest.java index 2d12f966d00..fd532c6f24e 100644 --- a/src/test/java/seedu/address/model/person/AppointmentTest.java +++ b/src/test/java/seedu/address/model/person/AppointmentTest.java @@ -102,14 +102,6 @@ public void testSetAppointmentTime() { assertEquals(newAppointment.getAppointmentTime(), VALID_DATE_2); } - @Test - public void testChangeStatus() { - String newStatus = "Completed"; - Appointment newAppointment = new Appointment(new Ic(VALID_NRIC_DEREK), new Ic(VALID_NRIC_AMY), VALID_DATE_1); - newAppointment.changeStatus(newStatus); - assertEquals(newAppointment.getStatus(), newStatus); - } - @Test public void equals() { Appointment newAppointment = new Appointment(new Ic(VALID_NRIC_DEREK), new Ic(VALID_NRIC_AMY), VALID_DATE_1); diff --git a/src/test/java/seedu/address/testutil/AppointmentBuilder.java b/src/test/java/seedu/address/testutil/AppointmentBuilder.java index e6e8e649e47..23be213349d 100644 --- a/src/test/java/seedu/address/testutil/AppointmentBuilder.java +++ b/src/test/java/seedu/address/testutil/AppointmentBuilder.java @@ -20,7 +20,6 @@ public class AppointmentBuilder { private Ic doctorIc; private Ic patientIc; private LocalDateTime appointmentTime; - private String status; /** * Constructor for the PersonBuilder class that initialises @@ -30,7 +29,6 @@ public AppointmentBuilder() { doctorIc = DEFAULT_DOCTOR_IC; patientIc = DEFAULT_PATIENT_IC; appointmentTime = DEFAULT_APPT_TIME; - status = "Scheduled"; } /** @@ -40,7 +38,6 @@ public AppointmentBuilder(Appointment appointmentToCopy) { this.doctorIc = appointmentToCopy.getDoctor(); this.patientIc = appointmentToCopy.getPatient(); this.appointmentTime = appointmentToCopy.getAppointmentTime(); - this.status = appointmentToCopy.getStatus(); } /** @@ -68,7 +65,7 @@ public AppointmentBuilder withAppointmentTime(LocalDateTime appointmentTime) { } public Appointment build() { - return new Appointment(doctorIc, patientIc, appointmentTime, status); + return new Appointment(doctorIc, patientIc, appointmentTime); } } From 52ac3e055edb7251b110ebd2d56e5c81257c30a5 Mon Sep 17 00:00:00 2001 From: Mohammed-Faizzzz <110959467+Mohammed-Faizzzz@users.noreply.github.com> Date: Fri, 3 Nov 2023 07:35:45 +0800 Subject: [PATCH 02/10] Resolve checkstyle issues --- build.gradle | 2 +- src/main/java/seedu/address/ui/AppointmentCard.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5cd2de53441..2ab2e09afbc 100644 --- a/build.gradle +++ b/build.gradle @@ -73,4 +73,4 @@ defaultTasks 'clean', 'test' run { enableAssertions = true -} +} \ No newline at end of file diff --git a/src/main/java/seedu/address/ui/AppointmentCard.java b/src/main/java/seedu/address/ui/AppointmentCard.java index fd462f7e85f..bf6251f8e90 100644 --- a/src/main/java/seedu/address/ui/AppointmentCard.java +++ b/src/main/java/seedu/address/ui/AppointmentCard.java @@ -14,7 +14,7 @@ public class AppointmentCard extends UiPart { private static final String FXML = "AppointmentListCard.fxml"; - public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); /** * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. From c7e2b7885f2d34ff7df3d06722b5e1b5a35144fa Mon Sep 17 00:00:00 2001 From: Mohammed-Faizzzz <110959467+Mohammed-Faizzzz@users.noreply.github.com> Date: Fri, 3 Nov 2023 07:37:37 +0800 Subject: [PATCH 03/10] Resolve checkstyle issues --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2ab2e09afbc..5cd2de53441 100644 --- a/build.gradle +++ b/build.gradle @@ -73,4 +73,4 @@ defaultTasks 'clean', 'test' run { enableAssertions = true -} \ No newline at end of file +} From e614bad9cdd5ab10cef03532835f98168b45c531 Mon Sep 17 00:00:00 2001 From: Mohammed-Faizzzz <110959467+Mohammed-Faizzzz@users.noreply.github.com> Date: Fri, 3 Nov 2023 08:23:42 +0800 Subject: [PATCH 04/10] Modify Doctor/Patient Card to remove display of Appointments --- src/main/java/seedu/address/ui/DoctorCard.java | 12 ------------ src/main/java/seedu/address/ui/PatientCard.java | 12 ------------ src/main/resources/view/DoctorListCard.fxml | 1 - src/main/resources/view/DoctorListPanel.fxml | 2 +- src/main/resources/view/PatientListCard.fxml | 1 - 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/main/java/seedu/address/ui/DoctorCard.java b/src/main/java/seedu/address/ui/DoctorCard.java index 03bb12a041b..f876a7e479f 100644 --- a/src/main/java/seedu/address/ui/DoctorCard.java +++ b/src/main/java/seedu/address/ui/DoctorCard.java @@ -7,7 +7,6 @@ import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; -import seedu.address.model.appointment.Appointment; import seedu.address.model.person.Doctor; @@ -42,8 +41,6 @@ public class DoctorCard extends UiPart { @FXML private FlowPane tags; @FXML - private FlowPane appointments; - @FXML private Label remark; @FXML private Label gender; @@ -67,14 +64,5 @@ public DoctorCard(Doctor doctor, int displayedIndex) { doctor.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); - doctor.getAppointments().stream() - .sorted(Comparator.comparing(Appointment::getAppointmentTime)) - .forEach(appointment -> { - Label appointmentLabel = new Label("Appointment with Patient: " + appointment.getPatient() + " at " - + appointment.getAppointmentTime().format(Appointment.FORMATTER)); - appointmentLabel.setWrapText(true); // Enable text wrapping - appointmentLabel.setPrefWidth(250); // Set the maximum width for text wrapping (adjust as needed) - appointments.getChildren().add(appointmentLabel); - }); } } diff --git a/src/main/java/seedu/address/ui/PatientCard.java b/src/main/java/seedu/address/ui/PatientCard.java index 7c87d3c6a23..7309c387bcc 100644 --- a/src/main/java/seedu/address/ui/PatientCard.java +++ b/src/main/java/seedu/address/ui/PatientCard.java @@ -7,7 +7,6 @@ import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; -import seedu.address.model.appointment.Appointment; import seedu.address.model.person.Patient; /** @@ -42,8 +41,6 @@ public class PatientCard extends UiPart { @FXML private FlowPane tags; @FXML - private FlowPane appointments; - @FXML private Label remark; @FXML private Label gender; @@ -73,15 +70,6 @@ public PatientCard(Patient person, int displayedIndex) { person.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); - person.getAppointments().stream() - .sorted(Comparator.comparing(Appointment::getAppointmentTime)) - .forEach(appointment -> { - Label appointmentLabel = new Label("Appointment with Doctor: " + appointment.getDoctor() + " at " - + appointment.getAppointmentTime().format(Appointment.FORMATTER)); - appointmentLabel.setWrapText(true); // Enable text wrapping - appointmentLabel.setPrefWidth(250); // Set the maximum width for text wrapping (adjust as needed) - appointments.getChildren().add(appointmentLabel); - }); condition.setText("Condition: " + person.getCondition().value); bloodType.setText("Blood Type: " + person.getBloodType().value); emergencyContact.setText("Emergency Contact: " + person.getEmergencyContact().value); diff --git a/src/main/resources/view/DoctorListCard.fxml b/src/main/resources/view/DoctorListCard.fxml index b83aab28c2c..8c6484818e0 100644 --- a/src/main/resources/view/DoctorListCard.fxml +++ b/src/main/resources/view/DoctorListCard.fxml @@ -33,7 +33,6 @@