Developer Guide
Table of Contents
- 1. Acknowledgements
- 2. Introduction
- 3. Design
- 4. Implementation
- Appendix A: Product Scope
- Appendix B: User Stories
- Appendix C: Non-Functional Requirements
- Appendix D: Instructions for Manual Testing
1. Acknowledgements
- Referenced the SE-EDU AB3 Developer Guide
2. Introduction
MedBot is a Command Line Interface (CLI) application for head nurses to manage patients’ and medical staff’s personal information, and schedule appointments between them.
3. Design
3.1 Architecture
Given below is a quick overview of the main components of MedBot and how they interact with one another.
3.1.1 Main Components
The main class of MedBot is the MedBot
class. It is responsible for initialising the other core components of MedBot
at application startup and for handling the interactions between these components.
The 4 core components of MedBot are:
Ui
: Handles the UI of MedBot.Parser
: Parses user inputs and createsCommand
objects.Scheduler
: Holds data in memory and contains the methods to read and write to it.Storage
: Loads data from, and stores data to the hard disk.
In addition, the Command
class facilitates the execution of user instructions.
3.1.2 Component Interaction
Given below is a simplified sequence diagram of how the core components of MedBot interact with each other when the user
inputs the command delete 1
.
3.2 Ui Component
The Ui Component is responsible for reading user inputs and printing outputs to users.
Ui Class
The Ui Component is handled by the Ui
class. It handles the reading of user inputs and the printing of outputs.
It generates output messages through relying on the following classes.
PersonUi
: Generates output messages for patient- and staff-management commands.PatientUi
: InheritsPersonUi
to generate output messages for patient-management commands.StaffUi
: InheritsPersonUi
to generate output messages for staff-management commands.
SchedulerUi
: Generates output messages for scheduler commands.
How the Ui component works
Reading user inputs
When the user inputs a line of text into the terminal, terminated with a newline character, the line will be read by the
readInput()
method of the Ui
class which will return the String to be parsed by the Parser Component
Printing outputs
- After user input is parsed by
Parser
, depending on the currentviewType
, theUi
will call methods from differentUi
subclasses- When
viewType
isPATIENT_INFO
,PatientUi
methods are called. - When
viewType
isMEDICAL_STAFF_INFO
,StaffUi
methods are called. - When
viewType
isSCHEDULER
,SchedulerUi
methods are called.
- When
Given below is a sequence diagram of how the Ui
component works after the Parser
parses help delete
input given by a user.
3.3 Parser Component
The Parser Component is responsible for parsing the user input and returning the corresponding Command class object to be executed.
Given below is a partial class diagram to better illustrate the Parser Component:
How the Parser component works:
- After getting the user input, MedBot calls the
parseCommand(userInput)
method of theParser
class to parse the input. - Depending on the current MedBot view, the
Parser
class then calls theParseXYZCommand()
method of the view specific parserXYZCommandParser
(XYZ
is a placeholder for the current view, namelyPatient
,Staff
andScheduler
). - The
XYZCommandParser
then determines the type of command that the user input corresponds to and calls the correspondingparseABCCommand()
method which creates and returns the correspondingCommand
object (ABC
is a placeholder for the command type, e.g.AddPatient
,DeleteStaff
,ListAppointment
). - The methods in
ParserUtils
are used by theParser
andXYZCommandParser
classes to process some parts of the user input.
The sequence diagram below better illustrates the working process described above:
(User is trying to add a patient’s information in the PatientInfoView)
3.4 Scheduler Component
The Scheduler Component is responsible for the storage and modification of patient, staff and appointment information.
Here is a partial class diagram to better illustrate the Scheduler Component.
Scheduler Class
The Scheduler
class consists of 3 internal lists, patientList
, medicalStaffList
and schedulerAppointmentList
,
that store patient, staff and appointment information respectively. It has various public methods for the viewing and
modification of the information stored in the lists, and for the interfacing between the Scheduler and Storage
Components. A Scheduler
class object is instantiated upon MedBot startup.
How the Scheduler component works:
- When MedBot calls the
.execute(Scheduler, Ui)
method of aCommand
object, a corresponding method of theScheduler
object will be called. - This method will then view or modify the patient, staff or appointment information depending on the command.
For example:
- When the
.execute(Scheduler, Ui)
method of anAddStaffCommand
object is called, theaddStaff(Person)
method of theScheduler
object will be called. - The
addStaff(Person)
method will then add thePerson
to themedicalStaffList
3.5 Storage Component
The Storage Component is responsible for the persistent storage of the personal information of all patients and medical staff, and appointment details between the two parties.
Here is a partial class diagram to better illustrate the Storage Component:
StorageManager Class
The StorageManager
class performs the responsibilities of the Storage Component. It consists of a PatientStorage
, a
StaffStorage
and an AppointmentStorage
class object. The PatientStorage
, StaffStorage
and
AppointmentStorage
classes are subclasses of the Storage
class and are responsible for the storage of patient,
staff and appointment information respectively.
How the Storage component works:
Initialization
- When MedBot is launched,
MedBot
initializes aStorageManager
class object. MedBot
then calls theinitializeStorages()
method of theStorageManager
class object which initializes thePatientStorage
,StaffStorage
andAppointmentStorage
class objects.- These three
Storage
sub-classes will create aMedBotData
directory in the current working directory ifMedBotData
does not already exist. - Each of the three
Storage
classes will create their respective storage text files inMedBotData
if they do not exist.PatientStorage
will createpatient.txt
in `MedBotDataStaffStorage
will createstaff.txt
in `MedBotDataAppointmentStorage
will createappointment.txt
in `MedBotData
- If the storage files exist, the respective
Storage
sub-class will ignore it.
Loading data:
StorageManager
calls theloadStorage()
method of thePatientStorage
,StaffStorage
andAppointmentStorage
.- Each of the 3
Storage
sub-class objects then reads their corresponding storage files and stores the information in memory into the corresponding lists ofMedBot
. - If there are errors in any of the storage files, an error message will be output to inform the user of the specific line and file which has erroneous data
Saving data:
- After a command is executed,
MedBot
calls thesaveToStorage()
method of theStorageManager
class object. StorageManager
then calls thesaveData()
method of thePatientStorage
,StaffStorage
andAppointmentStorage
objects.- Each of the 3
Storage
sub-class objects then writes the storage data into their respective data text files.
Format of stored data for patients and medical staff
The storage files patient.txt
and staff.txt
follow the same storage format when storing data. Each line of these
two storage files corresponds to the personal information of a patient or medical staff respectively:
Format:
ID | NRIC | NAME | PHONE_NUMBER | EMAIL | ADDRESS | HIDE_STATUS
Example:
3 | S8367812K | Sasha Alexander | 91238765 | X | Mauville City 2nd Street | S
Notes:
X
denotes that the field is emptyHIDE_STATUS
refers to whether the patient/staff is to be shown or hiddenS
means to “show”H
means to “hide”
Format of stored data for appointments
Each line of appointment.txt
corresponds to the details of an appointment.
Format:
ID | DATE_TIME | PATIENT_ID | STAFF_ID
Example:
7 | 051221 0900 | 2 | 2
3.6 Command Class
The Command
class and its subclasses are responsible for handling the execution of user instructions.
Each Command
subclass contains:
- An
isExit()
method which return true only if it is anExit Command
. - An
execute(Scheduler, Ui)
method which performs the specified user instruction and prints the output message to the user.
Some Command
subclasses also contain attributes specific to that subclass.
- E.g., the
deletePatientCommand
contains apersonId
attribute that specifies the ID of the patient that is to be deleted from MedBot.
There are 3 categories of commands:
- General Commands for MedBot navigation and accessing help.
- Person Commands which are divided into:
- Patient Commands for patient management in the Patient Management view.
- Staff Commands for staff management in the Staff Management view.
- Appointment Commands for appointment management in the Scheduler view.
Given below is the complete list of commands and their categories:
Command Name | Type |
---|---|
Help Command | General |
Switch Command | General |
Get View Command | General |
Exit Command | General |
Add Person Command | Person |
Delete Person Command | Person |
View Person Command | Person |
List Person Command | Person |
Edit Person Command | Person |
Find Person Command | Person |
Hide Person Command | Person |
Show Person Command | Person |
Add Appointment Command | Appointment |
Delete Appointment Command | Appointment |
View Appointment Command | Appointment |
List Appointment Command | Appointment |
Edit Appointment Command | Appointment |
Find Appointment Command | Appointment |
4. Implementation
This section describes some noteworthy details on how certain features are implemented.
4.1 Switch view feature
Implementation
The switch view mechanism is heavily linked to the Parser
class. By having a
ViewType
enumeration property in Parser
, the view of the console can be switched by executing the
appropriate SwitchCommand
class, which modifies the corresponding ViewType
of the Parser
. The 3 possible views and the corresponding user input commands are as follows:
switch p
orswitch 1
- switches to thePatient Management
view.switch m
orswitch 2
- switches to theStaff Management
view.switch s
orswitch 3
- switches to theScheduler
view.switch
- will switch to another view depending on the current view in the order shown below:
Patient Management
–> Staff Management
–> Scheduler
–> Patient Management
Each command calls the Parser.setViewType(ViewType)
method, which will set the corresponding
ViewType
property in the Parser
class. Additionally, the Ui.clearConsoleFromIde()
method will be evoked, which
performs a pseudo clear of the console before printing a message that indicates the user has switched view.
Design Considerations:
Aspect: How console is cleared:
- Alternative 1(Current Choice)
- Perform a pseudo-clear using multiple
System.lineSeparator()
to move the current console outputs upwards.- Pros: Easy to implement, system independent
- Cons: Only works for terminals up to a certain size (bigger terminals can still see previous console outputs)
- Perform an actual clear using the
ProcessBuilder
/Runtime
class in java.- Pros: Size of terminal doesn’t matter since it actually clears the console.
- Cons: More complex implementation, need to consider different sets of implementation for different OSes, does not work on IDE.
- Perform a pseudo-clear using multiple
4.2 Find feature
Functionality
This command will find a list of Person
that match the given attributes in a table format.
Implementation
The find
feature is facilitated by the FindPersonCommand
class. It extends from Command
class and overrides
the execute()
method to achieve the desired functionality.
The example below gives a direction on how this command behaves.
-
User executes the
find n/John
command. TheParser#parseCommand()
method will parse this command and eventually returns anew FindPatientCommand()
object. -
The
MedBot#interactWithUser()
method will run theexecute()
method in thenew FindPatientCommand()
object. -
The
execute()
method will callPersonList#findPersons()
method with the parametern/John
passed in. -
PersonList#findPersons()
will check all thepersons
list and returns allPerson
in the list whose name contains the stringjohn
. The attribute match is case-insensitive. -
The filtered
Person
list is then passed into theUi
class to be displayed into a table format throughUi#getFindPatientsMessage()
.
4.3 Edit feature
Functionality
This command will edit a specified Person
object with the attributes given in the command.
Implementation
The edit
feature is facilitated by the EditPersonCommand
class. It extends from Command
class and overrides
the execute()
method to achieve the desired functionality.
The example below gives a direction on how this command behaves.
-
User executes the
edit n/John
command when the attributeParser#viewType
isPATIENT_INFO
. TheParser#parseCommand()
method will parse this command and eventually returns anew EditPatientCommand()
object. -
The
MedBot#interactWithUser()
method will run theexecute()
method in thenew EditPatientCommand()
object. -
The
execute()
method will callPersonList#editPerson()
method with the newPerson
object having the parametern/John
passed in. (All other attributes of the object are set tonull
) -
PersonList#editPerson()
will attempt to replace all attributes of the oldPerson
object with the non-null attributes given in the newPerson
. -
The edited
Person
is then passed into theUi
class to be displayed throughUi#getEditPatientMessage()
.
4.4 Appointment management
Functionality
The appointment management feature is designed to allow head nurses to schedule appointments between medical staff and patients while ensuring that there are no appointment clashes for both staff and patients.
Below is a list of key design considerations for this feature:
- Upon adding/editing an appointment, MedBot will check if the new appointment clashes with an existing appointment and prevent such additions/edits.
- Users should be able to edit the date/time of appointments to reschedule appointments, or to fix mistakes.
- Users should also be able to change the staff involved in that appointment for cases where the original staff is not available, or to fix mistakes.
- Users should also be able to change the patient involved in that appointment to allow for the rearranging of appointments, or to fix mistakes.
- Users should be able to view a list of all appointments in the system.
- Users should be able to view a list of all appointments for a particular patient/staff.
Implementation
Appointment management is performed by the Scheduler
class and involves the storage and modification of Appointment
class objects. Appointments are managed on an hourly basis.
The Appointment
class is an association class between Patient
and Staff
, with additional appointmentId
and
dateTimeCode
attributes. It is stored in the SchedulerAppointmentList
class object in the Scheduler
class and in
PersonalAppointmentList
class objects in each Person
class object.
The SchedulerAppointmentList
object keeps track of all appointments in the system. This allows for the viewing of all
appointments in the system. The object consists of a HashMap
that stores Appointment
objects with their
appointmentId
as their key, this prevents the system having multiple Appointment
objects of the same
appointmentId
.
The PersonalAppointmentList
object in each Person
class object keeps track of the appointments of that person. This
allows for the viewing of all appointments of that person. The object consists of a TreeSet
that stores Appointment
objects with their dateTimeCode
as the comparable value. This prevents the system from adding clashing appointments to
a patient/staff and allows their appointments to be listed by their date.
Below is a simplified sequence diagram of the addAppointment(Appointment)
method in the Scheduler
class:
Appendix A: Product scope
Target user profile
Head nurses who are fast typists or prefer using a Command Line Interface (CLI) instead of a Graphical User Interface (GUI) for their daily jobs
Value proposition
- Easily manage patient and medical staff information.
- Easily schedule and manage appointments between patients and staff.
Appendix B: User Stories
Version | As a … | I want to … | So that I can … |
---|---|---|---|
v1.0 | new user | see usage instructions | refer to them when I forget how to use the application |
v1.0 | user | add a new patient’s information | track new patients admitted to the hospital |
v1.0 | user | remove a patient’s information | discharged patients will no longer be tracked by the system |
v1.0 | user | edit a patient’s information | rectify data entry errors or reflect changes in personal details |
v2.0 | user | add appointment timeslots for medical staff | easily administer their visiting hours |
v2.0 | user | be informed if there are any conflicting visiting timings for medical staff | reschedule to more appropriate timings. |
v2.0 | user | edit appointment timeslots for medical staff | account for changes in schedule of the medical staff |
v2.0 | user | see all available appointment timeslots for medical staff | know to not assign any conflicting timings |
v2.0 | user | filter appointments by date/time | decide how to assign new appointments more quickly |
Appendix C: Non-Functional Requirements
- Should work on Windows, Linux, or OS-X as long as it has
Java 11
or above installed. - A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.
- Should be able to hold up to a thousand appointments and patient/staff records without any noticeable decrease in performance.
Appendix D: Instructions for manual testing
Below are instructions to perform manual testing of the application. Please refer to the User Guide for more details on the usage of the various commands.
Launch and exit
- Launch
- Please follow the instructions in the Quick Start Guide to launch the application.
- Exit
- Enter
exit
to quit MedBot.
- Enter
Switching Views
- Switching between the different views of MedBot, in any view
- Test case:
switch
Expected: MedBot will switch to the next view. The views switch in this order, and loop back:
Patient Management
–>Staff Management
–>Scheduler
–>Patient Management
- Test case:
- Switching from other views to
Staff Management
view specifically-
Test case:
switch m
when inPatient Management
view orScheduler
view
Expected: MedBot will switch toStaff Management
view, and print:___ _____ _ ___ ___ / __|_ _/_\ | __| __| \__ \ | |/ _ \| _|| _| |___/_|_/_/_\_\_| |_| |_ _| \| | __/ _ \ | || .` | _| (_) | |___|_|\_|_|_\___/ __ \ \ / /_ _| __\ \ / / \ V / | || _| \ \/\/ / \_/ |___|___| \_/\_/ You are now in the Staff Management view.
-
- Switching view to the current view
- Test case:
switch 3
when in theScheduler
view
Expected: View remains the same, prints:You are already in the Scheduler view.
- Test case:
- Invalid switch commands
- Test case:
switch 100
,switch abc
, …
Expected: View remains the same, prints:Invalid view type code.
- Test case:
Get current view
- Get the current view type of MedBot
- Test case:
get view
when in theScheduler
view
Expected:You are currently in the Scheduler view.
- Test case:
Accessing user guide
- Using
help
in theScheduler
view- Test case:
help
inScheduler
view.
Expected:Here is the list of commands: help add delete edit view list find switch get view exit To view more information about each command and their respective command formats, type: help [COMMAND] *Note that all commands will remove any '|' inputs for format parsing purposes. For expected output examples, please refer to the actual user guide.
- Test case:
- Getting view specific help for a specific command
- Test case:
help add
inPatient Management
view
Expected:Adds a patient to the patient list. Format: add i/PATIENT_IC [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS]
- Test case:
- Invalid
help
usage- Test case:
help abc
in any view
Expected:Unable to parse command.
- Test case:
Patient/Medical Staff Information Commands
- The commands for
Patient Management
view andStaff Management
view are the same, but apply to patients and staff respectively.Patient Management
view examples will be used here, but feel free to test the same commands forStaff Management
view. - Note that the Patient ID/Staff ID generated is dependent on the existing patients/staff information in MedBot.
- The expected output of the test cases below assumes that the commands are executed in the order that they are presented in this guide.
Adding a patient
- Add a patient to the patient list with all details filled.
- Test case:
add i/S7812345X n/John Doe p/87654321 e/john.doe@gmail.com a/John Street, block 1234, #01-01
Expected:Added patient with Patient ID: 1 IC: S7812345X Name: John Doe H/P: 87654321 Email: john.doe@gmail.com Address: John Street, Block 1234, #01-01
- Test case:
- Add a patient to the patient list with some details filled.
- Test case:
add e/jimbob@hotmail.com n/jIm boB
Expected:Added patient with Patient ID: 2 IC: Name: Jim Bob H/P: Email: jimbob@hotmail.com Address:
- Test case
add n/Raven Darkholme i/S8912345A
Expected:Added patient with Patient ID: 3 IC: S8912345A Name: Raven Darkholme H/P: Email: Address:
- Test case:
- Add a patient using an invalid attribute specifier
- Test case (Invalid command):
add h/
Expected:"h/" is not a valid attribute specifier
- Test case (Invalid command):
- Add a patient with an NRIC that already exists in MedBot
- Test case (Invalid command):
add i/S7812345X
Expected:The patient with IC S7812345X is already in the record.
- Test case (Invalid command):
Delete a patient
- Delete an existing patient from the list.
- Test case:
delete 3
Expected:Patient with ID 3 deleted from system.
- Test case:
- Delete a non-existent patient from the list.
- Test case:
delete 4
Expected:No Patient with ID 4 found.
- Test case:
- Invalid usage of
delete
- Test case (Invalid command):
delete asd
Expected:ID not specified or not a positive number.
- Test case (Invalid command):
View a patient’s information
- View an existing patient’s information.
- Test case:
view 2
Expected:Here's the requested patient information: Patient ID: 2 IC: Name: Jim Bob H/P: Email: jimbob@hotmail.com Address:
- Test case:
- View a non-existent patient’s information.
- Test case:
view 89
Expected:No Patient with ID 89 found.
- Test case:
Hide a patient
- Refer to this to understand how
hide
affectslist
. - Feel free to test
hide
,show
andlist
together.
- Hide a patient in the list.
- Test case:
hide 2
Expected:The patient with ID 2 is now hidden.
- Test case:
hide 1
Expected:The patient with ID 1 is now hidden.
- Test case:
- Invalid usage of
hide
- Test case (Invalid command):
hide ab
Expected:ID not specified or not a positive number.
- Test case (Invalid command):
Show a patient
- Refer to this to understand how
show
affectslist
- Feel free to test
hide
,show
andlist
together.
- Show a previously hidden patient in the list.
- Test case:
show 1
Expected:The patient with ID 1 is now not hidden.
- Test case:
- Invalid usage of
show
- Test case:
show ab
Expected:ID not specified or not a positive number.
- Test case:
List information of all current patients
list
shows all non-hidden patients.list -h
shows all hidden patients.
- List all non-hidden patients
-
Test case:
list
Expected:Here is a list of all not-hidden patients: For full details of each patient, please use the command "view PATIENT_ID" ----------------------------------------------------------------------------------------------------- | ID | IC Number | Name | Phone No. | Email | Address | ----------------------------------------------------------------------------------------------------- | 1 | S7812345X | John Doe | 87654321 | john.doe@gmail.com | John Street, Bloc... | -----------------------------------------------------------------------------------------------------
-
- List all hidden patients
-
Test case:
list -h
Expected:Here is a list of all hidden patients: For full details of each patient, please use the command "view PATIENT_ID" ----------------------------------------------------------------------------------------------------- | ID | IC Number | Name | Phone No. | Email | Address | ----------------------------------------------------------------------------------------------------- | 2 | | Jim Bob | | jimbob@hotmail.com | | -----------------------------------------------------------------------------------------------------
-
- Invalid usage of
list
- Test case:
list -l
Expected:Parameter type specified is not valid.
- Test case:
Edit information of a patient
- Edit an existing patient’s personal information, selected by ID.
- Test case:
edit 1 p/99999999 n/John Xavier Doe
Expected:The information of patient with ID 1 has been edited to: Patient ID: 1 IC: S7812345X Name: John Xavier Doe H/P: 99999999 Email: john.doe@gmail.com Address: John Street, Block 1234, #01-01
- Test case:
- Edit a non-existent patient’s personal information
- Test case:
edit 898 n/BOb
Expected:No Patient with ID 898 found.
- Test case:
Find patients based on attributes
- Search for non-hidden patients with NRIC containing “12345”
- Test case:
find i/12345
Expected:Here is a list of matched patients: ----------------------------------------------------------------------------------------------------- | ID | IC Number | Name | Phone No. | Email | Address | ----------------------------------------------------------------------------------------------------- | 1 | S7812345X | John Xavier Doe | 99999999 | john.doe@gmail.com | John Street, Bloc... | -----------------------------------------------------------------------------------------------------
- Test case:
- Invalid usage of
find
- Test case:
find g/
Expected:The specifier g/ is invalid.
- Test case:
Scheduler Commands
Prerequisites
- Run the following commands before running the
Scheduler
commands to populate the patient and medical staff lists with more data:switch 1
add n/Sasha Alexander i/S8367812K p/91238765 a/Mauville City 2nd Street
switch 2
add n/Doctor One i/S8754321B p/81819191 a/American Gardens Building West 81st Street e/doctorone@hospital.net
add n/Nurse One i/S9171234D p/91234566 a/Petalburg City Route 103 e/nurseone@hospital.net
switch 3
Adding an appointment
- Adds an appointment to the scheduler list. MedBot will check if there are any clashes in the appointments and display and error message if there are any.
- The format for DATE_TIME is DDMMYY hhmm. I.e. 9 February 2021, 0800HRS should be written as 090221 0800
- Do note that the appointments are managed at an hourly basis. For example, any appointments set to any time between 0800HRS and 0859HRS will be treated as an appointment from 0800HRS to 0859HRS. No subsequent appointment can then be scheduled for either the patient and the medical staff during that window.
- Add a valid appointment with no clashes
- Test case:
add p/1 s/1 d/011221 0900
Expected:Added appointment with Appointment ID: 1 Patient ID: 1 Staff ID: 1 Date/Time: 01 Dec 21 0900HRS
- Test case:
add p/1 s/2 d/011221 1000
Expected:Added appointment with Appointment ID: 2 Patient ID: 1 Staff ID: 2 Date/Time: 01 Dec 21 1000HRS
- Test case:
- Valid appointment, but the time is corrected to the hour
- Test case:
add p/1 s/2 d/011221 1105
Expected:Added appointment with Appointment ID: 3 Patient ID: 2 Staff ID: 2 Date/Time: 01 Dec 21 1100HRS
- Test case:
- Adding a clashing appointment
- Test case (Invalid):
add p/2 s/1 d/011221 0900
Expected:Staff unavailable, appointment 1 at that time.
- Test case (Invalid):
- Adding an appointment with invalid date/time format
- Test case (Invalid):
add p/1 s/2 d/01122123
Expected:Incorrect Date/Time format.
- Test case (Invalid):
Delete an appointment
- Delete an existing appointment from the scheduler.
- Test case:
delete 2
Expected:Appointment with ID 2 deleted from system.
- Test case:
- Delete a non-existent appointment from the scheduler.
- Test case:
delete 89
Expected:No appointment with ID 89 found.
- Test case:
Editing an appointment’s information
- Edit an existing appointment’s information
- Test case:
edit 3 s/1
Expected:The information of appointment with ID 3 has been edited to: Patient ID: 2 Staff ID: 1 Date/Time: 01 Dec 21 1100HRS
- Test case:
- Edit an appointment to clash with another appointment
- Test case (Invalid):
edit 3 d/011221 0900
Expected:Staff unavailable, appointment 1 at that time.
- Test case (Invalid):
Viewing an appointment’s information
- View an existing appointment’s information
- Test case:
view 1
Expected:Here is the requested appointment information: Appointment Id: 1 Patient ID: 1 Staff ID: 1 Date/Time: 01 Dec 21 0900HRS
- Test case:
- View a non-existing appointment’s information
- Test case (Invalid):
view 9
Expected:No appointment with ID 9 found.
- Test case (Invalid):
Listing information of all appointments
- List the information of all appointments, including those of hidden patients and medical staff.
- Test case:
list
Expected:Here is a list of all appointments: -------------------------------------------------------------------------------------------------- | ID | Date/Time | Patient ID | Patient Name | Staff ID | Staff Name | -------------------------------------------------------------------------------------------------- | 1 | 01 Dec 21 0900HRS | 1 | John Xavier Doe | 1 | Doctor One | | 3 | 01 Dec 21 1100HRS | 2 | Jim Bob | 1 | Doctor One | --------------------------------------------------------------------------------------------------
- Test case:
Find appointments
- Prerequisites:
- Execute the following commands first to populate the
Scheduler
with more data:switch 3
switch 1
show 2
switch 2
show 2
switch 3
add p/1 s/2 d/021221 0900
add p/2 s/2 d/031221 0900
add p/3 s/2 d/041221 0900
add p/2 s/2 d/051221 0900
add p/3 s/2 d/061221 0900
- Execute the following commands first to populate the
- Find all appointments that involve a particular medical staff
- Test case:
find s/2
Expected:Here is a list of matched appointments: -------------------------------------------------------------------------------------------------- | ID | Date/Time | Patient ID | Patient Name | Staff ID | Staff Name | -------------------------------------------------------------------------------------------------- | 4 | 02 Dec 21 0900HRS | 1 | John Xavier Doe | 2 | Nurse One | | 5 | 03 Dec 21 0900HRS | 2 | Jim Bob | 2 | Nurse One | | 6 | 04 Dec 21 0900HRS | 3 | Sasha Alexander | 2 | Nurse One | | 7 | 05 Dec 21 0900HRS | 2 | Jim Bob | 2 | Nurse One | | 8 | 06 Dec 21 0900HRS | 3 | Sasha Alexander | 2 | Nurse One | --------------------------------------------------------------------------------------------------
- Test case:
- Find all appointments that involve a particular medical staff, after a certain date/time
- Test case:
find s/2 a/051221 0000
Expected:Here is a list of matched appointments: -------------------------------------------------------------------------------------------------- | ID | Date/Time | Patient ID | Patient Name | Staff ID | Staff Name | -------------------------------------------------------------------------------------------------- | 7 | 05 Dec 21 0900HRS | 2 | Jim Bob | 2 | Nurse One | | 8 | 06 Dec 21 0900HRS | 3 | Sasha Alexander | 2 | Nurse One | --------------------------------------------------------------------------------------------------
- Test case:
Saving data
- Persistent storage can be found in the
MedBotData
directory, in the same directory as the JAR file. - Inside MedBotData, there is
appointment.txt
,patient.txt
andstaff.txt
.
- Dealing with corrupted data files
- Loading from storage, an appointment with non-existent staff ID (staff ID 10)
- Test case: Replace the current contents in the text file
appointment.txt
to this:1 | 011221 0900 | 1 | 10 3 | 011221 1100 | 2 | 1
and then launch MedBot using the terminal.
Expected:Hello, I'm MedBot! Error: Line 1 of MedBotData/appointment.txt is invalid! Please decide if you wish to: 1. Enter 'exit' to exit MedBot to correct the storage files 2. Enter other valid commands to OVERWRITE all invalid data! How can I help you today?
- Do not enter any commands after this output. Close the terminal window and move on the next test case.
- Test case: Replace the current contents in the text file
- Loading from storage, patients with invalid phone number and invalid NRIC.
- Test case: Replace the current contents in the text file
patient.txt
to this:1 | S7812345X | John Xavier Doe | 899999999 | john.doe@gmail.com | John Street, Block 1234, #01-01 | S 2 | X | Jim Bob | X | jimbob@hotmail.com | X | H 3 | A8367812K | Sasha Alexander | 91238765 | X | Mauville City 2nd Street | S
Expected:
Hello, I'm MedBot! Error: Line 1 of MedBotData/patient.txt is invalid! Error: Line 3 of MedBotData/patient.txt is invalid! Error: Line 1 of MedBotData/appointment.txt is invalid! Please decide if you wish to: 1. Enter 'exit' to exit MedBot to correct the storage files 2. Enter other valid commands to OVERWRITE all invalid data! How can I help you today?
- Test case: Replace the current contents in the text file
- Loading from storage, an appointment with non-existent staff ID (staff ID 10)