Skip to content

Middleware designed to interface with the Vitalpatch API. Part of device-web-facing.

License

Notifications You must be signed in to change notification settings

kclconsult/device-integration_vitalpatch

Repository files navigation

Vitalpatch (device-integration_vitalpatch)

Build Status

Middleware designed to interface with the Vitalpatch API.

Getting Started

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.

Prerequisites

Before starting, download and install python, pip, virtualenv and Node.js.

Other service communication

Sends messages to: sensor-fhir-mapper (install).

Download

(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

Documentation

View.

Editing

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

Configuration

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.

Running

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.

Running the tests

Run both unit and lint tests using npm:

npm test

Deployment

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

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Produced as part of the CONSULT project.

CONSULT project

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

About

Middleware designed to interface with the Vitalpatch API. Part of device-web-facing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published