/meteor-on-fhir

Meteor using Fast Healthcare Interoperability Resources (FHIR)

Primary LanguageObjective-CGNU Affero General Public License v3.0AGPL-3.0

Meteor on FHIR

For my Masters of Science in Biomedical Informatics, we are required to create a Capstone Project. So I decided to write a Health Information Exchange infrastructure. The technical infrastructure uses MongoDB (a modern hierarchical database, similar to the MUMPS/Cache database what Epic uses), a full-stack isomorphic javascript framework called Meteor, and Facebook's user interface layer React. The HIE uses a wordpress business model, and is intended to be a distributed and federated peer-to-peer network. We use HL7 Fast Healthcare Interoperability Resources (FHIR) for data exchange and interoperability.

NOTE: We have recently refactored the codebase. We removed a ton of clutter, stale prototypes, dead code, and binary files that were tying Meteor on FHIR to Mac/Linux. Meteor on FHIR should now run on Azure, and is configured as a community build by default. You may notice some missing functionality, such as theming, geomapping, timelines, and other features. Please contact demos@symptomatic.io if you need access to those features.

CircleCI

https://github.com/clinical-meteor/meteor-on-fhir/blob/master/media/screenshot-1.png

Yes, the above is a live screenshot of the app, which supports a theming engine and an augmented reality interface.

A. Installation

# get the application
git clone http://github.com/clinical-meteor/meteor-on-fhir

# move into the webapp directory
cd meteor-on-fhir/webapp

# clone the example plugin
git clone http://github.com/clinical-meteor/example-plugin packages/example-plugin

# install the example plugin
meteor add clinical:example-plugin

# install the app
meteor npm install

B. Running Local

## general development
meteor --settings configs/settings.blank.canvas.json

C. Install Test Data

# install sample doctors and nurses
meteor add clinical:accounts-housemd

# run with initialization variables
INITIALIZE=true Patients=true Practitioners=true meteor

D. Theme and Remove Licensed Media Assets

Edit the settings.dev.json file, and update:

{
  "public": {
    "title": "Rainbow's End Nursing Home Health Exchange",
    "theme": {
      "backgroundImagePath": "/backgrounds/medical/Gradient.jpg",
      "backgroundColor": "#34B6C2",
      "palette": {
        "colorA": "#34B6C2",
        "colorB": "#177AB9",
        "colorC": "#31323C",
        "colorD": "#710A4A",
        "colorE": "#FFFFFF"
      }
    },
    "meshNetwork": {
      "upstreamSync": "http://meteor-on-fhir.meteorapp.com/fhir-3.0.0", 
      "autosync": false
    }    
  },
  "private": {
    "practitionerAccessCode": "practitionerAccessCode",
    "sysadminAccessCode": "sysadminAccessCode"
  },
  "galaxy.meteor.com": {
    "env": {
      "MONGO_URL": "mongodb://username:password@mlab.com:25389/my-org-exchange-db",
      "NODE_ENV": "production"
    }
  }  
}

Run the script to remove restricted media assets:

scripts/remove_restricted_media_assets.sh

E. Desktop Build

 # build the executables and add them into the /public directory
meteor add-platform ios
meteor add omega:meteor-desktop-watcher@=0.11.1 omega:meteor-desktop-bundler@=0.11.1 omega:meteor-desktop-localstorage@=0.0.11

# install meteor-desktop / electron
meteor npm install --save meteor-desktop

# add the .desktop directory, which has files needed by omega:meteor-desktop
npm run desktop -- init

# if there is already a desktop directory, move it to the .desktop dir
# this will override the previous step
mv webapp/desktop webapp/.desktop


# run the app server locally, as if you were doing a mobile build
# (you may be able to just use the running mobile build server)
NODE_ENV=dev meteor --mobile-server http://localhost:3000 --settings configs/settings.galaxy.json

# then to run the desktop app locally...
# npm run desktop

# or try the shortcut script
# meteor npm run-script desktop

# If you want to build a production release, that connects to the main server, you'll need to specify a different URL
# meteor --mobile-server http://www.symptomatic.io --settings configs/settings.galaxy.json
# npm run desktop -- build-installer http://www.symptomatic.io

meteor --mobile-server https://meteor-on-fhir.meteorapp.com --settings packages/landing-page/configs/settings.symptomatic.io.json
meteor npm run desktop -- build-installer http://meteor-on-fhir.meteorapp.com

F. Deploy to Galaxy

# remove the desktop pipeline before building for Galaxy
mv webapp/.desktop webapp/desktop
git commit -a -m 'desktop' 

meteor reset
meteor remove-platform ios
meteor remove omega:meteor-desktop-watcher omega:meteor-desktop-bundler omega:meteor-desktop-localstorage
meteor npm remove meteor-desktop
rm -rf node_modules
rm -rf .desktop-installer
meteor npm install

# upload to Galaxy
TIMEOUT_SCALE_FACTOR=10 DEPLOY_HOSTNAME=us-east-1.galaxy-deploy.meteor.com meteor deploy --settings configs/settings.galaxy.json meteor-on-fhir.meteorapp.com

G. Azure Configuration

az webapp deployment user set --user-name admin --password password
az appservice list-locations
az group create --name appName --location 'Central US'
az appservice plan create --name appServicePlan --resource-group appName --sku S1 
az webapp create --resource-group appResourceGroup --plan appServicePlan --name appname 

H. Azure Deployment

# prepare environment variables
export METEOR_SETTINGS="$(cat ../../webapp/packages/example-plugin/configs/settings.blank.json )"
export ROOT_URL=https://appname.azurewebsites.net
export MONGO_URL=mongodb://user:password@cosmodb.documents.azure.com:10255/?ssl=true

# Now that Azure is configured, go to application
cd webapp/packages
git clone https://github.com/clinical-meteor/example-plugin
cd webapp

# stringify the settings.json file; and add to Azure METEOR_SETTINGS
cat packages/example-plugin/configs/settings.json | tr -d ' ' | tr -d '\n'

# add required packages
meteor add clinical:example-plugin

# remove unnecessary packages
meteor remove-platform ios

# run local production build
npm install
node start

# meteor-azure
meteor-azure --settings packages/example-plugin/configs/settings.blank.json

# debugging
curl -u admin https://appname.scm.azurewebsites.net/api/logstream
curl -u admin https://appname.scm.azurewebsites.net/api/logstream
curl -u admin https://appname.scm.azurewebsites.net/api/logstream/application
curl -u admin https://appname.scm.azurewebsites.net/api/logstream/kudu/deployment

I. Synchronizing With Other Datalakes

To enable network synchronizing, you'll need to specify an upstream sync partner in your settings.json file. Afterwards, you can enable manual synchronization in the *Data Management page.

{
  "public": {
    "meshNetwork": {
      "upstreamSync": "http://meteor-on-fhir.meteorapp.com/fhir-3.0.0", 
      "autosync": false
    },
  }
}

J. Connect to an External EMR

HL7 v2 to FHIR Interface Mapping

Trouble Shooting

# Browser ERROR: 404 "/example-route" does not exist
# A quick fix is edit the "route" to "/hello-world" in the webapp/packages/example-plugin/configs/settings.example.json 
# "defaults": {
#       "route": "/hello-world",
#       ...
#       }

# ERROR: Failed to connect to 127.0.0.1:27017
# You may need to restart mongod with the correct dbpath. Example:  
mongod --dbpath ~/meteor-on-fhir/webapp/packages/example-plugin/data

Miscellaneous References

Supporting Interoperability – Terminology, Subsets and Other Resources from Natl. Library of Medicine
Health IT Standards for Health Information Management Practices