Git Product home page Git Product logo

smart-on-fhir's Introduction

smart-on-fhir

Open-source FHIR Server to support patient- and clinician-facing apps.

Still highly experimental, but has limited support for:

  • GET, POST, and PUT resources
  • transaction (POST a bundle of resources)
  • Search resources based on FHIR's defined search params

Live demo: API | Apps

Installing

Prerequisites

  • Download and install Grails 2.2.4
  • Install MongoDB (locally or use a remote service)

Run it (using default config)

$ git clone https://github.com/jmandel/smart-on-fhir
$ cd smart-on-fhir
$ grails run-app

Configuring

Key settings files are:

grails-app/conf/Config.groovy

  • Turn authentication or off with fhir.oauth.enabled: true | false
  • Configure authentication with fhir.oauth

grails-app/conf/DataSource.groovy

  • Configure your MongoDB location with grails.mongo

Using

Add new data to the server via HTTP PUT or POST. For example, with default authentication settings and a server running at http://localhost:8080, you can add a new Diagnostic Order via:

curl 'http://localhost:8080/diagnosticorder/@example' \
     -X PUT \
     -H 'Authorization: Basic Y2xpZW50OnNlY3JldA=='\
     -H 'Content-Type: text/xml' \
     --data @grails-app/conf/examples/diagnosticorder.xml

And then you can retrieve a feed of diagnostic orders via:

curl 'http://localhost:8080/diagnosticorder/search' \
     -H 'Authorization: Basic Y2xpZW50OnNlY3JldA=='

or fetch a single resource as JSON via:

curl 'http://localhost:8080/diagnosticorder/@example' \
     -H 'Authorization: Basic Y2xpZW50OnNlY3JldA==' \
     -H 'Accept: application/json'

Getting more sample data

You can load sample data from SMART's Sample Patietns:

$ sudo apt-get install python-jinja2
$ git clone --recursive https://github.com/chb/smart_sample_patients
$ cd smart_sample_patients/bin
$ git checkout fhir
$ python generate.py --write-fhir ../generated
$ ls ../generated # a bunch of XML files

Loading these files into your system

cd ../generated
for i in *.xml; do 
   curl 'http://localhost:9090/?' 
        -H 'Content-Type: text/xml'
        --data-binary @$i; 
done

Storing Documents + DocumentReferences

There's very rudimentary support for adding C-CDA documents to the server, with a client-side loader script. The loader will:

  • Store the raw content of your C-CDA
  • Create a FHIR DocumentReference for your C-CDA, with a location pointing to the raw content.
  • Create an empty patient if needed

Here's how to invoke it (note the awkward use of environment variables to pass arguments):

BASE_URL="http://localhost:8080" \
CLIENT_ID=client \
CLIENT_SECRET=secret \
PATIENT_ID="1234" \
CCDA="grails-app/conf/examples/ccda.xml"\
grails run-script scripts/LoadCCDA.groovy

smart-on-fhir's People

Contributors

jmandel avatar

Watchers

Ryan Gross avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.