Skip to content

Latest commit

 

History

History
114 lines (83 loc) · 5.62 KB

README.md

File metadata and controls

114 lines (83 loc) · 5.62 KB

Real Time FHIR

Real Time FHIR is a simulation architecture that transmits Electronic Health Record data from a data source to a FHIR endpoint in real-time. This project uses a React-based dashboard for simulation control and a Python Flask-based backend for simulation processing. Currently, only NDJSON FHIR resource files are supported.

Getting Started with Real Time FHIR

Installation Instructions

  1. Ensure that you have NodeJS installed (Preferably NodeJS 17.x).
    If not, check out this guide to install NodeJS on your machine: How to install Node.js.
    If you're on Ubuntu, here are some command to install NodeJS 17.x:
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs
  1. Ensure that you have either Yarn or NPM installed.
    If you don't have either, here are some commands to install the latest version of Yarn on Ubuntu:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/sh
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | s
sudo apt-get update && sudo apt-get install yarn
  1. Clone this repo and cd into its root folder.

  2. Run the command yarn install or npm install to download node dependencies, depending on which package manager you have installed.

  3. cd into the /api folder to set up a Python virtual environment and install Python dependencies. Before following the commands below, ensure you have Python3 and pip installed! cd back to the root folder after installation.

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cd ..
  1. Refer to the section below to configure environment variables before starting the app. The easiest way to do this is to create a .env file in the root folder.

  2. To start the app, run ./run-api.sh and ./run.sh in two different terminals.


Configuring environment variables

Before usage, there are a few environment variables that requires configuration. Some are required to be configured while some are optional:

General environment variables (.env)

Required

ENDPOINT_URL - URL of simulation destination endpoint.
REACT_APP_BACKEND_PORT - Port in which the Flask-based backend runs on. This value must be the same as FLASK_RUN_PORT in Flask environment variables.

Optional

PORT - Port of which React runs on. If not specified, React will run on port 3000 by default.
TOKEN_URL - URL of token endpoint to request client credentials access token. Do not specify if endpoint does not require authentication.
CLIENT_ID - Client ID of endpoint.
CLIENT_SECRET - Client Secret of endpoint.
SCOPE - Scope of access token.


Flask environment variables (api/.flaskenv)

Required

FLASK_APP - Main script for Flask app to be run on. By default, set value to api.py.
FLASK_RUN_PORT - Port of which Flask runs on. This value must be the same as REACT_APP_BACKEND_PORT in General environment variables.


Usage

Simulator

image There are three components in the simulation interface:

  1. Input fields allows specification of resource type and duration as parameters of the simulation. By default, resource type and duration will be set to DiagnosticReport and 60 seconds respectively.
  2. Simulation attributes displays both static and actively-changing simulation details such as timeline duration, time elapsed, events sent, upcoming events etc.
  3. Event table displays events that has been successfully received by the endpoint.

Simulation steps:

  1. Ensure that connection to the set endpoint is successful by viewing the pop-up notification on the bottom left whenever you refresh the page.
  2. Before starting the simulation, set the resource type and duration input fields to your desired values.
  3. Click on the "Start Simulation" button to start the simulation.
  4. To stop the simulation midway, click on the "Stop Simulation" button. Otherwise, the simulation will stop once all events are sent to the endpoint.
  5. To start a new simulation, click on the "Reset Simulation" button to reset all values.

Resource

image To fetch a resource, specify the resource type and additional parameters (optional) in the input fields, then click on the "Fetch Resource" button. Resource entries will be displayed in the resource table below.

Using your own FHIR resource files

  1. Remove all the files in api/input before adding your own files.
  2. Add your NDJSON FHIR resource files (and JSON files for FHIR references, if there are any) to api/input.
  3. If necessary, add additional resources types to src/components/assets/resources-synthea.json if they are not present already.

Note: In a simulation, Real Time FHIR will bundle a resource together with all its references. In the case where a reference cannot be found, an error will occur and the simulation will fail.

Real-Time FHIR is copyright © 2022, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230. Licensed under the CSIRO Open Source Software Licence Agreement.