Patients can be assigned one or more snap40 devices to monitor their vital signs. These assignments are tracked in a relational database.
An assignment's state is tracked by the openedTime
attribute, which is set on insert, and closedTime
attribute,
which is set when the assignment is complete. An assignment is considered active if closedTime
is null.
Once an assignment is opened for a patient, devices can be added to, and removed from, the assignment.
Over time a device will be assigned several patients, however it can only be assigned to one patient at a time. A device's
assignment state is tracked by assignedTime
, which is set when the device is attached to an assignment. The unassignedTime
is set when the device is unassigned from a patient, and therefore available to be assigned to another patient. A device is
considered in use if the unassignedTime
is null.
-
Create an assignment. As a health professional I want to register a patient to be monitored with a snap40 device.
-
Add a device to an assignment. As a health professional I want to register a device as in use with a patient so that any vital sign data generated by the device is associated with that patient.
-
Remove a device from an assignment. As a health professional I want to de-register a device from a patient's assignments so that any new data generated by the device is not attributed to that patient.
-
Find an assignment by ID. As a health professional I want to see all the devices that are assigned, or have been assigned to the the assignment record with a given ID.
-
Find all assignments for a patient. As a health professional I want to see all the devices that are assigned, or have been assigned to a patient.
-
Find all assignments for a device. As a health professional I want to see the assignment record that the device is currently assigned to.
The source code of this exercise contains a skeleton implementation of typical Spring Boot application with a service interface, data model and repositories to access the model.
The project includes a simple Docker container with a Postgres database preconfigured. Docker for Windows, Linux or Mac can be downloaded and installed from https://store.docker.com/search?type=edition&offering=community. The Postgres database Docker container can be started with the following commands:
cd <project root>/docker
docker-compose up -d
The skeleton application is pre-configured to connect to this database instance.
The project is built using gradle. The application can be run from gradle using the following commands:
cd <project root>
gradle bootRun
- Clone the exercise's repository from GitHub - https://github.com/snap40/CodingAssignment.
- Code the
DefaultAssignmentService
class to implement the stories listed above. - Add any necessary Spring annotations and configuration required for a fully working solution capable serving multiple concurrent clients.
- Add JPA annotations that will ensure data integrity and optimise data access. Bear in mind that, over time, the database will grow and that data access performance must not be adversely affected.
- Provide unit and integration tests to prove your solution works.
- Provide an implementation of a REST API for the
AssignmentService
. - Extra dependencies can be added to the gradle build script as required.
- How would the application change if patients were grouped and managed by an organisation (identified by an organisation ID)?
- How would you secure patients' data from access by someone in a different organisation?
- What activity should be audited and how could this be implemented?