The /lightning folder contains a working demo (running at app.openfn.org) that
receives data from CommCare, validates it, loads it to DHIS2, converts it to
fhir, and sends it to two FHIR backends (HAPI and a Google FHIR api.)
flowchart TD
    c([CommCare or another CHW tool]) -.->|a form is submitted| o((Webhook Trigger))
    subgraph OpenFn
    o --> v[Validate Form]
    v --> d[Create dhis2 TEI]
    v --> f[Convert to FHIR]
    f --> h[Send to HAPI]
    f --> g[Send to Google API]
    end
    h --> hd[(HAPI FHIR Instance)]
    g --> gd[(Google FHIR Store)]
    d --> dd[(DHIS2 Instance)]
    You can run the whole workflow offline using
openfn -ia ./lightning/workflow.json
A demo of OpenFn Microservice, OpenHIM and HAPI FHIR using Instant OpenHIE.
It contains a custom instant config (in openfn/) which loads everything.
The microservice project.yaml file is located here:
openfn/docker/config/project.yaml.
Using the example payload commcare_sample.json we send that to the configured OpenFn Microservice.
Microservice is configurated to run a job based on the shape of the incoming payload see project.yaml.
The job commcare-to-him will match against this message and will be invoked
performing the following actions:
- creates a payload in the FHIR standard containing
- a Encounter resource that contains (
containedresource field) a Paitent resource 
 - a Encounter resource that contains (
 - sends the payload to OpenHIM
 - which in turn sends the payload to HAPI FHIR
 
npm install -g yarn
yarn
yarn setup
The setup step will take a while, so grab a coffee.
yarn test
When testing this locally, you probably will at some point will want to take everything down and start over; this can be achieved like this:
(cd instant && yarn docker:instant destroy core openfnHimHapi --custom-package="../openfn")
- The HAPI FHIR service runs on port 
3447 - The OpenHIM channel that we go through is on port 
5001.
The API is identical, with the exception of a requiredAuthorizationheader.