Middleware designed to interface with the Vitalpatch API.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Before starting, download and install python, pip, virtualenv and Node.js.
Sends messages to: sensor-fhir-mapper (install).
(Recommended) Create an SSH key and clone this repository.
git clone git@github.kcl.ac.uk:consult/device-integration_vitalpatch.git
(Alternative) Clone this repository using HTTPs, suppling username and password:
git clone https://github.kcl.ac.uk/consult/device-integration_vitalpatch.git
Configure submodules:
git submodule init
git submodule update
View.
This is an express (lightweight server) project. The majority of the logic is contained within app.js, and in the routes and lib folders.
Once a file is edited, stage, commit and push changes from the root folder as follows:
git add .
git commit -m "[details of changes]"
git push
Modify config/default.js
to include the address of the sensor-fhir-mapper service:
SENSOR_TO_FHIR_URL: '[sensor-fhir-mapper service]'
If using a queue, also specify this in the config file, and supply the queue name.
Create an environment file:
touch .env
Add the following information to this environment file using a text editor:
USERNAME="[username]"
PASSWORD="[password]"
VITALPATCH_LICENSE_KEY="[keyA]"
VITALPATCH_API_KEY="[keyB]"
Where [username] and [password] are credentials to secure this service, and [keyA] and [keyB] are your Vitalpatch details.
Setup db encryption keys in db
.
Ensure you are in the root folder. Create a node virtual environment (within a python virtual environment), and activate it:
virtualenv env
. env/bin/activate
pip install nodeenv
nodeenv nenv
. nenv/bin/activate
Install dependencies:
cat requirements.txt | xargs npm install -g
Run server:
npm start
The server runs by default on port 3008. Visit localhost:3008/[route] to test changes to GET endpoints and use software such as Postman to test changes to POST (and other) endpoints.
Run both unit and lint tests using npm
:
npm test
Deployment is via Docker, and includes containers for this application, a production SQL database and an optional reverse proxy. If using the reverse proxy, fill in the appropriate configuration.
Build these containers:
docker-compose build
Run these containers:
docker-compose up
(Optional) Run without proxy:
docker-compose up --scale proxy=0
- Express - Web framework.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Produced as part of the CONSULT project.
This project is licensed under the MIT License - see the LICENSE.md file for details.