By: Team W14-3
Since: Sept 2018
Licence: MIT
- 1. Setting up
- 2. Design
- 3. Implementation
- 4. Documentation
- 5. Testing
- 6. Dev Ops
- Appendix A: Product Scope
- Appendix B: User Stories
- Appendix C: Use Cases
- Appendix D: Non Functional Requirements
- Appendix E: Glossary
- Appendix F: Instructions for Manual Testing
- F.1. Launch and shutdown
- F.2. Generating test data
- F.3. Adding an appointment for a patient
- F.4. Adding dietary requirements for a patient
- F.5. Adding medication for a patient
- F.6. Adding a diagnosis to a patient’s medical record
- F.7. Changing the view
- F.8. Sorting the view
- F.9. Checking out a patient
- F.10. Checking in a patient
- F.11. Generating data
1. Setting up
1.1. Prerequisites
-
JDK
9
or laterJDK 10
on Windows will fail to run tests in headless mode due to a JavaFX bug. Windows developers are highly recommended to use JDK9
. -
IntelliJ IDE
IntelliJ by default has Gradle and JavaFx plugins installed.
Do not disable them. If you have disabled them, go toFile
>Settings
>Plugins
to re-enable them.
1.2. Setting up the project in your computer
-
Fork this repo, and clone the fork to your computer
-
Open IntelliJ (if you are not in the welcome screen, click
File
>Close Project
to close the existing project dialog first) -
Set up the correct JDK version for Gradle
-
Click
Configure
>Project Defaults
>Project Structure
-
Click
New…
and find the directory of the JDK
-
-
Click
Import Project
-
Locate the
build.gradle
file and select it. ClickOK
-
Click
Open as Project
-
Click
OK
to accept the default settings -
Open a console and run the command
gradlew processResources
(Mac/Linux:./gradlew processResources
). It should finish with theBUILD SUCCESSFUL
message.
This will generate all resources required by the application and tests. -
Open
XmlAdaptedPerson.java
andMainWindow.java
and check for any code errors-
Due to an ongoing issue with some of the newer versions of IntelliJ, code errors may be detected even if the project can be built and run successfully
-
To resolve this, place your cursor over any of the code section highlighted in red. Press ALT+ENTER, and select
Add '--add-modules=…' to module compiler options
for each error
-
-
Repeat this for the test folder as well (e.g. check
XmlUtilTest.java
andHelpWindowTest.java
for code errors, and if so, resolve it the same way)
1.3. Verifying the setup
-
Run the
seedu.address.MainApp
and try a few commands -
Run the tests to ensure they all pass.
1.4. Configurations to do before writing code
1.4.1. Configuring the coding style
This project follows oss-generic coding standards. IntelliJ’s default style is mostly compliant with ours but it uses a different import order from ours. To rectify,
-
Go to
File
>Settings…
(Windows/Linux), orIntelliJ IDEA
>Preferences…
(macOS) -
Select
Editor
>Code Style
>Java
-
Click on the
Imports
tab to set the order-
For
Class count to use import with '*'
andNames count to use static import with '*'
: Set to999
to prevent IntelliJ from contracting the import statements -
For
Import Layout
: The order isimport static all other imports
,import java.*
,import javax.*
,import org.*
,import com.*
,import all other imports
. Add a<blank line>
between eachimport
-
Optionally, you can follow the UsingCheckstyle.adoc document to configure Intellij to check style-compliance as you write code.
1.4.2. Updating documentation to match your fork
After forking the repo, the documentation will still have the SE-EDU branding and refer to the se-edu/AddressBook-level4
repo.
If you plan to develop this fork (separate product (i.e. instead of contributing to se-edu/AddressBook-level4
)) | you should do the following:
-
Configure the site-wide documentation settings in
build.gradle
, such as thesite-name
, to suit your own project. -
Replace the URL in the attribute
repoURL
inDeveloperGuide.adoc
andUserGuide.adoc
with the URL of your fork.
1.4.3. Setting up CI
Set up Travis to perform Continuous Integration (CI) for your fork. See UsingTravis.adoc to learn how to set it up.
After setting up Travis, you can optionally set up coverage reporting for your team fork (see UsingCoveralls.adoc).
Coverage reporting could be useful for a team repository that hosts the final version but it is not that useful for your patiental fork. |
Optionally, you can set up AppVeyor (second CI (see UsingAppVeyor.html).
Having both Travis and AppVeyor ensures your App works on both Unix-based platforms and Windows-based platforms (Travis is Unix-based and AppVeyor is Windows-based) |
1.4.4. Getting started with coding
When you are ready to start coding,
-
Get some sense of the overall design by reading Section 2.1, “Architecture”.
2. Design
2.1. Architecture
The Architecture Diagram given above explains the high-level design of the App. Given below is a quick overview of each component.
The .pptx files used to create diagrams in this document can be found in the diagrams folder. To update a diagram, modify the diagram in the pptx file, select the objects of the diagram, and choose Save as picture .
|
Main
has only one class called MainApp
. It is responsible for,
-
At app launch: Initializes the components in the correct sequence, and connects them up with each other.
-
At shut down: Shuts down the components and invokes cleanup method(s) where necessary.
Commons
represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.
-
EventsCenter
: This class (written using Google’s Event Bus library) is used by components to communicate with other components using events (i.e. a form of Event Driven design) -
LogsCenter
: Used by many classes to write log messages to the App’s log file.
The rest of the App consists of four components.
Each of the four components
-
Defines its API in an
interface
with the same name as the component. -
Exposes its functionality using a
{component Name}Manager
class.
For example, the Logic
component (see the class diagram given below) defines it’s API in the Logic.java
interface and exposes its functionality using the LogicManager.java
class.
Events-driven nature of the design
The Sequence Diagram below shows how the components interact for the scenario where the user issues the command delete 1
.
delete 1
command (part 1)
Note how the Model simply raises a HealthBaseChangedEvent when HealthBase data are changed, instead of asking the Storage to save the updates to the hard disk.
|
The diagram below shows how the EventsCenter
reacts to that event, which eventually results in the updates being saved to the hard disk and the status bar of the UI being updated to reflect the 'Last Updated' time.
delete 1
command (part 2)
Note how the event is propagated through the EventsCenter to the Storage and UI without Model having to be coupled to either of them. This is an example of how this Event Driven approach helps us reduce direct coupling between components.
|
The sections below give more details of each component.
2.2. UI component
API : Ui.java
The UI consists of a MainWindow
that is made up of parts e.g.CommandBox
, ResultDisplay
, patientListPanel
, StatusBarFooter
, MedicationView
, etc. All these, including the MainWindow
, inherit from the abstract UiPart
class.
The UI
component uses the JavaFX UI framework. The layout of these UI parts are defined in matching .fxml
files that are in the src/main/resources/view
folder. For example, the layout of the MainWindow
is specified in MainWindow.fxml
The UI
component does the following:
-
Executes user commands using the
Logic
component -
Binds itself to some data in the
Model
so that the UI can auto-update when data in theModel
changes -
Responds to events raised from various parts of the App and updates the UI accordingly
2.3. Logic component
API :
Logic.java
-
Logic
uses theHealthBaseParser
class to parse the user command. -
This results in a
Command
object which is executed by theLogicManager
. -
The command execution can affect the
Model
(e.g. adding a patient) and/or raise events. -
The result of the command execution is encapsulated as a
CommandResult
object which is passed back to theUI
.
Given below is the Sequence Diagram for interactions within the Logic
component for the execute("delete 1")
API call.
delete 1
Command2.4. Model component
API : Model.java
The Model
,
-
stores a
UserPref
object that represents the user’s preferences. -
stores HealthBase data.
-
exposes an unmodifiable
ObservableList<patient>
that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. -
does not depend on any of the other three components.
As a more OOP model, we can store a Tag list in HealthBase , which patient can reference. This would allow HealthBase to only require one Tag object per unique Tag , instead of each patient needing their own Tag object. An example of how such a model may look like is given below. |
2.5. Storage component
API : Storage.java
The Storage
component,
-
can save
UserPref
objects in json format and read it back. -
can save HealthBase data in xml format and read it back.
2.6. Common classes
Classes used by multiple components are in the seedu.addressbook.commons
package.
3. Implementation
This section describes some noteworthy details on how certain features are implemented.
3.1. Addappt
3.1.1. Current implementation
The addappt
command provides functionality for users to add an appointment for a given patient.
This is done by adding appointment-related information to a given person, represented by a Person
object.
This allows for users to track the upcoming appointments for every patient.
The adding of appointment-related information is facilitated by the following classes:
-
AppointmentsList
, a list of-
Appointment
, each of which have a-
Type
-
-
A more detailed description of the classes follows below:
-
AppointmentsList
-
Every
Person
has anAppointmentsList
, the purpose of which is to store allAppointment
s belonging to aPerson
. -
A wrapper class around the internal representation of a list of appointments that exposes only a few select methods in the
List
API.-
The methods relevant to the
addappt
command from the API are:add
.
-
-
-
Appointment
-
Class encapsulating all the information about a particular appointment.
-
These information include the type of appointment (enum Type), name of the procedure, date and time of the appointment and the name of the doctor-in-charge of the appointment
-
-
-
Type
-
An enumeration that covers all the different types of medical procedures. The four types are:
-
PROPAEDEUTIC
, withPROP
as abbreviation -
DIAGNOSTIC
, withDIAG
as abbreviation -
THERAPEUTIC
, withTHP
as abbreviation -
SURGICAL
, withSRG
as abbreviation
-
-
Given below is an example usage scenario and how the relevant classes behave at each step.
Activity and sequence diagrams are different ways to represent the execution of a command: The activity diagram provides a general view of the execution and The sequence diagram provides an intricate view of the execution Both diagrams have been included to better aid you through the execution of the addappt command.
|
The user executes addappt ic/S1234567A type/SRG pn/Heart Bypass dt/27-04-2019 10:30 doc/Dr. Pepper
.
This command has the following intent: Record the following appointment to a patient with NRIC = S1234567A:
Appt. type | Procedure name | Date and time | Doctor-in-charge |
---|---|---|---|
|
Heart Bypass |
27-04-2019 10:30 |
Dr. Pepper |
The following activity diagram shows the execution of the addappt
command:
addappt
commandThe following sequence diagram shows the execution of the addappt
command:
addappt
commandWith reference to the above figures, the following steps occur upon the execution of the addappt
command
(code snippets have been included for the first 4 steps to further aid understanding):
... @Override public CommandResult execute(String commandText) throws CommandException, ParseException { (1) logger.info("----------------[USER COMMAND][" + commandText + "]"); try { Command command = healthBaseParser.parseCommand(commandText); (2) return command.execute(model, history); } finally { history.add(commandText); } } ...
... public Command parseCommand(String userInput) throws ParseException { (2) final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim()); if (!matcher.matches()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE)); } final String commandWord = matcher.group("commandWord"); final String arguments = matcher.group("arguments"); switch (commandWord) { case RegisterCommand.COMMAND_WORD: return new RegisterCommandParser().parse(arguments); ... case AddApptCommand.COMMAND_WORD: return new AddApptCommandParser().parse(arguments); (3) ... } ...
... @Override public AddApptCommand parse(String args) throws ParseException { (3) ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NRIC, PREFIX_TYPE, PREFIX_PROCEDURE, PREFIX_DATE_TIME, PREFIX_DOCTOR); if (!arePrefixesPresent(argMultimap, PREFIX_NRIC, PREFIX_TYPE, PREFIX_PROCEDURE, PREFIX_DATE_TIME, PREFIX_DOCTOR) || !argMultimap.getPreamble().isEmpty()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddApptCommand.MESSAGE_USAGE)); } ... nric = new Nric(patientNric); appt = new Appointment(type, procedure, dateTime, doctor); return new AddApptCommand(nric, appt); (4) } ...
1 | The command is executed and passed to an instance of the LogicManager class, |
2 | which in turn executes HealthBaseParser::parseCommand . |
3 | The HealthBaseParser first parses the command word (addappt ), |
4 | then executes AddApptCommandParser::parse . |
5 | The AddApptCommandParser::parse method returns an AddApptCommand object which encapsulates the necessary information to update the Person 's Appointment (s).
Control is also passed back to the LogicManager . |
6 | Next, the instance of LogicManager calls AddApptCommand::execute . The AddApptCommand::execute method constructs a new Person object using all the details of the old Person with one exception: the
AppointmentsList is a copy of the original Person 's AppointmentsList with an added Appointment . |
7 | This is done by obtaining a Person object from the static method CommandUtil::getPatient |
8 | then adding the Appointment to the obtained Person . |
9 | This updated Person object is used to update the existing Person by using Model::updatePerson of the backing model. |
10 | Finally, the AddApptCommand::execute method terminates, returning a CommandResult with a success message. |
11 | The LogicManager returns the same CommandResult as the value of the LogicManager::execute method. |
12 | The command execution ends. |
If no/multiple patient(s) with that NRIC exist(s), then the AddApptCommand::execute method will throw a CommandException with the appropriate error message and the usage case will end.
|
For the sake of simplicity, some methods in AddApptCommand::execute are excluded from the diagram. These methods check for
the validity of the command and are not crucial in the sequence of events.
|
3.1.2. Design considerations
Aspect: Representation of types of medical procedures
-
Alternative 1 (Current implementation): Use an
Enum
forType
-
Pros: Makes for easier handling of incorrect values.
-
Cons: Requires more effort to filter and retrieve the different types.
-
-
Alternative 2: Have a switch case to handle the different types
-
Pros: Makes the process easier to handle.
-
Cons: Makes the code more difficult to read.
-
3.2. Adddiet
3.2.1. Current implementation
The adddiet
command provides functionality for users to add dietary requirements for a given patient.
This command allows users to add three different types of dietary requirements: allergy, cultural requirement and physical difficulty.
This command adds these dietary requirements to a given Person
, so that the dietary requirements can be viewed later on.
This command blocks non-alphabetical or empty input as the detail of a dietary requirement.
Classes involved
The adding of the dietary requirements involve the following classes:
-
DietCollection
, which is a set of-
Diet
, which consists of the detail of the requirement and its type-
DietType
.
-
-
A more detailed description of the classes involved is as follows:
-
Diet Collection
-
Every
Person
object has aDiet Collection
object. -
This class encapsulates a collection of all the dietary requirements of the given patient.
-
This class is a wrapper class around the internal representation of a
Set
ofDiet
s.
-
-
Diet
-
This class encapsulates the information of a single dietary requirement.
-
Specifically, an instance of this class is composed of
-
a
String
representing the details of the requirement in text, and -
a
DietType
representing the type of this dietary requirement (allergy, cultural requirement, or physical difficulty).
-
-
-
DietType
-
This class is an
Enum
class representing the three different types of dietary requirements. -
This class is implemented as
Enum
class to avoid typo and invalid types being entered.
-
Execution of the command
Given below is a usage scenario and the details when executing adddiet
command.
For example, when the user executes adddiet ic/S1234567A alg/Egg alg/Crab cr/Halal pd/Hands cannot move
:
-
The command text is passed to an instance of the
LogicManager
class. -
The
LogicManager
instance callsHealthBaseParser#parseCommand
, which parses theadddiet
command word. -
Next, the
AddDietCommandParser#parse
method parses the different dietary requirements into oneDietCollection
object. An instance ofAddDietCommand
is returned after the parsing. -
LogicManager
then execute thisAddDietCommand
by callingAddDietCommand#execute
. -
In the
AddDietCommand#execute
method, the newDietCollection
object is added to a new copy of thePerson
object. -
The new
Person
object is updated to the model byModel#updatePerson
method. -
A new
CommandResult
is returned and the execution ends.
Here is the sequence diagram of the typical execution of an adddiet
command:
adddiet
command3.2.2. Design considerations
Aspect: How to represent different kinds of dietary requirements
-
Alternative 1 (current implementation): Use a
Enum
inside theDiet class
and contain allDiet
in one collection.-
Pros: Results in less repetitive code and cleaner design.
-
Cons: Requires more effort to filter or retrieve different types of
Diet
from oneDietCollection
.
-
-
Alternative 2: Use polymorphism to extends
Diet
class and add three different collections to aPerson
.-
Pros: Makes it easier to retrieve different types of dietary requirements.
-
Cons: Results in a lot of repetitive code since the three different types do not differ much.
-
Aspect: Data structure to hold the different Diet
objects
-
Alternative 1 (current implementation): Use
HashSet
and override thehashCode
forDiet
.-
Pros: Makes it easier to handle duplication in adding dietary requirement.
-
Cons: Causes the order in which dietary requirements are added to be lost. (However, the sequence is not important for the current set of features implemented.)
-
-
Alternative 2: Use
ArrayList
.-
Pros: Preserves the order in which dietary requirements are added.
-
Cons: Makes it harder to handle duplicates.
-
3.3. Addmeds
3.3.1. Current implementation
The addmeds
command provides functionality for users to add prescription-related information for a given patient.
This is done by adding prescription-related information to a given person, represented by a Person
object.
This allows for a patient to build up a history of prescriptions for viewing at a later date.
The adding of prescription-related information is facilitated by the following classes:
-
PrescriptionList
, a list of-
Prescription
s, each of which have a-
Dose
and a -
Duration
.
-
-
A more detailed description of the classes follows below:
-
PrescriptionList
-
Every
Person
has aPrescriptionList
, the purpose of which is to store thePerson
'sPrescriptions
. -
A wrapper class around the internal representation of a list of prescriptions that exposes only a few select methods in its API.
-
The methods relevant for the
addmeds
command execution are:add
-
-
-
Prescription
-
Class encapsulating all the information about a given medication prescription.
-
More specifically, the
Prescription
class encapsulates the name of the drug prescribed, the dosage information (itself stored as aDose
object), and the duration of the prescription (as aDuration
object).
-
-
-
Dose
-
Class encapsulating all the information about a given medication dosage.
-
More specifically, the
Dose
class encapsulates the dose, dosage unit, and doses per day to administer.
-
-
-
Duration
-
Class encapsulating all the information about a given time period.
-
More specifically, the
Duration
class encapsulates the duration of the time period in milliseconds, and the calendar dates for the start and end of that time period.
-
-
Given below is an example usage scenario and how the relevant classes behave at each step.
At the end of the explanation is a sequence diagram of a typical addmeds
command execution.
The user executes addmeds ic/S1234567A d/Paracetamol q/2 u/tablets n/4 t/14
.
This command has the following intent: Prescribe the following medication to a patient with NRIC = S1234567A:
Drug Name |
Dosage |
Duration |
Paracetamol |
2 tablets, 4 times a day |
14 days, from current date to 14 days from now. |
The command text is passed to an instance of the LogicManager
class, which in turn executes HealthBaseParser::parse
.
The HealthBaseParser
parses the command word (addmeds
) and executes AddmedsCommandParser::parse
.
This causes the AddmedsCommandParser
to construct the following objects in the following order:
Index |
Information used |
Class instances used |
Class instance constructed |
1 |
Dosage, Dosage unit, Doses per day |
nil |
|
2 |
Duration in days |
nil |
|
3 |
NRIC |
nil |
|
4 |
Drug name |
|
|
5 |
nil |
|
|
The AddmedsCommandParser::parse
method returns an AddmedsCommand
object which encapsulates the necessary information to update the Person
's medication(s).
Control then passes back to the LogicManager
, which calls AddmedsCommand::execute
.
The AddmedsCommand::execute
method constructs a new Person
object using all the details of the old Person, with the sole difference being the PrescriptionList
used being a deep copy of the original Person
's PrescriptionList
with the new Prescription
added.
This updated Person
object is used to update the existing Person
object using the Model::updatePerson
method (or an overridden version) of the backing model.
Finally, the AddmedsCommand::execute
method terminates, returning a CommandResult
with a success message.
The LogicManager
then returns the same CommandResult
as the return value of the LogicManager::execute
method.
The command execution then ends.
The following sequence diagram shows the execution of the addmeds
command:
addmeds
command3.3.2. Design considerations
Aspect: Data structure to support the medication data storage
-
Alternative 1 (Current implementation): Store the data inside multiple POJO classes, with new classes being introduced as necessary to maintain high cohesion of individual classes. For example, the
Duration
class holds temporal information, whereas theDose
class holds medication dosage-related information.-
Pros: Maintains the Single Responsibility Principle (e.g. the
Prescription
class now changes only if there are changes to the structure of a physical prescription, and not due to (e.g.) changes in time representation, or the way that dosage-related information is stored. -
Cons: Increases the number of classes we will have to maintain.
-
-
Alternative 2: Store all the data directly as members inside a single
Prescription
class.-
Pros: Reduces the number of classes we will have to maintain.
-
Cons: Reduces the cohesion of the
Prescription
class as it now handles multiple different items e.g. dosage-related information and duration-related information.
-
3.4. Addmh
3.4.1. Current implementation
The function of the addmh
command is to allow the user to add a diagnosis to a patient’s medical history.
Each patient’s information is stored within the Person
objects. The execution of the addmh
command results in the retrieval of
a particular Person
object, and the consequent updating of the patient’s MedicalHistory
.
Stated below is an example usage scenario and an explanation of the interactions that occurs as a result of the code execution.
The user executes the following input:
addmh ic/S1234567A mh/Hypertension, diagnosed “years ago”, well contracted with Metoponol doc/Dr. Amos
Intent
The purpose of the entered input is to record a diagnosis issued by Dr.Amos
, "Hypertension, diagnosed “years ago”, well contracted with Metoponol"
,
into the medical history of the patient with the NRIC S1234567A
.
3.4.2. Command execution
The sequence diagram below shows the execution of the given scenario:
addmh
commandaddmh ic/S1234567A mh/Hypertension, diagnosed “years ago”, well contracted with Metoponol doc/Dr. Amos
-
Firstly, the
String
user input is passed into theLogicManager::execute
method of the LogicManager instance as the only parameter. -
Then, the
LogicManager::execute
method callsHealthBaseParser::parseCommand
which receives the user input as a parameter.-
The user input is formatted: the first
String
token is taken as the command word, while the remainingString
is grouped as arguments to be used later inAddmhCommandParser
. -
From the command word, the HealthBaseParser instance identifies the user input as an
addmh
command and constructs anAddmhCommandParser
instance.
-
-
Next, the
HealthBaseParser
calls theAddmhCommandParser::parse
method. TheAddmhCommandParser
takes in the remaining string,ic/S1234567A mh/Hypertension, diagnosed “years ago”, well contracted with Metoponol doc/Dr. Amos
.-
The string is tokenised to arguments according to their prefixes.
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NRIC, PREFIX_MED_HISTORY, PREFIX_DOCTOR);
-
A check on the presence of the relevant prefixes
ic/
,mh/
anddoc/
is done. -
If not all prefixes are present, a
ParseException
will be thrown with an error message on the proper usage of theaddmh
command.if (!arePrefixesPresent(argMultimap, PREFIX_NRIC, PREFIX_MED_HISTORY, PREFIX_DOCTOR) || !argMultimap.getPreamble().isEmpty()) { throw new ParseException((String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddmhCommand.MESSAGE_USAGE))); }
-
Otherwise,
Diagnosis
andNric
objects are constructed and used as fields in the creation of anAddmhCommand
object.
-
-
Subsequently, the newly created
AddmhCommand
is returned to back to theLogicManager
instance throughAddmhCommandParser
andHealthBaseParser
objects. -
When control is returned to the
LogicManager
object, it calls theAddmhCommand::execute
method.-
The method takes in a
Model
object to access the application’s data context, the stored data of all persons. -
Its execution sequence may be broken down into the numbered steps in the code below.
public CommandResult execute(Model model, CommandHistory history) throws CommandException { requireNonNull(model); Person patientToUpdate = CommandUtil.getPatient(patientNric, model); (6) Person updatedPatient = addMedicalHistoryForPatient(patientToUpdate, this.newRecord); (7) model.updatePerson(patientToUpdate, updatedPatient); (8) return new CommandResult(String.format(MESSAGE_SUCCESS, patientNric)); (9) }
-
-
The stored persons data is accessed in the
CommandUtil::getPatient
class method.-
Model::getFilteredPersonList
is called to search for a person with aNric
that matches theNric
field in theAddmhCommand
-
If a match is found, the
Person
is returned to theAddmhCommand::execute
method.public static Person getPatient(Nric nric, Model model) throws CommandException { ObservableList<Person> matchedCheckedOutPatients = model.getFilteredCheckedOutPersonList() .filtered(p -> nric.equals(p.getNric())); if (matchedCheckedOutPatients.size() > 0) { throw new CommandException(MESSAGE_PATIENT_CHECKED_OUT); } ObservableList<Person> matchedCheckedInPatients = model.getFilteredPersonList() .filtered(p -> nric.equals(p.getNric())); if (matchedCheckedInPatients.size() < 1) { throw new CommandException(MESSAGE_NO_SUCH_PATIENT); } if (matchedCheckedInPatients.size() > 1) { throw new CommandException(MESSAGE_MULTIPLE_PATIENTS); } return matchedCheckedInPatients.get(0); }
-
-
Following that, the
Person
's medical history is to be updated.-
The person’s current
medicalHistory
is retrieved, and theDiagnosis
field in theAddmhCommand
is added it. -
Then, a new
Person
is created with the updated fields, as part of the immutability of thePerson
class.private static Person addMedicalHistoryForPatient(Person patientToEdit, Diagnosis diagnosis) { requireAllNonNull(patientToEdit, diagnosis); MedicalHistory updatedMedicalHistory = patientToEdit.getMedicalHistory(); updatedMedicalHistory.add(diagnosis); return patientToEdit.withMedicalHistory(updatedMedicalHistory); }
-
-
Then, the old
Person
's data will be replaced with the updatedPerson
's data.-
Here the
Model::updatePerson
method is called, and it subsequently calls theHealthBase::updatePerson
method. -
Replaces the person’s existing data in the storage with the person’s updated data.
// ModelManager.java public void updatePerson(Person target, Person editedPerson) { requireAllNonNull(target, editedPerson); internalHealthBase.updatePerson(target, editedPerson); indicateHealthBaseChanged(); } // HealthBase.java public void updatePerson(Person target, Person editedPerson) { requireNonNull(editedPerson); persons.setPerson(target, editedPerson); }
-
-
The
AddmhCommand::execute
execution completes by returning a newCommandResult
that contains a success message to its calling method,LogicManager::execute
. -
Finally the
CommandResult
is returned to the caller ofLogicManager::execute
, and the execution sequence ends.
The activity diagram below summarises what happens when a user executes the addmh
command.
addmh
command3.4.3. Design Considerations
Aspect: How to represent a timestamp in a diagnosis
-
Alternative 1 (current implementation): Use a POJO class to represent the timestamp data in the
Diagnosis
class.-
Pros: Results in improved readability and modularity of code, due to a stronger adherence to the Object-Oriented Programming paradigm.
-
Cons: Increases in modularity can make it difficult to find information, if code becomes over-modularised.
-
-
Alternative 2 (alternative implementation): Use a
String
to represent the timestamp and contain date-time related functions in theDiagnosis
class.-
Pros: Results in more compact code.
-
Cons: Decreases code modularity, and this decreases code readability.
-
Aspect: How to store medical history
-
Alternative 1 (current implementation): Use an ArrayList to store diagnoses in a person.
-
Pros: Allows expandable storage of diagnoses with its dynamic size. As an ArrayList implements the list interface, its contracted functionality suitably represents a list of diagnoses and this makes its usage in developing intuitive.
-
Cons: Slows down performance if the ArrayList capacity is constantly filled due to resizing costs.
-
-
Alternative 2 (alternative implementation): Use an Array to store diagnoses in a person.
-
Pros: Reduces performance losses that may arise from constant resizing in ArrayLists.
-
Cons: Decreases flexibility in developing as Arrays do not support generics in Java.
-
3.5. Visitorin/Viewvisitors/Visitorout
3.5.1. Current implementation
There three commands related to manage patients' visitors.
-
The
visitorin
command allows user to add visitors into patient’s visitorList. Each patient has aVisitorList
and the maximum size of the list is 5 so that patients can have a comfortable environment. -
The
viewvisitors
command allows user to view a patient’s current visitors in his/herVisitorList
. It displays all the visitors from the requested patient’svisitorList
in order of entry. -
The
visitorout
command allows user to remove a visitor from patient’sVisitorList
.
Classes associated
The three commands are executed mainly depends on the classes of VisitorList
and Visitor
. Each Person
object contains a
VisitorList
. The visitorin
and visitorout
commands are created to add/remove a Visitor
in the required Person
's VisitorList
.
The viewvisitors
command display the Person
's VisitorList
.
-
VisitorList
, a list of-
Visitor
s
-
A more detailed description of the classes involved is as follows:
-
Visitor
-
This class encapsulates the given name of the visitor.
-
String
represent the visitor name.
-
-
VisitorList
-
Using
List
type of structure to store all theVisitor
s stored for a particular patient
-
3.5.2. Commands Execution
To illustrate how the three commands work, examples are given below.
-
visitorin ic/S1234567A v/Jane
-
The command inputs are passed to an instance of the
LogicManager
class. -
HealthBaseParser
parses the command word (visitorin
) and executesVisitorInCommandParser::parse
. -
VisitorInCommandParser::parse
construct and aVisitor
(Jane),Nric
(S1234567A) of the patient provided by the user and then returnsVisitorinCommand
object. Below shows the part of code:
-
public CommandResult execute(Model model, CommandHistory history) throws CommandException { requireNonNull(model); Person patientToUpdate = CommandUtil.getPatient(patientNric, model); if (patientToUpdate.getVisitorList().getSize() >= 5) { throw new CommandException(MESSAGE_FULL); } if (patientToUpdate.getVisitorList().contains(visitorName)) { throw new CommandException(MESSAGE_DUPLICATE_VISITORS); } Person updatedPatient = addVisitorForPatient(patientToUpdate, this.visitorName); model.updatePerson(patientToUpdate, updatedPatient); return new CommandResult(String.format(MESSAGE_SUCCESS, patientNric)); }
-
In
VisitorinCommand
, newVisitor
object is created and added to a copy of the requiredPerson
object’sVisitorList
-
The new
Person
object is updated to the model byModel#updatePerson
method. -
A new CommandResult object is returned and the execution ends.
-
Below is visitorin
sequence diagram (Figure 1):
visitorin
sequence diagram-
viewvisitor ic/S1234567A
-
Similar to the
visitorin
command,ViewvisitorsCommandParser::parse
the required patient’s ic(S1234567A) and returns aViewvisitorsCommand
object -
ViewvisitorsCommand
retrieves the person with the required patient’s ic and construct a copy of selected patient’s VisitorList for display-
A new CommandResult object is returned and the execution ends.
-
-
Below is viewvisitor
sequence diagram (Figure 2):
viewvisitor
sequence diagram-
visitorout ic/S1234567A v/Jane
-
Similar to the
visitorin
command,VisitoroutCommandParser::parse
construct and aVisitor
(Jane),Nric
(S1234567A) of the patient provided by the user and then returnsVisitoroutCommand
object. Below shows the part of code:
-
public CommandResult execute(Model model, CommandHistory history) throws CommandException { requireNonNull(model); Person selectedPatient = CommandUtil.getPatient(patientNric, model); VisitorList patientVisitorList = selectedPatient.getVisitorList(); if (patientVisitorList.getSize() == 0) { return new CommandResult(String.format(MESSAGE_NO_VISITORS, patientNric)); } if (!patientVisitorList.contains(visitorName)) { return new CommandResult(String.format(MESSAGE_NO_REQUIRED_VISITOR, patientNric)); } Person updatedPatient = removeVisitorForPatient(selectedPatient, this.visitorName); model.updatePerson(selectedPatient, updatedPatient); return new CommandResult(String.format(MESSAGE_SUCCESS, patientNric)); }
-
In
VisitoroutCommand
, newVisitor
object is created and removed from the copy of the requiredPerson
object’sVisitorList
-
The new
Person
object is updated to the model byModel#updatePerson
method. -
A new CommandResult object is returned and the execution ends.
-
Below is visitorout
sequence diagram (Figure 3):
visitorout
sequence diagram3.6. [Proposed] Data Encryption
Coming in V2.0.
3.7. Logging
We are using the java.util.logging
package for logging. The LogsCenter
class is used to manage the logging levels and logging destinations.
-
The logging level can be controlled using the
logLevel
setting in the configuration file (See Section 3.8, “Configuration”) -
The
Logger
for a class can be obtained usingLogsCenter.getLogger(Class)
which will log messages according to the specified logging level -
Currently, log messages are output through:
Console
and to a.log
file.
Logging levels
-
SEVERE
: Critical problem detected which may possibly cause the termination of the application -
WARNING
: Can continue, but with caution -
INFO
: Information showing the noteworthy actions by the App -
FINE
: Details that is not usually noteworthy but may be useful in debugging e.g. print the actual list instead of just its size
3.8. Configuration
Certain properties of the application can be controlled (e.g app name, logging level) through the configuration file (default: config.json
).
4. Documentation
We use AsciiDoc for writing documentation.
We chose AsciiDoc over Markdown because AsciiDoc, although a bit more complex than Markdown, provides more flexibility in formatting. |
4.1. Editing documentation
See UsingGradle.adoc to learn how to render .adoc
files locally to preview the end result of your edits.
Alternatively, you can download the AsciiDoc plugin for IntelliJ, which allows you to preview the changes you have made to your .adoc
files in real-time.
4.2. Publishing documentation
See UsingTravis.adoc to learn how to deploy GitHub Pages using Travis.
4.3. Converting documentation to PDF format
We use Google Chrome for converting documentation to PDF format, as Chrome’s PDF engine preserves hyperlinks used in webpages.
Here are the steps to convert the project documentation files to PDF format.
-
Follow the instructions in UsingGradle.adoc to convert the AsciiDoc files in the
docs/
directory to HTML format. -
Go to your generated HTML files in the
build/docs
folder, right click on them and selectOpen with
→Google Chrome
. -
Within Chrome, click on the
Print
option in Chrome’s menu. -
Set the destination to
Save as PDF
, then clickSave
to save a copy of the file in PDF format. For best results, use the settings indicated in the screenshot below.
4.4. Site-wide documentation settings
The build.gradle
file specifies some project-specific asciidoc attributes which affects how all documentation files within this project are rendered.
Attributes left unset in the build.gradle file will use their default value, if any.
|
Attribute name | Description | Default value |
---|---|---|
|
The name of the website. If set, the name will be displayed near the top of the page. |
not set |
|
URL to the site’s repository on GitHub. Setting this will add a "View on GitHub" link in the navigation bar. |
not set |
|
Define this attribute if the project is an official SE-EDU project. This will render the SE-EDU navigation bar at the top of the page, and add some SE-EDU-specific navigation items. |
not set |
4.5. Per-file documentation settings
Each .adoc
file may also specify some file-specific asciidoc attributes which affects how the file is rendered.
Asciidoctor’s built-in attributes may be specified and used as well.
Attributes left unset in .adoc files will use their default value, if any.
|
Attribute name | Description | Default value |
---|---|---|
|
Site section that the document belongs to.
This will cause the associated item in the navigation bar to be highlighted.
One of: * Official SE-EDU projects only |
not set |
|
Set this attribute to remove the site navigation bar. |
not set |
4.6. Site template
The files in docs/stylesheets
are the CSS stylesheets of the site.
You can modify them to change some properties of the site’s design.
The files in docs/templates
controls the rendering of .adoc
files into HTML5.
These template files are written in a mixture of Ruby and Slim.
Modifying the template files in |
5. Testing
5.1. Running tests
There are three ways to run tests.
The most reliable way to run tests is the third one. The first two methods might fail some GUI tests due to platform/resolution-specific idiosyncrasies. |
Method 1: Using IntelliJ JUnit test runner
-
To run all tests, right-click on the
src/test/java
folder and chooseRun 'All Tests'
-
To run a subset of tests, you can right-click on a test package, test class, or a test and choose
Run 'ABC'
Method 2: Using Gradle
-
Open a console and run the command
gradlew clean allTests
(Mac/Linux:./gradlew clean allTests
)
See UsingGradle.adoc for more info on how to run tests using Gradle. |
Method 3: Using Gradle (headless)
Thanks to the TestFX library we use, our GUI tests can be run in the headless mode. In the headless mode, GUI tests do not show up on the screen. That means the developer can do other things on the Computer while the tests are running.
To run tests in headless mode, open a console and run the command gradlew clean headless allTests
(Mac/Linux: ./gradlew clean headless allTests
)
5.2. Types of tests
We have two types of tests:
-
GUI Tests - These are tests involving the GUI. They include,
-
System Tests that test the entire App by simulating user actions on the GUI. These are in the
systemtests
package. -
Unit tests that test the individual components. These are in
seedu.address.ui
package.
-
-
Non-GUI Tests - These are tests not involving the GUI. They include,
-
Unit tests targeting the lowest level methods/classes.
e.g.seedu.address.commons.StringUtilTest
-
Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
e.g.seedu.address.storage.StorageManagerTest
-
Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together.
e.g.seedu.address.logic.LogicManagerTest
-
5.3. Troubleshooting testing
Problem: HelpWindowTest
fails with a NullPointerException
.
-
Reason: One of its dependencies,
HelpWindow.html
insrc/main/resources/docs
is missing. -
Solution: Execute Gradle task
processResources
.
6. Dev Ops
6.1. Build automation
See UsingGradle.adoc to learn how to use Gradle for build automation.
6.2. Continuous integration
We use Travis CI to perform Continuous Integration on our projects. See UsingTravis.adoc and UsingAppVeyor.adoc for more details.
6.3. Coverage reporting
We use Coveralls to track the code coverage of our projects. See UsingCoveralls.adoc for more details.
6.4. Documentation previews
When a pull request has changes to asciidoc files, you can use Netlify to see a preview of how the HTML version of those asciidoc files will look like when the pull request is merged. See UsingNetlify.adoc for more details.
6.5. Making a release
Here are the steps to create a new release.
-
Update the version number in
MainApp.java
. -
Generate a JAR file using Gradle.
-
Tag the repo with the version number. e.g.
v0.1
-
Create a new release using GitHub and upload the JAR file you created.
6.6. Managing dependencies
A project often depends on third-party libraries. For example, HealthBase depends on the Jackson library for XML parsing. Managing these dependencies can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives.
a. Include those libraries in the repo (this bloats the repo size)
b. Require developers to download those libraries manually (this creates extra work for developers)
Appendix A: Product Scope
Target user profile:
-
has a need to manage a significant amount of medical data
-
prefer desktop apps over other types
-
can type fast
-
prefers typing over mouse input
-
is reasonably comfortable using CLI apps
Value proposition: manage patient data faster than a typical mouse/GUI driven app or pen/paper management systems.
Appendix B: User Stories
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
|
doctor |
view my patient’s medical history |
be aware of any chronic illnesses he has. |
|
doctor |
view my patient’s current medication |
avoid double-prescriptions. |
|
doctor |
search for a particular patient |
view his information. |
|
doctor |
view my patient’s medical history |
understand his medical situation better. |
|
doctor |
view my patient’s drug allergies |
prescribe him the correct medicine. |
|
doctor |
view my patient’s drug prescription history on a timeline |
have a better idea of the patient’s medication history. |
|
pharmacist |
view my patient’s current medication |
can avoid double-prescriptions. |
|
nurse |
view my patient’s dietary information |
know my patient’s dietary preference. |
|
nurse |
view a patient’s next-of-kin |
contact them in the event that the patient dies. |
|
nurse |
view a patient’s medical history |
can triage them effectively. |
|
counter staff |
view a patient’s registered visitors |
verify if a visitor is a valid visitor. |
|
counter staff |
view a patient’s registered visitors |
view the number of visitors for each patient at any one time |
{More to be added in V2.0}
Appendix C: Use Cases
(For all use cases below, the System is the HealthBase
and the Actor is the user
, unless specified otherwise)
Use case: delete patients
MSS
-
User requests to list patients
-
HealthBase shows a list of patients
-
User requests to delete a specific patient in the list
-
HealthBase deletes the patient
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The given index is invalid.
-
3a1. HealthBase shows an error message.
Use case resumes at step 2.
-
Use case: View patient’s medical details
MSS
-
Doctor requests to list patient’s medical details
-
HealthBase shows a list of the patient’s medical details
Use case ends.
Extensions
-
2a. The patient does not exist.
-
2a1. HealthBase shows an error message.
Use case ends.
-
Use case: View patient’s medication
MSS
-
Doctor/Pharmacist requests to list patient’s current medication
-
HealthBase shows a list of the patient’s current medication
Use case ends.
Extensions
-
2a. The patient does not exist.
-
2a1. HealthBase shows an error message.
Use case ends.
-
Use case: View patient’s dietary details
MSS
-
User searches the name of a patient
-
HealthBase shows a list of patients
-
User requests to view a patient’s dietary details
-
HealthBase shows requested details
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The given index is invalid.
-
3a1. HealthBase shows an error message.
Use case ends.
-
Use case: Sign in patient’s visitors
MSS
-
Counter staff inputs the visited patient’s NRIC
-
Visitor is registered
Use case ends.
Extensions
-
2a. Number of visitors for that patient exceeds maximum number(5) allowed.
-
2a1. HealthBase rejects visitor.
Use case ends.
-
Use case: Sign out patient’s visitors
MSS
-
Counter staff inputs the visited patient’s NRIC and visitor name
-
Visitor is signed out
Use case ends
Extensions
-
1a. Counter staff inputs the visited patient’s number and visitor name.
-
2a. Visitor is signed out.
Use case ends.
Use case: Register patient
MSS
-
Counter nurse request to register a new patient
-
Counter nurse inputs the patient’s NRIC
-
HealthBase adds the patient into the patient queue
Use case ends
Extensions
-
1a. The patient is already checked in.
-
1a1. HealthBase shows an error message.
Use case resumes at step 2.
-
-
2a. The patient has no existing data.
-
2a1. HealthBase prompts for additional data.
User case resumes at step 2.
-
3a1. HealthBase shows an error message.
Use case resumes at step 2.
-
Use case: Checkout patient
MSS
-
Counter nurse request to checkout patient
-
Counter nurse inputs the details for the patient to be checked out.
-
User requests to delete a specific person in the list
-
HealthBase removes the patient from patient queue
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The given index is invalid.
-
3a1. HealthBase shows an error message.
Use case resumes at step 2.
-
Appendix D: Non Functional Requirements
-
Should work on any mainstream OS as long as it has Java
9
or higher installed. -
Should be able to hold up to 1000 patients without a noticeable sluggishness in performance for typical usage.
-
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 work on Windows 10 and above as long as it has Java 9 or higher installed.
-
Should be able to hold up to 1000 patients without a noticeable sluggishness in performance for typical usage.
-
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.
-
Patient data should be securely encrypted.
-
Patients information will be safely backed up every week.
{More to be added in V2.0}
Appendix E: Glossary
- Mainstream OS
-
Windows, Linux, Unix, OS-X
- Private contact detail
-
A contact detail that is not meant to be shared with others
- Patient’s medical details
-
Information about the patient’s medical history and drug allergies
- Medical history
-
Past records of healthcare visits, pre-existing medical conditions
- Authorised visitors
-
Upon check-in of patient, the information of permitted visitors entered
- Register
-
Patient registers at the hospital
- Checkout
-
Patient is discharged from the hospital
Appendix F: Instructions for Manual Testing
Given below are instructions to test the app manually.
These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing. |
F.1. Launch and shutdown
-
Initial launch
-
Download the jar file and copy into an empty folder
-
Double-click the jar file
Expected: Shows the GUI with a set of sample patients. The window size may not be optimum.
-
-
Saving window preferences
-
Resize the window to an optimum size. Move the window to a different location. Close the window.
-
Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
-
F.2. Generating test data
-
Generating patients with mock data
-
Open the application.
-
Run the following commands in the following sequence:
-
dev-mode
(Enables developer mode; the next command requires developer mode to run.) -
gendata NUMBER_OF_PATIENTS
, whereNUMBER_OF_PATIENTS
is a positive integer value that indicates how many patients you wish to generate.
-
-
The application will then generate that number of patients with mock data for their:
-
Personal particulars
-
NRIC
-
Name
-
Phone number
-
Email address
-
Physical address
-
-
Drug allergies
-
Medications
-
Appointments
-
Dietary restrictions
-
Medical history
Details on the exact range of values that the mock data can take on can be found in the related .java
files.
F.3. Adding an appointment for a patient
-
Adding an appointment for a checked in patient
-
Prerequisites: Patient must not have an existing appointment at the same Date and Time
-
Test case:
addappt ic/S1234567A type/SRG pn/Heart Bypass dt/27-04-2019 10:30 doc/Dr. Pepper
Expected: Appointment is added for patient. To verify, runview appt
. -
Test case:
addappt ic/S1234567 type/SRG pn/Heart Bypass dt/27-04-2019 10:30 doc/Dr. Pepper
Expected: Appointment is not added due to the invalid NRIC input. -
Test case:
addappt ic/S1234567A type/SRG pn/Heart Bypass dt/27-04-2019 10:30 doc/Dr. Pepper
(after (b) has been run)
Expected: Appointment is not added due to the duplicate Date and Time from an existing appointment. -
Test case:
addappt ic/S1234567A type/apple pn/Heart Bypass dt/27-04-2019 10:30 doc/Dr. Pepper
Expected: Appointment is not added due to the invalid Type input. -
Test case:
addappt ic/S1234567A type/SRG pn/123 dt/27-04-2019 10:30 doc/Dr. Pepper
Expected: Appointment is not added because Procedure Name must only consist of alphabets. -
Test case:
addappt ic/S1234567A type/SRG pn/Heart Bypass dt/27-04-2019 10:30 doc/Pepper
Expected: Appointment is not added because of the missing salutation for Doctor.
-
F.4. Adding dietary requirements for a patient
-
Adding dietary requirements for a checked in patient
-
Prerequisites: Select a patient in the app using the
select
command. If there are no patients to be selected, add a new patient using theregister
command. Let this selected patient’s NRIC be denoted by$nric
. The test cases must be executed in the sequence listed. -
Test case:
adddiet ic/$nric alg/Egg alg/Milk cr/Halal pd/Hands cannot move
Expected: Dietary requirements are added for patient. To verify, runview diets
. -
Test case:
adddiet ic/$nric cr/Vegetarian
Expected: Dietary requirement is added for patient. To verify, runview diets
. -
Test case:
adddiet ic/$nric alg/Egg
Expected: No new dietary requirement is added, since the new allergy has been added before. -
Test case:
adddiet ic/$nric pd/1 hand cannot move.
Expected: Dietary requirement is not added due to the invalid input. -
Test case:
adddiet ic/$nric alg/Fish cr/
Expected: Dietary requirement is not added due to the invalidcr
input.
-
F.5. Adding medication for a patient
-
Adding medication for a given patient
-
Prerequisites: Select a patient in the app using the
select
command. If there are no patients to be selected, add a new patient using theregister
command. Let this selected patient’s NRIC be denoted by$nric
. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/4 t/14
Expected: A prescription corresponding to "Paracetamol, 2 tablets 4 times a day for 14 days" is added to the patient’s medications. -
Test case:
addmeds ic/$nric d/ q/2 u/tablets n/4 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/ q/2 u/tablets n/4 t/14
(Whitespace character as drug name)
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/0 u/tablets n/4 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/-1 u/tablets n/4 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/ u/tablets n/4 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/A u/tablets n/4 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/ n/4 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/ n/4 t/14
(Empty string as input for dosage unit)
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/ n/4 t/14
(Whitespace as input for dosage unit)
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/0 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/-1 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/-1 t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/A t/14
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/4 t/0
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/4 t/-1
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/4 t/0.5
Expected: No prescription is added. Error details shown in the status message. -
Test case:
addmeds ic/$nric d/Paracetamol q/2 u/tablets n/4 t/AAA
Expected: No prescription is added. Error details shown in the status message.
F.6. Adding a diagnosis to a patient’s medical record
-
Add diagnosis to a registered patient while all patients are listed.
-
Prerequisites:
-
Patient must be listed in the list on the panel on the left-hand side. Use the
list
command to list them, if there are no listed patients. -
Patient must be registered in HealthBase already.
-
Enter the following commands to set up a test scenario with only one registered patient:
-
clear
-
register ic/S1234567A n/John Doe p/98765432 e/johnd@example.com a/311, Clementi Ave 2, #02-25 da/aspirin da/insulin
-
-
-
Test case:
addmh ic/S1234567A mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/Dr.Ross
Expected: Patient’s diagnosis is successfully added. -
Test case:
addmh ic/ mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/Dr.Ross
Expected: Failed addition, NRICs should consist of a starting letter (capital), followed by 7 numerical digits, followed by a letter (again capital). No such patient will exist. -
Test case:
addmh ic/S9876543Z mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/Dr.Ross
Expected: Failed addition, patient is not registered, cannot add diagnosis for an unregistered patient. -
Test case:
addmh ic/A1234567Z mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/Dr.Ross
Expected: NRICs should consist of a starting letter (capital), followed by 7 numerical digits, followed by a letter (again capital). No such patient will exist. -
Test case:
addmh ic/S12234598675667A mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/Dr.Ross
Expected: Failed addition, NRICs should consist of a starting letter (capital), followed by 7 numerical digits, followed by a letter (again capital). No such patient will exist. -
Test case:
addmh ic/S1234567A mh/ doc/Dr.Ross
Expected: Failed addition, diagnosis should not be blank. -
Test case:
addmh ic/S1234567A mh/ doc/Dr.Ross
Expected: Failed addition, diagnosis should not be a whitespace. -
Test case:
addmh ic/S1234567A mh/!$!#! doc/Dr.Ross
Expected: Patient’s diagnosis is successfully added, diagnosis does not need to be made up of word letters. -
Test case:
addmh ic/S1234567A mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/dr.Ross
Expected: Failed addition, doctor’s title should precede his full name. The starting letter of all words in the doctor’s title should be should be spelt out with capitalisation. -
Test case:
addmh ic/S1234567A mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/Dr.Ross Geller Stuart Jack Ma Steve Bombamama Nojobs
Expected: Patient’s diagnosis is successfully added as doctor’s name is valid. -
Test case:
addmh ic/S1234567A mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/
Expected: Failed addition, doctor’s name should not be blank. -
Test case:
addmh ic/S1234567A mh/Patient has acute terminal stage brain cancer, refer to Dr.Zhang immediately. doc/
Expected: Failed addition, doctor’s name cannot be a whitespace.
-
F.7. Changing the view
-
Changing the view (right-side panel of the UI)
-
Prerequisites: None
-
Test case:
view default
Expected: The view changes to a blank panel (the default view). -
Test case:
view appt
Expected: The view changes to the Appointment View. -
Test case:
view diets
Expected: The view changes to the Diet View. -
Test case:
view meds
Expected: The view changes to the Medication View. -
Test case:
view mh
Expected: The view changes to the Medical History view. -
Test case:
view AAA
Expected: The view does not change. An error message is shown. -
Test case:
view
Expected: The view does not change. An error message is shown.
-
F.8. Sorting the view
-
Sorting a given view
-
Prerequisites: The current view is a sortable view. Change the view to the Medication View (guaranteed sortable) using
view meds
. -
Test case:
sort a 1
Expected: The first column is used to sort the entries in the Medication View in ascending order. The natural ordering is lexicographical (for alphabetical data) and numerical (for numerical data). -
Test case:
sort
Expected: The view remains unsorted. An error message is shown. -
Test case:
sort x
Expected: The view remains unsorted. An error message is shown. -
Test case:
sort a
Expected: The view remains unsorted. An error message is shown.
-
F.9. Checking out a patient
-
Checking out a patient who is in the system
-
Prerequisites: A patient is registered and checked in to the system, and is visible on the left panel. Let
$nric
denotes this patient’s NRIC. Let$nricOther
denotes an NRIC of a patient who is not registered in the system. The test cases must be executed in the sequence listed. -
Test case:
checkout ic/$nricOther
Expected: The command fails. Error detail shown in the status message. -
Test case:
checkout ic/$nric
Expected: The patient with$nric
is checked out. -
Test case:
checkout ic/$nric
Expected: The command fails. Error detail shown in the status message.
-
F.10. Checking in a patient
-
Checking in a previously checked out patient
-
Prerequisites: A patient is registered and previously checked out from the system. Let
$nric
denotes this patient’s NRIC. Let$nricOther
denotes an NRIC of a patient who is not registered in the system. The test cases must be executed in the sequence listed. -
Test case:
checkin ic/$nricOther
Expected: The command fails. Error detail shown in the status message. -
Test case:
checkin ic/$nric
Expected: The patient with$nric
is checked in. -
Test case:
checkin ic/$nric
Expected: The command fails. Error detail shown in the status message.
-
F.11. Generating data
-
Generating data for testing
-
Prerequisites: The application must be in developer mode. Toggle developer mode using the
dev-mode
command. -
Test case:
gendata 10
Expected: The application’s data is cleared. 10 patients’s worth of data is generated. -
Test case:
gendata
Expected: No data is generated. An error message is shown. -
Test case:
gendata -1
Expected: No data is generated. An error message is shown. -
Test case:
gendata A
Expected: No data is generated. An error message is shown.
-