Skip to content

EHR integration (placeholder). Part of ehr-web-facing.

License

Notifications You must be signed in to change notification settings

kclconsult/ehr-integration

Repository files navigation

EHR (ehr-integration)

Build Status

Middleware designed to interface with the Garmin 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/ehr-integration.git

(Alternative) Clone this repository using HTTPs, suppling username and password:

git clone https://github.kcl.ac.uk/consult/ehr-integration.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

Create an environment file:

touch .env

Add the following information to this environment file using a text editor:

USERNAME="[username]"
PASSWORD="[password]"

Where [username] and [password] are credentials to secure this service.

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 3003. Visit localhost:3003/[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

Different docker-compose files exist to accomodate different service configurations.

Private certificates

To use custom private certificates for communication with this service's proxy, reference them in the proxy's Dockerfile. The gen-domain-cert script can be used to generate custom certs (e.g. 'grey.crt') using a CA root cert (e.g. 'consult.crt') and accompanying keys. If distributing an image outside of an organisation, edit Dockerfile and docker-compose to mount a volume on the host containing the certs instead, so that images are not transferred with the certs inside then.

Public certificates

For public certificates, certificate generation is via LetsEncrypt. Generate as follows:

  1. Remove references to certificates from Nginx HTTPS configuration, as running HTTP server is required for challenge.
  2. Change Cerbot command in docker-compose from --force-renewal to --dry-run.
  3. Build and run, and upon successful call of HTTP challenge, change back to --force-renewal and build and run again in order to generate certificates.
  4. Re-add certificae configuration, build and run.

Renewal can be done on re-build, or by setting up a cron.

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

EHR integration (placeholder). Part of ehr-web-facing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published