By: CS2103-AY1819S2-W13-4
Since: January 2019
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. Logging into the application
- F.3. Adding a patient
- F.4. Deleting a patient
- F.5. Editing a patient
- F.6. Adding allergy to a patient
- F.7. Removing allergy from a patient
- F.8. Adding appointment to a patient
- F.9. Removing appointment from a patient
- F.10. Selecting a patient
- F.11. Undoing an action
- F.12. Redoing an action
- F.13. Exporting Giatros Book
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
MainWindow.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
HelpWindowTest.java
for code errors, and if so, resolve it the same way)
1.3. Verifying the setup
-
Run the
seedu.giatros.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 refer to the CS2103-AY1819S2-W13-4/main
repo.
If you plan to develop this fork as a separate product (i.e. instead of contributing to CS2103-AY1819S2-W13-4/main
), 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 personal fork. |
Optionally, you can set up AppVeyor as a second CI (see UsingAppVeyor.adoc).
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”.
-
Take a look at [GetStartedProgramming].
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 where necessary.
Commons
represents a collection of classes used by multiple other components.
The following class plays an important role at the architecture level:
-
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.
How the architecture components interact with each other
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command delete 1
.
delete 1
commandThe 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
, BrowserPanel
etc. All these, including the MainWindow
, inherit from the abstract UiPart
class.
The UI
component uses 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,
-
Executes user commands using the
Logic
component. -
Listens for changes to
Model
data so that the UI can be updated with the modified data.
2.3. Logic component
API :
Logic.java
-
Logic
uses theGiatrosBookParser
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). -
The result of the command execution is encapsulated as a
CommandResult
object which is passed back to theUi
. -
In addition, the
CommandResult
object can also instruct theUi
to perform certain actions, such as displaying help to the user.
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 the Giatros book 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 an Allergy list in Giatros book , which Patient can reference. This would allow Giatros book to only require one Allergy object per unique Allergy , instead of each Patient needing their own Allergy 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 the Giatros book data in json format and read it back.
2.6. Common classes
Classes used by multiple components are in the seedu.giatrosbook.commons
package.
3. Implementation
This section describes some noteworthy details on how certain features are implemented.
3.1. User authentication feature
3.1.1. Current Implementation
The user account mechanism is facilitated by GiatrosBook
. Additionally, it implements the following operations:
-
GiatrosBook#addAccount(Account)
— Saves the new account.
These operations are exposed in the Model
interface as Model#getAccount(Account)
. The following commands will
invoke the aforementioned operations:
-
Command#LoginCommand()
— InvokesModel#getAccount(Account)
. -
Command#RegisterCommand()
— InvokesModel#addAccount(Account)
.
Given below are usage scenarios and how each of the command and its respective operations behave at each
step which involves two components, Logic
which is responsible for parsing the user input and Model
which is
responsible for manipulating the list, if necessary. Both components are extended by LogicManager
and
ModelManager
respectively.
The following sequence diagram shows how the register
command works:
Figure 4.2.1.1: Sequence diagram to illustrate component interactions for the register
command
|
Step 1. The user executes register id/ces pw/1122qq n/Chua Eng Soon
command to create a new user account.
Step 2. LogicManager
invokes the GiatrosBookParser#parseCommand()
method which takes in the user input
as arguments.
Step 3. When the command is parsed, the Command#RegisterCommand()
will be created which is returned to the
LogicManager
.
Step 4. LogicManager
invokes the execute()
method of the Command#RegisterCommand()
, rc
which is instantiated in
Step 3. The Model
component will be involved as the Command#RegisterCommand()
invokes a request to add the account
into the storage by calling Model#addAccount(Account)
.
Step 5: The new account is added into the storage. Then, a CommandResult
is generated and returned to
LogicManager
which is used to display the result to the user.
The following sequence diagram shows how the login
command works:
Figure 4.2.1.2: Sequence diagram to illustrate component interactions for the login
command
We assume the user will enter the correct password. Otherwise, warning message will be shown to the user to re-enter the credential |
Step 1. The user executes login id/ces pw/1122qq
command to login to an existing user account.
Step 2. LogicManager
invokes the GiatrosBookParser#parseCommand()
method which takes in the user input
as arguments.
Step 3. When the command is parsed, the Command#LoginCommand()
will be created which is returned to the
LogicManager
.
Step 4. LogicManager
invokes the execute()
method of the Command#LoginCommand()
, lc
which is instantiated in
Step 3. The Model
component will be involved as the Command#LoginCommand()
invokes a request to retrieve an account
based on the username. If it exists, the account will be retrieved and the password hash will be compared. If it
matches, then the credential is valid and the user is authenticated.
3.2. Undo/Redo feature
3.2.1. Current Implementation
The undo/redo mechanism is facilitated by VersionedGiatrosBook
.
It extends GiatrosBook
with an undo/redo history, stored internally as an giatrosBookStateList
and currentStatePointer
.
Additionally, it implements the following operations:
-
VersionedGiatrosBook#commit()
— Saves the current Giatros book state in its history. -
VersionedGiatrosBook#undo()
— Restores the previous Giatros book state from its history. -
VersionedGiatrosBook#redo()
— Restores a previously undone Giatros book state from its history.
These operations are exposed in the Model
interface as Model#commitGiatrosBook()
, Model#undoGiatrosBook()
and Model#redoGiatrosBook()
respectively.
Given below is an example usage scenario and how the undo/redo mechanism behaves at each step.
Step 1. The user launches the application for the first time. The VersionedGiatrosBook
will be initialized with the initial Giatros book state, and the currentStatePointer
pointing to that single Giatros book state.
Step 2. The user executes delete 5
command to delete the 5th patient in the Giatros book. The delete
command calls Model#commitGiatrosBook()
, causing the modified state of the Giatros book after the delete 5
command executes to be saved in the giatrosBookStateList
, and the currentStatePointer
is shifted to the newly inserted Giatros book state.
Step 3. The user executes add n/David …
to add a new patient. The add
command also calls Model#commitGiatrosBook()
, causing another modified Giatros book state to be saved into the giatrosBookStateList
.
If a command fails its execution, it will not call Model#commitGiatrosBook() , so the Giatros book state will not be saved into the giatrosBookStateList .
|
Step 4. The user now decides that adding the patient was a mistake, and decides to undo that action by executing the undo
command. The undo
command will call Model#undoGiatrosBook()
, which will shift the currentStatePointer
once to the left, pointing it to the previous Giatros book state, and restores the Giatros book to that state.
If the currentStatePointer is at index 0, pointing to the initial Giatros book state, then there are no previous Giatros book states to restore. The undo command uses Model#canUndoGiatrosBook() to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo.
|
The following sequence diagram shows how the undo operation works:
The redo
command does the opposite — it calls Model#redoGiatrosBook()
, which shifts the currentStatePointer
once to the right, pointing to the previously undone state, and restores the Giatros book to that state.
If the currentStatePointer is at index giatrosBookStateList.size() - 1 , pointing to the latest Giatros book state, then there are no undone giatros book states to restore. The redo command uses Model#canRedoGiatrosBook() to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.
|
Step 5. The user then decides to execute the command list
. Commands that do not modify the giatros book, such as list
, will usually not call Model#commitGiatrosBook()
, Model#undoGiatrosBook()
or Model#redoGiatrosBook()
. Thus, the giatrosBookStateList
remains unchanged.
Step 6. The user executes clear
, which calls Model#commitGiatrosBook()
. Since the currentStatePointer
is not pointing at the end of the giatrosBookStateList
, all giatros book states after the currentStatePointer
will be purged. We designed it this way because it no longer makes sense to redo the add n/David …
command. This is the behavior that most modern desktop applications follow.
The following activity diagram summarizes what happens when a user executes a new command:
3.2.2. Design Considerations
Aspect: How undo & redo executes
-
Alternative 1 (current choice): Saves the entire giatros book.
-
Pros: Easy to implement.
-
Cons: May have performance issues in terms of memory usage.
-
-
Alternative 2: Individual command knows how to undo/redo by itself.
-
Pros: Will use less memory (e.g. for
delete
, just save the patient being deleted). -
Cons: We must ensure that the implementation of each individual command are correct.
-
Aspect: Data structure to support the undo/redo commands
-
Alternative 1 (current choice): Use a list to store the history of giatros book states.
-
Pros: Easy for new Computer Science student undergraduates to understand, who are likely to be the new incoming developers of our project.
-
Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update both
HistoryManager
andVersionedGiatrosBook
.
-
-
Alternative 2: Use
HistoryManager
for undo/redo-
Pros: We do not need to maintain a separate list, and just reuse what is already in the codebase.
-
Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as
HistoryManager
now needs to do two different things.
-
3.3. Add/Remove Allergy Feature
3.3.1. Current Implementation
The add and remove allergy feature is implemented to extend the functionality of Allergy
tags.
Currently, the edit
command will overwrite the existing Allergy
tags if user attempts to edit the existing Allergy
.
With the addall
and remall
command, it is now possible to add or remove a single or multiple allergies associated with a patient.
The functionality of the classes related to addall
and remall
are listed below:
-
AddallCommandParser
andRemallCommandParser
— Reads the user input and createAddallCommand
andRemallCommand
object respectively. -
AddallCommand
andRemallCommand
— When executed, the command will result in the addition or removal of a single or multiple allergies. -
Allergy
— An object that models allergy. It contains a String describing the name of the allergy.
A patient’s Allergy
is stored in a Java HashSet, which stores only unique Allergy
object.
This feature makes use of this behaviour of a HashSet to allow user to add or remove allergies from the patient.
-
addall
command uses the.addAll()
method, which takes in a set ofAllergy
objects and add them in if they are not inside the set already. -
remall
command uses the.remAll()
method, which takes in a set ofAllergy
objects and remove them if they are actually inside in the set.
Given below is an example usage scenario and how the add allergy mechanism behaves at each step.
Step 1. The user launches the application and logs into the STAFF account.
Step 2. Assuming that the patient list is not empty, the user executes addall 1 y/newallergy
to add newallergy to the first patient in the list.
Step 3. This command in string format will be passed to the AddallCommandParser, which will check if the command format is valid.
Step 4. Since this command has a valid format, the system will create a new AddallCommand object, which will be executed.
Step 5. The system will locate the first patient in the patient list, and adds the non-existing allergy to the unique list of patient allergy.
The following sequence diagram shows how the add allergy operation works:
The remove allergy mechanism behaves similarly to the add allergy mechanism. Below is the example usage scenario.
Step 1. The user launches the application and logs into the STAFF account.
Step 2. Assuming that the patient list is not empty, the user executes remall 1 y/existingallergy
to remove existingallergy to the first patient in the list.
Step 3. This command in string format will be passed to the AddallCommandParser, which will check if the command format is valid.
Step 4. Since this command has a valid format, the system will create a new AddallCommand object, which will be executed.
Step 5. The system will locate the first patient in the patient list, and removes the existing allergy from the unique list of patient allergy.
The following sequence diagram shows how the remove allergy operation works:
3.3.2. Design Consideration
Aspect: Data structure to support the add/remove allergy commands
-
Alternative 1 (current choice): Use a HashSet to store the list of allergy.
-
Pros: Supports the addition and removal of allergy. Additionally, by storing unique list of allergy, we minimise the risk of inputting duplicate allergy by accident.
-
Cons: Slightly harder to implement as compared to a String representation.
-
-
Alternative 2: Use a String to store the list of allergy.
-
Pros: Easier to implement when compared to using a HashSet.
-
Cons: Every time we add or remove an allergy, we need to retype the whole lists of allergies because the previous String will simply be overwritten by the new String.
-
3.4. Add/Remove Appointment Feature
3.4.1. Current Implementation
The add and remove appointment feature is implemented to extend the functionality of Appointment
tags.
Currently, the edit
command will overwrite the existing Appointment
tags if user attempts to edit the existing Appointment
.
With the addapt
and remapt
command, it is now possible to add or remove a single or multiple appointments associated with a patient.
The functionality of the classes related to addapt
and remapt
are listed below:
-
AddaptCommandParser
andRemaptCommandParser
— Reads the user input and createAddaptCommand
andRemaptCommand
object respectively. -
AddaptCommand
andRemaptCommand
— When executed, the command will result in the addition or removal of a single or multiple appointments. -
Appointment
— An object that models appointment. It contains a String describing the name of the appointment.
A patient’s Appointment
is stored in a Java HashSet, which stores only unique Appointment
object.
This feature makes use of this behaviour of a HashSet to allow user to add or remove appointments from the patient.
-
addapt
command uses the.addapt()
method, which takes in a set ofAppointment
objects and add them in if they are not inside the set already. -
remapt
command uses the.remapt()
method, which takes in a set ofAppointment
objects and remove them if they are actually inside in the set.
Given below is an example usage scenario and how the add appointment mechanism behaves at each step.
Step 1. The user launches the application and logs into the STAFF account.
Step 2. Assuming that the patient list is not empty, the user executes addapt 1 apt/2019-01-01 15:30
to add a new appointment at 2019-01-01 15:30 to the first patient in the list.
Step 3. This command in string format will be passed to the AddaptCommandParser, which will check if the command format is valid.
Step 4. Since this command has a valid format, the system will create a new AddaptCommand object, which will be executed.
Step 5. The system will locate the first patient in the patient list, and adds the non-existing appointment to the unique list of patient appointment.
The process is described in sequence diagram shown below: The following sequence diagram shows how the add appointment operation works:
3.4.2. Design Consideration
Aspect: CRUD appointments
-
Alternative 1 (current choice): The appointment began as a refactoring of the tags implementation, with additional features added on later that allowed for easier modification of appointments. So currently each appointment is associated with a patient.
-
Pros: A doable task within the time limit, allows displaying of clear and multiple appointments
-
Cons: We ideally want to store appointments as dates, to allow us to sort them; Connect doctor objects to the appointments, etc.
-
-
Alternative 2 : Storing an appointment list, so that it’ll only require one appointment object per unique appointment.
-
Pros: An appointment object is not tied down to a Patient, since there could be multiple stakeholders in v2.0 implementation. I.e nurses, pharmacists, family of patients.
-
Cons: But compared to tags, appointments would be much more unique and tied to a patient. I.e many patients can have a coconut allergy, but how many patients can have an appointment with Dr.Oz at 10 AM on Christmas?
-
Aspect: Data structure to store appointment
-
Alternative 1 (current choice): Use a hash set to store appointments
-
Pros: Guarantees unique elements, and constant run time.
-
Cons: The hash function and other factors some what determine the order in which in the appointments are stored. Currently it’s stored as a string, so the order is to some extent random with hiccups here and there.
-
-
Alternative 2 : Use a sorted set to store appointments. Appointments as date objects.
-
Pros: Guarantees unique elements, and we can have the elements stored in a sorted fashion.
-
Cons: Not too many. It’s doable, but I didn’t have time.
-
3.5. Export Feature
3.5.1. Current Implementation
The following feature is mainly used to export data for report analysis. The export feature is available to admin only.
The functionality of the classes related to export
are listed below:
-
ExportCommandParser
— Reads the user input and createsExportCommand
. -
ExportCommand
— When executed, the command will result in a cvs file saved on the local disk at the specifiedDESTINATION
. -
DESTINATION
can end with an extension of .csv or end as a path to a directory. -
Existing data file at
DESTINATION
will be overwritten. -
A table view of the exported data will appear when file is opened.
-
.csv files can be opened and edited in Microsoft Excel
Given below is an example usage scenario and how the export mechanism behaves at each step.
Step 1. The user launches the application and logs into the STAFF account.
Step 2. Assuming that the patient list is not empty, the user executes export
to save the current Giastro’s book to a csv file
Step 3. This command in string format will be passed to the ExportCommandParser, which will check if the command format is valid.
Step 4. Since this command has a valid format, the system will create a new ExportCommand object, which will be executed.
Step 5. The system will locate the the desired destination, and save the giastrobook.csv file to the path.
The process is described in sequence diagram shown below: The following sequence diagram shows how the add appointment operation works:
3.5.2. Design Consideration
-
Create different csv files for each type of user. Due to only having patients in our book, we can currently only create csv files for that type of user.
-
Create cvs file for filtered lists
3.6. Logging
We are using 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.7, “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.7. Configuration
Certain properties of the application can be controlled (e.g user prefs file location, 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 3rd 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.giatros.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.giatros.commons.StringUtilTest
-
Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
e.g.seedu.giatros.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.giatros.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 and AppVeyor 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, Giatros Book depends on the Jackson library for JSON parsing. Managing these dependencies can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives:
-
Include those libraries in the repo (this bloats the repo size)
-
Require developers to download those libraries manually (this creates extra work for developers)
Appendix A: Product Scope
Target user profile:
-
Hospital Receptionists
-
Has a need to manage a significant number of patients
-
Need to coordinate manpower in the hospital
-
Would like to manage patient appointment well
-
Would like to manage where patients will recover
-
Would like to manage where doctors will perform treatment
-
Value proposition: Giatros acts as an integrated platform that improves the coordination between the various parties involved in a hospital, including hospital staffs and patients
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… |
---|---|---|---|
|
receptionist |
find a patient in the database |
decide whether the patient has been registered before |
|
receptionist |
add a new patient to the database |
register a patient who has never visited our hospital before |
|
receptionist |
delete a patient from the database |
remove erroneous details that have been accidentally added |
|
receptionist |
add a patient’s appointment |
keep track of the appointments in the hospital |
|
receptionist |
edit a patient’s appointment |
update an appointment that has been changed to another date |
|
receptionist |
delete a patient’s appointment |
remove an appointment that has been cancelled or erroneously input |
|
receptionist |
view the user guide |
find out about the commands available in the application |
|
receptionist |
add room booking for surgery |
patient can be treated by doctor |
|
receptionist |
edit room booking for surgery |
prioritize urgent surgeries |
|
receptionist |
add patient into a surgery room |
patient can be allocated to a room properly |
|
receptionist |
view all available patient recovery rooms |
locate available rooms for new patients |
|
receptionist |
the search result to be shown neatly |
locate and process work faster |
Appendix C: Use Cases
(For all use cases below, the System is Giatros
and the Actor is the user
, unless specified otherwise)
Use case: Add patient
MSS
-
Receptionist inputs to add a new patient into the record.
-
System adds patient details into the database.
Use case ends.
Extensions
-
1a. The receptionist did not input data in the specified format.
-
1a1. System shows an error message, along with a hint on how to input the data in the right format.
Use case resumes at step 1.
-
-
1b. The receptionist input a patient that has already existed in the database.
-
1b1. System shows an error message, alerting the receptionist that such patient already exists in the database.
Use case ends.
-
Use case: Delete patient
MSS
-
Receptionist requests to list all patients in the database.
-
System shows a list of patients registered in the database.
-
Receptionist requests to delete a specific patient in the list.
-
System deletes the patient.
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The given index is invalid.
-
3a1. System shows an error message, prompting for a valid index.
Use case resumes at step 2.
-
Use case: Edit patient
Precondition: Current list of patients is not empty.
MSS
-
Receptionist requests to list all patients in the database.
-
System shows a list of patients registered in the database.
-
Receptionists edits the details of a specific patient in the list.
-
System edits the details of the patient.
Use case ends.
Extensions
-
3a. The given index is invalid.
-
3a1. System shows an error message, prompting for a valid index.
Use case resumes at step 2.
-
-
3b. The receptionist did not input any field to edit.
-
3b1. System shows an error message, prompting for at least one field to be edited.
Use case resumes at step 2.
-
Use case: Add allergy to patient
Precondition: Current list of patients is not empty.
MSS
-
Receptionist requests to list all patients in the database.
-
System shows a list of patients registered in the database.
-
Receptionists adds some allergy to a specific patient in the list.
-
System adds the allergy to the patient.
Use case ends.
Extensions
-
3a. The given index is invalid.
-
3a1. System shows an error message, prompting for a valid index.
Use case resumes at step 2.
-
-
3b. The allergy already exists in the patient.
-
3b1. System shows an error message, alerting the receptionist that such allergy already exists in the patient.
Use case ends.
-
-
3c. Receptionist inputs multiple allergy to be added, some of them already associated with the patient.
-
3c1. System will ignore allergy that is already associated to the patient.
Use case resumes at step 4.
-
Use case: Remove allergy from patient
Precondition: Current list of patients is not empty.
MSS
-
Receptionist requests to list all patients in the database.
-
System shows a list of patients registered in the database.
-
Receptionists removes some allergy from a specific patient in the list.
-
System removes the allergy from the patient.
Use case ends.
Extensions
-
3a. The given index is invalid.
-
3a1. System shows an error message, prompting for a valid index.
Use case resumes at step 2.
-
-
3b. The receptionist attempts to remove an allergy that does not exist in the patient.
-
3b1. System shows an error message, alerting the receptionist that such allergy does not exist in the patient.
Use case ends.
-
-
3c. Receptionist inputs multiple allergy to be removed, some of them not associated with the patient.
-
3c1. System will ignore allergy that is not associated to the patient.
Use case resumes at step 4.
-
Use case: Add appointment to patient
Precondition: Current list of patients is not empty, and user is logged in to a staff account.
MSS
-
Receptionist requests to list all patients in the database.
-
System shows a list of patients registered in the database.
-
Receptionists adds some appointment to a specific patient in the list.
-
System adds the appointment to the patient.
Use case ends.
Extensions
-
3a. The given index is invalid.
-
3a1. System shows an error message, prompting for a valid index.
Use case resumes at step 2.
-
-
3b. The appointment already exists in the patient.
-
3b1. System shows an error message, alerting the receptionist that such appointment already exists in the patient.
Use case ends.
-
-
3c. Receptionist inputs multiple appointment to be added, some of them already associated with the patient.
-
3c1. System will ignore appointment that is already associated to the patient.
Use case resumes at step 4.
-
Use case: Remove appointment from patient
Precondition: Current list of patients is not empty and user is logged in to a staff account.
MSS
-
Receptionist requests to list all patients in the database.
-
System shows a list of patients registered in the database.
-
Receptionists removes some appointment from a specific patient in the list.
-
System removes the appointment from the patient.
Use case ends.
Extensions
-
3a. The given index is invalid.
-
3a1. System shows an error message, prompting for a valid index.
Use case resumes at step 2.
-
-
3b. The receptionist attempts to remove an appointment that does not exist in the patient.
-
3b1. System shows an error message, alerting the receptionist that such appointment does not exist in the patient.
Use case ends.
-
-
3c. Receptionist inputs multiple appointment to be removed, some of them not associated with the patient.
-
3c1. System will ignore appointment that is not associated to the patient.
Use case resumes at step 4.
-
Use case: Undo an action
MSS
-
Receptionist executes a command that changes the giatros book state.
-
System commits the change made by receptionist into a new giatros book state.
-
Receptionist decides to undo the action.
-
System reverts the change by returning to the previous giatros book state.
Use case ends.
Extensions
-
1a. Command execution fails due to invalid format.
-
1a1. System shows an error message, along with a hint on how to input the data in the right format.
-
1a2. System does not commit into a new state as there is no change yet, so there is no command to undo if the user insists on undoing.
Use case resumes at step 1.
-
Use case: Redo an action
MSS
-
Receptionist executes a command that changes the giatros book state.
-
System commits the change made by receptionist into a new giatros book state.
-
Receptionist decides to undo the action.
-
System reverts the change by returning to the previous giatros book state.
-
Receptionist decides to redo the action.
-
System reverts the undo by going to the next giatros book state.
Use case ends.
Extensions
-
1a. Command execution fails due to invalid format.
-
1a1. System shows an error message, along with a hint on how to input the data in the right format.
-
1a2. System does not commit into a new state as there is no change yet, so there is no command to undo if the user insists on undoing.
-
1a3. Since there is no commands to undo, the system will show an error message if redo is executed.
Use case resumes at step 1.
-
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 store millions of patients’ information without affecting the performance of the system.
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 contacts. 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.
-
-
Shutdown
-
Test case:
exit
Expected: Exits the application and closes the GUI.
-
F.2. Logging into the application
-
Using the guest account to use the application
-
Test case:
list
,clear
,edit 1 n/Try to Change Name
, etc
Expected: An error will occur. Need to be logged in to execute these commands. -
Test case:
exit
Expected: Exits the application. A guest should be able to exit. -
Test case:
login id/staff pw/1122qq
,login id/MYUSER pq/1122qq
,login id/STAFF pq/1122ww
,login id/STAFF pw/1122q
, etc
Expected: Login failed. Incorrect username and/or password. -
Test case:
login id/STAFF pw/1122qq
Expected: Login successful. Can now execute command as a staff.
-
-
Using the staff account to use the application — should be able to execute all the commands below, except for
register
-
Using the manager account to use the application — should only be able to execute
register
F.3. Adding a patient
-
Test case:
add n/Alex p/WRONG e/a@bc.com a/Anywhere
Expected: An error will occur. Phone number format is invalid. -
Test case:
add n/Alex p/1234 e/WRONG a/Anywhere
Expected: An error will occur. Email format is invalid. -
Test case:
add n/Alex Yeoh p/1234 e/alexyeoh@example.com a/Anywhere
Expected: An error will occur. Such patient already exists. -
Test case:
add n/Alex Yeoh p/1234 e/a@b.com a/Anywhere
Expected: Add successful. Details of the added contact shown in the status message. Timestamp in the status bar is updated.
F.4. Deleting a patient
-
Deleting a patient while all patients are listed
-
Prerequisites: List all patients using the
list
command. Multiple patients in the list. -
Test case:
delete 1
Expected: First patient is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated. -
Test case:
delete 0
Expected: No patient is deleted. Error details shown in the status message. Status bar remains the same. -
Other incorrect delete commands to try:
delete
,delete x
(where x is larger than the list size or negative integer),delete Alex
Expected: Similar to previous.
-
-
Deleting a patient when some patients are listed
-
Prerequisites: Find some patients using the
find
command. Multiple patients in the list. -
Test case:
delete 2
Expected: Second patient is deleted from the found list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated. -
Test case:
delete 0
Expected: No patient is deleted. Error details shown in the status message. Status bar remains the same. -
Other incorrect delete commands to try:
delete
,delete x
(where x is larger than the list size or negative integer),delete Alex
Expected: Similar to previous.
-
F.5. Editing a patient
Prerequisites: List some patients using the list
or find
command. At least one patient in the list.
-
Test case:
edit
Expected: An error will occur. Invalid command format. -
Test case:
edit 1
Expected: An error will occur. At least one field to edit must be specified. -
Test case:
edit 1 n/Alex Tan
Expected: Edit successful. First patient’s name will be updated to Alex Tan. -
Test case:
edit 1 y/
Expected: Edit successful. Clears all the existing allergy of the first patient.
F.6. Adding allergy to a patient
Prerequisites: List all patients using the list
command. Multiple patients in the list.
-
Test case:
addall
,addall 1
Expected: An error will occur. Invalid command format. -
Test case:
addall 1 y/
Expected: An error will occur. Allergy names should be alphanumeric. An empty string is not a valid input. -
Test case:
addall 1 y/amoxicillin
Expected: An error will occur. Amoxicillin is already associated to the first patient. -
Test case:
addall 1 y/ibuprofen
Expected: Add allergy successful. The first patient is now associated with ibuprofen allergy. -
Test case:
addall 1 y/amoxicillin y/aspirin
Expected: Add allergy successful. Amoxicillin is ignored, since it is already associated to the first patient. Aspirin allergy is added.
F.7. Removing allergy from a patient
Prerequisites: List all patients using the list
command. Multiple patients in the list.
-
Test case:
remall
,remall 1
Expected: An error will occur. Invalid command format. -
Test case:
remall 1 y/
Expected: An error will occur. Allergy names should be alphanumeric. An empty string is not a valid input. -
Test case:
remall 1 y/toxin
Expected: An error will occur. Cannot find toxin in the list of allergies for the first patient. -
Test case:
remall 1 y/amoxicillin
Expected: Remove allergy successful. The first patient is now not associated with amoxicillin allergy anymore. -
Test case:
remall 2 y/penicillin y/aspirin
Expected: Remove allergy successful. Aspirin is ignored, since it is not associated to the second patient. Penicillin allergy is removed.
F.8. Adding appointment to a patient
Prerequisites: List all patients using the list
command. Multiple patients in the list.
-
Test case:
addapt
,addapt 1
Expected: An error will occur. Invalid command format. -
Test case:
addapt 1 apt/
Expected: An error will occur. An error will occur. Appointment needs to follow the one of the valid formats: 'yyyy-MM-dd HH:mm:ss', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd HH' . An empty string is not a valid input. -
Test case:
addapt 1 apt/2019-04-01 14:30
Expected: An error will occur. The appointment is already associated to the first patient. -
Test case:
addapt 1 apt/2019-02-29 14:30
Expected: An error will occur. The 29th of Feb doesn’t exist for 2019. -
Test case:
addapt 1 apt/2019-04-01 15:00
Expected: Add appointment successful. The first patient is now associated with 2019-04-01 15:00 appointment. -
Test case:
addapt 1 apt/2019-04-01 14:30 apt/2019-04-01 18:00
Expected: Add appointment successful. The first appointment is ignored, since it is already associated to the first patient. Aspirin appointment is added.See AppointmentTests.java for other examples for other valid/invalid appointments.
F.9. Removing appointment from a patient
Prerequisites: List all patients using the list
command. Multiple patients in the list.
-
Test case:
remapt
,remapt 1
Expected: An error will occur. Invalid command format. -
Test case:
remapt 1 apt/
Expected: An error will occur. Appointment needs to follow the one of the valid formats: 'yyyy-MM-dd HH:mm:ss', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd HH' . An empty string is not a valid input. -
Test case:
remapt 1 apt/2019-12-01 13:30
Expected: An error will occur. Cannot find the appointment in the list of appointments for the first patient. -
Test case:
remapt 1 apt/2019-04-01 14:30
Expected: Remove appointment successful. The first patient is now not associated with 2019-04-01 14:30 appointment anymore. -
Test case:
remapt 2 apt/2019-04-01 14:30 apt/2019-04-01 18:00
Expected: Remove appointment successful. The second appointment is ignored, since it is not associated to the second patient. The first appointment is removed.See AppointmentTests.java for other examples for other invalid appointments.
F.10. Selecting a patient
Prerequisites: List some patients using the list
or find
command. At least one patient in the list.
-
Test case:
select 1
Expected: Selects the first patient in the list. The patient card is highlighted. The google search page of the first allergy in the list will be shown. -
Test case:
edit 1 y/
Expected: Edit successful. Removes all the allergies of the first patient. -
Test case:
select 1
Expected: Selects the first patient in the list. The patient card is highlighted. Since the patient has no allergy, the default page will be shown.
F.11. Undoing an action
Prerequisites: List all patients using the list
command. Multiple patients in the list.
-
Test case:
undo
Expected: An error will occur. No commands to undo. -
Test case:
find Alex
Expected: Find successful. Search result for Alex will be shown. -
Test case:
undo
Expected. An error will occur. No commands to undo as find does not change the state of giatros book. -
Test case:
addall 1 y/benzene
Expected: Add allergy successful. The first patient in the found list will now have a benzene allergy. -
Test case:
undo
Expected: Undo successful. The benzene allergy will be removed and the giatros book reverts to the previous state. -
Test case:
addall 1 y/amoxicillin
Expected: An error will occur. The first patient is already allergic to amoxicillin. -
Test case:
undo
Expected: An error will occur. No commands to undo as the previous step fails to modify the giatros book state due to the addall command failing its execution.
F.12. Redoing an action
Prerequisites: List all patients using the login
and list
command respectively. Multiple patients in the list.
You may need to restart your application if you just finished testing the undo
command.
-
Test case:
redo
Expected: An error will occur. No commands to redo. -
Test case:
addall 1 y/benzene
Expected: Add allergy successful. The first patient in the found list will now have a benzene allergy. -
Test case:
undo
Expected: Undo successful. The benzene allergy will be removed and the giatros book reverts to the previous state. -
Test case:
redo
Expected: Redo successful. The benzene allergy will be added back, reverting the previous undo command. -
Test case:
redo
Expected: An error will occur. No commands to redo.
F.13. Exporting Giatros Book
Prerequisites: Have a non-empty list of patients.
You may need to restart your application if you just finished testing the undo
command.
-
Test case:
export
Expected: Export sucessful. Giatros book csv file located at ~/Downloads. -
Test case:
export d/~/Desktop/Giatros.csv
Expected: Export sucessful. Giatros book csv file located at ~/Desktop. -
Test case:
export d/~/Desktop
Expected: An error will occur. Invalid destination specified. Destination must end in .csv