diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index 3212775f87..0ac3e36236 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -6,11 +6,12 @@ layout: default
---
## Introduction
-BookBob is a desktop application tailored for Dr Bob's private General Practitioner clinic. It facilitates the storage
-and retrieval of patient information, including names, NRICs, genders, dates of birth, phone numbers, home addresses,
-allergies, medical histories and visit records with details on diagnoses and prescribed medications. BookBob also helps
-Dr Bob stay organised by tracking daily appointments and providing reminders each morning. Optimised for a Command Line
-Interface (CLI), BookBob allows for efficient management of patient information and appointments.
+BookBob is a desktop application tailored for Dr Bob's private General Practitioner clinic. BookBob helps
+streamline clinic management by storing and retrieving patient information, including names, NRICs, genders, dates of
+birth, phone numbers, home addresses, allergies, medical histories and detailed visit records with diagnoses and
+prescribed medications. BookBob also assists Dr Bob in staying organised by tracking daily appointments and sending
+reminders each morning. Optimised for a Command Line Interface (CLI), BookBob enables efficient management of patient
+information and appointment scheduling.
---
## Table of Contents
@@ -48,10 +49,11 @@ The following output would be shown :`Welcome to BookBob, Dr. Bob!`
**Note:**
-1. Exact Input Required with No Extra Spaces or Inputs: Any extra inputs or spaces after the expected commands will be treated as unknown commands.
-2. Case Sensitivity for Commands : Commands are case-sensitive. Ensure correct lowercase for commands e.g. `list` instead of `LIST`,
+1. Extra Input After Commands: Additional input provided after expected inputs for commands such as `list`, `listAppointments`, `help` and `exit` will be treated as unknown commands.
+2. Extra Spaces After Commands: Additional spaces after expected inputs for commands such as `list`, `listAppointments`, `help` and `exit` will be ignored.
+3. Case Sensitivity for Commands: Commands are case-sensitive. Ensure correct lowercase for commands e.g. `list` instead of `LIST`,
and mixed-case for e.g. `addVisit` instead of `addvisit`
-3. Case Sensitivity for Commands Prefixes : Command Prefixes are case-sensitive. Ensure correct lowercase for commands prefixes E.g. "n/", "ic/", instead of
+4. Case Sensitivity for Commands Prefixes: Command Prefixes are case-sensitive. Ensure correct lowercase for commands prefixes E.g. "n/", "ic/", instead of
"N/", "IC/"
## Viewing Help
@@ -172,11 +174,11 @@ The examples above result in successful patient record additions, which are then
💡 Best Practices of using "add" command together with "addVisit" command :
-1.) When a new patient visits the clinic, we use "add" command.
+1.) When a new patient visits the clinic, we use "add" command.
The "add" command is primarily used for adding a patient record with the patient's basic key details information (such as Name , NRIC , Phone Number), and that Name, NRIC, Patient's First Visit Date, are Compulsory fields.
Other Optional fields includes e.g. Phone Number, Home Address, DOB, and Diagnoses and Medications from patient's first visit.
-2.) If the same patient(with same NRIC) comes back to the clinic for a new visit, we use "addVisit" command,
+2.) If the same patient(with same NRIC) comes back to the clinic for a new visit, we use "addVisit" command,
to key in the visit Date&Time of this new visit event(which is a compulsory field along with NRIC), AND the Diagnoses of illnesses and Medications prescribed for this new visit event (which are optional fields).
3.) We then use "list" command to see all patient information.
@@ -389,7 +391,7 @@ No patient visit record found with NRIC: S7209876Y
By diagnosis:
Format: findDiagnosis diagnosis
Note :
-• Single diagnosis to be entered. All corresponding patients' information and visit records will be printed to terminal,
+• Single diagnosis to be entered (case-insensitive). All corresponding patients' information and visit records will be printed to terminal,
with exactly matched diagnosis.
Example: `findDiagnosis Runny Nose`
@@ -412,7 +414,7 @@ No patient found with symptom: Runny Nose
By Medication:
Format: findMedication medication
Note :
-• Single diagnosis to be entered. All corresponding patients' information and visit records will be printed to terminal,
+• Single medication to be entered (case-insensitive). All corresponding patients' information and visit records will be printed to terminal,
with exactly matched medication.
Example: `findMedication Panadol`
@@ -463,8 +465,8 @@ Format: appointment ic/NRIC date/DATE time/TIME \
Note: Deleting a Patient Appointment is case-insensitive.
#### Extra Information
-Date format is in DD-MM-YYYY and Time format is in HH:mm\
-The nric is case-insensitive
+Date format is in DD-MM-YYYY and time format is in HH:mm\
+The NRIC is case-insensitive
Example: `deleteAppointment ic/S1234567A date/18-11-2024 time/18:00`
```
@@ -488,7 +490,7 @@ Appointment on 18-11-2024 18:00 with Patient Will Smith, S7654321A.
---
## Finding a Patient Appointment
-Find an appointment with a patient based on the given name, nric, date or time\
+Find an appointment with a patient based on the given name, NRIC, date or time\
Format:
findAppointment n/NAME OR\
findAppointment ic/NRIC OR\
@@ -497,7 +499,7 @@ findAppointment time/TIME
#### Extra Information:
Date format is in DD-MM-YYYY and Time format is in HH:mm
-The name and nric are case-insensitive
+The name and NRIC are case-insensitive
Example: `findAppointment n/John`
```
diff --git a/logs/logs.log.lck b/logs/logs.log.lck
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/src/main/java/bookbob/Main.java b/src/main/java/bookbob/Main.java
index 61316bfb30..dccc6d0906 100644
--- a/src/main/java/bookbob/Main.java
+++ b/src/main/java/bookbob/Main.java
@@ -61,7 +61,7 @@ public static void main(String[] args) throws IOException {
System.out.println("Please check data file or delete it to start afresh");
System.out.println("Exiting");
System.exit(0);
- }catch (Exception e) {
+ } catch (Exception e) {
logger.log(Level.SEVERE, "Error during initialization: " + e.getMessage(), e);
System.out.println("Error initializing program. Please check data files.");
System.exit(0);
diff --git a/src/main/java/bookbob/functions/CommandHandler.java b/src/main/java/bookbob/functions/CommandHandler.java
index 767709b270..ea07dda367 100644
--- a/src/main/java/bookbob/functions/CommandHandler.java
+++ b/src/main/java/bookbob/functions/CommandHandler.java
@@ -651,6 +651,7 @@ public void findVisitByIc(String nric, Records records) {
if (patient.getNric().equals(nric)) {
ArrayList visits = patient.getVisits();
isFound = true;
+ System.out.println("Patient name: " + patient.getName());
for (Visit visit : visits) {
System.out.println(visit.toString());
diff --git a/src/main/java/bookbob/parser/Parser.java b/src/main/java/bookbob/parser/Parser.java
index b3d152a7c5..749fa96182 100644
--- a/src/main/java/bookbob/parser/Parser.java
+++ b/src/main/java/bookbob/parser/Parser.java
@@ -32,8 +32,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
switch (command) {
case "help":
if (inputArray.length > 1) {
- System.out.println("Unknown command. Type 'help' for a list of commands.");
- logger.log(Level.INFO, "Unknown command received: {0}", command);
+ printUnknownCommand(command);
break;
}
logAndExecute("help", commandHandler::help);
@@ -59,7 +58,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
throw new RuntimeException(e);
}
} else {
- System.out.println("Please specify an NRIC to delete.");
+ System.out.println("Please specify a NRIC to delete.");
logger.log(Level.INFO, "Empty NRIC inputted for delete command");
}
});
@@ -67,8 +66,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
case "list":
if (inputArray.length > 1) {
- System.out.println("Unknown command. Type 'help' for a list of commands.");
- logger.log(Level.INFO, "Unknown command received: {0}", command);
+ printUnknownCommand(command);
break;
}
logAndExecute("list", () -> commandHandler.list(records));
@@ -123,8 +121,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
case "listAppointments":
if (inputArray.length > 1) {
- System.out.println("Unknown command. Type 'help' for a list of commands.");
- logger.log(Level.INFO, "Unknown command received: {0}", command);
+ printUnknownCommand(command);
break;
}
logAndExecute("listAppointments", () -> commandHandler.listAppointments(appointmentRecord));
@@ -154,7 +151,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
if (inputArray.length > 1) {
logAndExecute("findVisit", () -> commandHandler.findVisitByIc(inputArray[1], records));
} else {
- System.out.println("Please provide NRIC for findVisit.");
+ System.out.println("Please provide a NRIC for findVisit.");
logger.log(Level.INFO, "Missing NRIC for findVisit");
}
break;
@@ -163,7 +160,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
if (inputArray.length > 1) {
logAndExecute("findMedication", () -> commandHandler.findVisitByMedication(inputArray[1], records));
} else {
- System.out.println("Please provide medication for findMedication.");
+ System.out.println("Please provide a medication for findMedication.");
logger.log(Level.INFO, "Missing medication for findMedication");
}
break;
@@ -172,15 +169,14 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
if (inputArray.length > 1) {
logAndExecute("findDiagnosis", () -> commandHandler.findVisitByDiagnosis(inputArray[1], records));
} else {
- System.out.println("Please provide diagnosis for findDiagnosis.");
+ System.out.println("Please provide a diagnosis for findDiagnosis.");
logger.log(Level.INFO, "Missing diagnosis for findDiagnosis");
}
break;
case "exit":
if (inputArray.length > 1) {
- System.out.println("Unknown command. Type 'help' for a list of commands.");
- logger.log(Level.INFO, "Unknown command received: {0}", command);
+ printUnknownCommand(command);
break;
}
logAndExecute("exit", () -> {
@@ -194,8 +190,7 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
break;
default:
- System.out.println("Unknown command. Type 'help' for a list of commands.");
- logger.log(Level.INFO, "Unknown command received: {0}", command);
+ printUnknownCommand(command);
break;
}
return true;
@@ -206,6 +201,11 @@ public static boolean handleCommand(String input, CommandHandler commandHandler,
}
}
+ private static void printUnknownCommand(String command) {
+ System.out.println("Unknown command. Type 'help' for a list of commands.");
+ logger.log(Level.INFO, "Unknown command received: {0}", command);
+ }
+
private static void logAndExecute(String commandName, Runnable action) {
logger.log(Level.INFO, "Processing {0} command", commandName);
try {