Figure 1: High Level UML Diagram of Sniff Appointment Manager
Figure 2: Sequence Diagram for .run() method of Sniff Appointment Manager
UI class
named Ui
belongs to the package functionalities.ui. The class contains several static and non-static methods that display messages to the user such as showUserMessage()
, showErrorMessage()
, and showWelcomeMessage()
. The class is also used to read user input, format and print appointment lists, and add or remove appointments from the sniff appointment manager
. The Ui
class has a showLine()
method that displays a divider line to the user.UI class
has a private static final String DOT_THEN_SPACE field that is used as a constant string value to format user messages. It has a readUserCommand()
method that returns a string value that is entered by the user through the Command Line Interface (CLI).SniffException
class from the exception package and utilizes it in the showErrorMessage()
method to display an error message to the user.Command class
named Command
belongs to the package functionalities.commands. The class is an abstract class that provides a basic template for implementing commands in the command-line interface. This class is designed to be extended by subclasses that implement specific commands, such as ListCommand
and ConsultationCommand
.Command class
has a boolean isExit field that can be set to true to exit the entire programme, or remain as false to continue running the programme. It has a isExit()
method that sets that field to false initially. It also has a executeCommand()
method that takes an instance of SniffTasks as a parameter and throws a SniffException if an error occurs during execution. Subclasses override this method in order to run other commands.
Figure 3: Sequence Diagram showing the logical implementation of executeCommand() for the EditConsultation Command
Figure 4: Sequence Diagram showing the logical implementation of executeCommand() for the EditVaccination Command
Figure 5: Sequence Diagram showing the logical implementation of executeCommand() for the EditSurgery Command
UI
class reads in the input from the user and then parses them depending on the starting initial of UID in the Parser
for each appointment.Remove Command
and then AppointmentCommand
is created and then executed, otherwise an exception is thrown.Snifftasks
class then edits the appointment to the list of current appointments.#### Editing AppointmentsUI
class reads in the input from the user and then parses them depending on the starting initial of UID in the Parser
for each appointment.Remove Command
and then AppointmentCommand
is created and then executed, otherwise an exception is thrown.Snifftasks
class then edits the appointment to the list of current appointments.ConsultationCommand
, VaccinationCommand
, SurgeryCommand
, FindCommand
, RemoveCommand
, ListCommand
, and ExitCommand
.parse()
method takes a user command as a String named task
and determines the type of command based on the first word of the command. If it matches any of the known command types, it delegates parsing to the corresponding parse method.SniffException
. Each parse method takes the command String as input and uses substring operations to extract the various parameters of the command. It then creates a new Command object with these parameters and assigns it to the “command” static variable.SniffException
.
Figure 7.1: Sequence Diagram of Storage class
Figure 7.2: Sequence Diagram of Storage class
openFile(String filePath)
method reads and adds the SniffAppointments contents into the Appointments task list.saveAppointments(String filePath)
method saves the Archived task contents into the SniffArchive File.extractData
method parses the saved file and identify stored appointments. Depending on the type of appointments, it will then call either readConsultationintoAppointmentList()
/ readVaccinationintoAppointmentList()
/ readSurgeryintoAppointmentList()
to add these appointment objects into ArrayList<Appointment> APPOINTMENTS
.SniffException
is thrown.SniffAppointments.txt
file using the saveAppointments
method.
Figure 8.1: Sequence Diagram of Archive Class
Figure 8.2: Sequence Diagram of Archive Class
openArchiveFile(String filePath)
method reads and adds the Archived task contents into the Appointments task list.saveArchivedAppointments(String filePath)
method saves the Archived task contents into the SniffArchive File.extractArchiveData(File archiveFile)
method parses the saved file and identify stored appointments. Depending on the type of appointments, it will then call either addConsult(String content)
/ addVaccine(String content)
/ addSurgery(String content)
to add these appointment objects into ArrayList<Appointment> APPOINTMENTS
.SniffException
is thrown.SniffArchive.txt
file using the saveArchivedAppointments
method.
Figure 9: Sequence Diagram showing the logical implementation of executeCommand() for the Find Command
Appointment ID
, Appointments Type
, Animal Type
, Date of Appointment
.SniffException
is thrown.findAppointment
loops through arraylist appointments and checks if matching appointment ID is present.toString
and formatPrintList
to print out appointments to user.SniffException
, is thrown for both cases.showUserMessage
is called.findAnimal
loops through arraylist appointments and checks if appointments for specified animal type is present.toString
and formatPrintList
to print out appointments to user.showUserMessage
is called.findType
loops through arraylist appointments and checks if specified appointment type (surgery, consultation, vaccination) is present.toString
and formatPrintList
to print out appointments to user.showUserMessage
is called.findDate
loops through arraylist appointments and checks if any appointment is present for the given date.toString
and formatPrintList
to print out appointments to user.showUserMessage
is called.mark
loops through arraylist appointments and checks if ID is present and finds the appointment index.isDone
and sets the value to true and showUserMessage
is called.showUserMessage
is called.unmark
loops through arraylist appointments and checks if ID is present and finds the appointment index.isDone
and sets the value to false and showUserMessage
is called.showUserMessage
is called.Appointment class
named Appointment
takes in input such as uid, name, type of appointment, animal type, and date of appointment. This appointment will then be added to the list.
Figure 10: Generic Sequence Diagram for adding an appointment
UI
class reads in the input from the user and then parses all the inputs in the Parser
for each appointment.AppointmentCommand
is created and then executed, otherwise an exception is thrown.Snifftasks
class then adds the appointment to the list of current appointments.The UID is generated to produce a 10 character string representing the Appointment ID tagged to each appointment. The UID string generated consists of 3 substrings that are concatenated together:
Surgery
will be denoted as "S"
.Random
class. An example of this substring
will be "01234567"
.Random
class.StringBuilder
class. The StringBuilder
class provides
a faster way to concatenate strings as compared to using the +
operator. C82739812B
V71829748S
S23847989T
Other alternatives that was considered are:
Apart from only each appointment in the appointment list, it also sorts the list by date and time in ascending order.
This is done using the inbuilt .sort()
function, while a custom comparator class named DateTimeComparator
is made to
for comparison between dates and times of appointments of different types. Currently DateTimeComparator
only supports
the existing appointment classes, namely: Consultation
, Vaccination
and Surgery
.
The implementation of the remove
feature is similar to mark
and unmark
. The difference is that the remove
feature
will remove the appointment from the ArrayList
that it is store in.
Veterinarians in Vet Clinics around Singapore who
Veterinary Clinics have a large number of appointments for the veterinarians and their admin staff to handle.
Sniff is an appointment manager that helps clinics keep track of their appointments. This eases the workload of the clinic staff and helps improve efficiency in running a Vet clinic, while reducing human errors occurring in the workplace.
Version | As a … | I want to … | So that I can … |
---|---|---|---|
v1.0 | new user | add new appointments | |
v1.0 | user | remove appointments | update the list with latest appointments |
v1.0 | user | find appointments | view a specific existing appointment |
v1.0 | user | list appointments | view all existing appointments |
v1.0 | user | categorize appointments by appointment type | manage efficiently |
v2.0 | user | mark appointments | differentiate between completed and pending appointments |
v2.0 | user | unmark appointments | retrieve appointments marked accidently |
v2.0 | user | track appointment dates | prioritize the upcoming appointments |
v2.0 | user | track locations | inform the doctor |
v2.1 | user | view all appointments by date | look at upcoming appointments for the clinic |
v2.1 | user | edit the existing appointment | to make edits to the existing appointment |
e.g. consultation, list
etc/
. e.g. at/, cd/
Given below are the instructions to test Sniff manually
Sniff.jar
herejava -jar sniff.jar
______________________________________________________________________
Hello! I'm Sniff, your personal appointment manager.
_______. .__ __. __ _______ _______
/ | | \ | | | | | ____| | ____|
| (----` | \| | | | | |__ | |__
\ \ | . ` | | | | __| | __|
.----) | | |\ | | | | | | |
|_______/ |__| \__| |__| |__| |__|
What can I do for you?
______________________________________________________________________
consultation
, vaccination
, surgery
.at/
.an/
.on/
.cn/
.cd
, vd
, sd
, ed
, in the format of YYYY-MM-DD.ct
, vt
, st
, et
, in the format of HH:MM.v/
.p/
, in the format of H, M, or L.consultation at/Cat an/Lulu on/Jon cn/91919191 cd/2023-12-12 ct/19:00
______________________________________________________________________
This appointment has been added to your appointment manager:
Consultation [ ]
Date: 2023-12-12
Time: 19:00
UID: C28216660A
Animal Name: Lulu | Animal Type: Cat
Owner Name: Jon | Contact Number: 91919191
Consultation added successfully!
______________________________________________________________________
Test case: consultation at/an/Lulu on/Jon cn/91919191 cd/2023-12-12 ct/19:00
Expected output: A consultation appointment is not added due to invalid description.
Example:
______________________________________________________________________
Sorry, an error was encountered! Here is the error description:
Animal Type cannot be empty!
______________________________________________________________________
Test case: vaccination at/Dog an/Russ on/Abel cn/92929292 v/Covid vd/2023-12-12 vt/19:00
Expected output: A vaccination appointment has been added successfully, details show in the status message.
Example:
______________________________________________________________________
This appointment has been added to your appointment manager:
Vaccination [ ]
Date: 2023-12-12
Time: 19:00
UID: V57416751U
Vaccine: Covid
Animal Name: Russ | Animal Type: Dog
Owner Name: Abel | Contact Number: 92929292
Vaccination added successfully!
______________________________________________________________________
Test case: vaccination at/Dog an/Russ on/Abel cn/92929292 v/Covid vd/12-12-2023 vt/19:00
Expected output: A vaccination appointment is not added due to invalid date description.
Example:
______________________________________________________________________
Sorry, an error was encountered! Here is the error description:
The date/time description is invalid.
______________________________________________________________________
Test case: surgery at/Hamster an/Polly on/Sam cn/93939393 sd/2023-12-12 st/19:00 ed/2023-12-12 et/20:00 p/H
Expected output: A surgery appointment has been added successfully, details shown in the status message.
Example:
______________________________________________________________________
This appointment has been added to your appointment manager:
Surgery [ ] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Polly | Animal Type: Hamster
Owner Name: Sam | Contact Number: 93939393
Surgery added successfully!
______________________________________________________________________
Test case: surgery at/Hamster an/Polly on/Sam cn/93939393 sd/2023-12-12 st/19:00 ed/2023-12-12 et/19:00 p/H
Expected output: A surgery appointment is not added due to dates and times being the same.
Example:
______________________________________________________________________
Sorry, an error was encountered! Here is the error description:
The start time cannot be the same as the end time!
______________________________________________________________________
list
______________________________________________________________________
1. Consultation [ ]
Date: 2023-12-12
Time: 19:00
UID: C28216660A
Animal Name: Lulu | Animal Type: Cat
Owner Name: Jon | Contact Number: 91919191
2. Vaccination [ ]
Date: 2023-12-12
Time: 19:00
UID: V57416751U
Vaccine: Covid
Animal Name: Russ | Animal Type: Dog
Owner Name: Abel | Contact Number: 92929292
3. Surgery [ ] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Polly | Animal Type: Hamster
Owner Name: Sam | Contact Number: 93939393
______________________________________________________________________
archive
______________________________________________________________________
1. Consultation [X]
Date: 2023-12-12
Time: 19:00
UID: C28216660A
Animal Name: Lulu | Animal Type: Cat
Owner Name: Jon | Contact Number: 91919191
2. Vaccination [X]
Date: 2023-12-12
Time: 19:00
UID: V57416751U
Vaccine: Covid
Animal Name: Russ | Animal Type: Dog
Owner Name: Abel | Contact Number: 92929292
3. Surgery [X] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Polly | Animal Type: Hamster
Owner Name: Sam | Contact Number: 93939393
______________________________________________________________________
find a/Dog
______________________________________________________________________
1. Vaccination [ ]
Date: 2023-12-12
Time: 19:00
UID: V57416751U
Vaccine: Covid
Animal Name: Russ | Animal Type: Dog
Owner Name: Abel | Contact Number: 92929292
______________________________________________________________________
Test case: find t/surgery
Expected output: A list of all previously added appointments with the appointment type.
Example:
______________________________________________________________________
1. Surgery [ ] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Caramel | Animal Type: Mouse
Owner Name: Sam | Contact Number: 93939393
______________________________________________________________________
Test case: find d/2023-12-12
Expected output: A list of all previously added appointments with the specified date.
Example:
______________________________________________________________________
1. Vaccination [ ]
Date: 2023-12-12
Time: 19:00
UID: V57416751U
Vaccine: Covid
Animal Name: Russ | Animal Type: Dog
Owner Name: Abel | Contact Number: 92929292
2. Surgery [ ] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Caramel | Animal Type: Mouse
Owner Name: Sam | Contact Number: 93939393
3. Consultation [ ]
Date: 2023-12-12
Time: 19:00
UID: C40384411E
Animal Name: nono | Animal Type: dog
Owner Name: jon | Contact Number: 91919191
______________________________________________________________________
Test case: find uid/S02547136Q
Expected output: A list of all previously added appointment with the appointment uid.
Example:
______________________________________________________________________
1. Surgery [ ] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S02547136Q
Animal Name: lulu | Animal Type: dog
Owner Name: jon | Contact Number: 91919191
______________________________________________________________________
Test case: find d/2023-12-12
Expected output: A list of all previously added appointments with the same appointment date.
Example:
______________________________________________________________________
1. Vaccination [ ]
Date: 2023-12-12
Time: 19:00
UID: V17511055M
Vaccine: covid
Animal Name: lulu | Animal Type: cat
Owner Name: jon | Contact Number: 91919191
______________________________________________________________________
list
or find
to help you get the specific UID. remove uid/C28216660A
______________________________________________________________________
This appointment has been removed your appointment manager:
Consultation [ ]
Date: 2023-12-12
Time: 19:00
UID: C28216660A
Animal Name: Lulu | Animal Type: Cat
Owner Name: Jon | Contact Number: 91919191
Task removed successfully!
______________________________________________________________________
list
or find
to help you get the specific UID. mark uid/S82358005U
______________________________________________________________________
1. Surgery [X] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Polly | Animal Type: Hamster
Owner Name: Sam | Contact Number: 93939393
The appointment has been marked successfully
______________________________________________________________________
Test case: unmark uid/V12400172X
Expected output: If the appointment UID entered is valid and not already unmarked the corresponding appointment is unmarked on the list.
A corresponding successful Unmark message is displayed.
Example:
______________________________________________________________________
1. Surgery [ ] | Priority: HIGH
Start Date: 2023-12-12
End Date: 2023-12-12
Start Time: 19:00
End Time: 20:00
UID: S82358005U
Animal Name: Polly | Animal Type: Hamster
Owner Name: Sam | Contact Number: 93939393
The appointment has been unMarked successfully
______________________________________________________________________
list
or find
command.edit uid/C67345117A at/Mouse an/freddy on/muthu cn/91917777 cd/2023-12-12 ct/19:00
Example:
______________________________________________________________________
Consultation changed successfully!
______________________________________________________________________
Test case: edit uid/S03044138U at/Mouse an/Caramel on/Sam cn/93939393 sd/2023-12-12 st/19:00 ed/2023-12-12 et/20:00 p/H
Expected output : Editing consultation : Enter the edit command with uID/ of the appointment that you want to edit. If the
appointment exists then the appointment is changed. If it does not exist it gives an error message.
Example:
______________________________________________________________________
Surgery changed successfully!
______________________________________________________________________
Test case: edit uid/V01087221W at/Dog an/Russ on/Abel cn/92929292 v/Covid vd/2023-12-12 vt/19:00
Expected output : Editing consultation : Enter the edit command with uID/ of the appointment that you want to edit. If the
appointment exists then the appointment is changed. If it does not exist it gives an error message.
Example:
______________________________________________________________________
Vaccination changed successfully!
______________________________________________________________________
help
______________________________________________________________________
These are the following Sniff commands available:
Add consultation appointment:
consultation at/ANIMAL_TYPE an/ANIMAL_NAME on/OWNER_NAME cn/CONTACT_NUMBER cd/DATE ct/TIME
Add vaccination appointment:
vaccination at/ANIMAL_TYPE an/ANIMAL_NAME on/OWNER_NAME cn/CONTACT_NUMBER v/VACCINE_TYPE vd/DATE vt/TIME
Add surgery appointment:
surgery at/ANIMAL_TYPE an/ANIMAL_NAME on/OWNER_NAME cn/CONTACT_NUMBER sd/START_DATE st/START_TIME ed/END_DATE et/END_TIME p/PRIORITY_LEVEL
Listing all appointments:
list
Removing an appointment:
remove uid/UID
Finding an appointment by animal type, appointment type or uid:
find a/ANIMAL_TYPE
find t/APPOINTMENT_TYPE
find uid/UID
find d/DATE
Mark or UnMark an appointment:
mark uid/UID
unMark uid/UID
Editing an appointment:
edit uid/UID at/ANIMAL_TYPE an/ANIMAL_NAME on/OWNER_NAME cn/CONTACT_NUMBER cd/DATE ct/TIME
edit uid/UID at/ANIMAL_TYPE an/ANIMAL_NAME on/OWNER_NAME cn/CONTACT_NUMBER v/VACCINE_TYPE vd/DATEvt/TIME
edit uid/UID at/ANIMAL_TYPE an/ANIMAL_NAME on/OWNER_NAME cn/CONTACT_NUMBER sd/START_DATEst/START_TIME ed/END_DATE et/END_TIME p/PRIORITY_LEVEL
Archiving appointments:
archive
Exiting the program:
bye
Additional notes:
1. DATES and TIMES format are in (YYYY-MM-DD) and (HH:MM) respectively
2. PRIORITY_LEVEL format is in (L, M, H)
______________________________________________________________________