This subproject contains a SMART on FHIR app, which provides a standardized way to interact with FHIR servers. This Reference Impementation (RI) supports the Documents Templates and Rules (DTR) IG which specifies how payer rules can be executed in a provider context to ensure that documentation requirements are met. This RI and IG are companions to the Coverage Requirements Discovery (CRD) IG and Coverage Requirements Discovery (CRD) RI.
You can find a complete end-to-end set up guide for DRLS, including DTR, here.
If you are running DRLS for the first time, we highly recommend you refer to our comprehensive setup guide for instructions on how to install DTR. Once you have DRLS up and running, you can return here to find more detailed information about how DTR works.
Install node.js.
- Clone the repository
git clone https://github.com/HL7-DaVinci/dtr.git
- In a terminal, navigate to the directory the project was cloned into
- Run
npm install
- To Run:
- dev:
npm start
- production:
npm run startProd
- dev:
The service will run on port 3005. This can be changed in package.json
and the configuration file for the desired version. The dev version is configured with webpack.config.js
and does not use https
by default. The production version is configured through webpack.config.prod.js
and does use https
by default. This can also be changed in the desired config by changing the https
boolean. There is currently no redirection between https
and http
, so using the wrong scheme in the url will result in an empty response.
Once the app is up and running you can launch it manually by visiting the launch page and including the two required parameters:
Param | Description |
---|---|
iss |
The base URL of the FHIR server |
launch |
The unique ID for this launch |
The FHIR server must properly comply with the SMART on FHIR specification and have a conformance statement with a security
section that contains the authorization endpoints that the app needs to request a token from.
For example, http://localhost:3005/launch?iss=http://launch.smarthealthit.org/v/r2/fhir/&launch=1234 is an example of a valid launch url that will successfully launch the app. Note that the launch id is generally not something the user defines themselves, but rather is generated by the EHR and is automatically appended to the url parameters as part of the launch sequence when clicking on a SMART link.
The app can be launched standalone by omitting a launch id. Unlike an EHR launch, standalone launches can be initiated outside of an EHR context and don't require the generation of a launch id. Simply navigate to the launch url and include the iss
parameter to initiate a standalone launch.
An example url that launches the standalone app is http://localhost:3005/launch?iss=http://launch.smarthealthit.org/v/r2/fhir/. When the app is launched standalone, it authenticates against the EHR referenced by the iss
, but does not have any context such as patient ID or device request. Instead, the app will allow the user to select a patient from a list if that patient has an outstanding in-progress questionnaire available. If there are no in-progress questionnaires in the EHR, the standalone launch cannot proceed.
It is recommmended when first starting out you have all five applications running (CRD Request Generator, Test EHR (FHIR) Server, CRD Server, DTR Server, and KeyCloak Server) to test the full SMART on FHIR App launch sequence. After getting these applications up and running you can swap in your appliaction if desired.
Note: If you have your own EHR then you should not need to run the EHR (FHIR) Server, KeyCloak and the Request Generator. Otherwise please follow the below steps.
Steps to prepare local EHR server, Keycloak server, and Request Generator:
-
Remove the target folder (if it exists) in the Test EHR server folder.
-
Start the Test EHR server, by running
gradle appRun
. -
Make sure the Test EHR server has the data it needs, by running
gradle loadData
to populate it. -
Then, run the KeyCloak server. Follow the guide in the CRD readme if you have never set it up before, make the appropriate realm/client/user.
-
Then run the CRD server, DTR server, and CRD Request Generator.
Note: The DTR app's authorization against the EHR server requires a
client_id
that is registered with the auth server of that EHR to work. The DTR app has a/register
endpoint that allows user entry of whichclient_id
to use for a specific EHR server. If following the KeyCloak guide provided in the CRD readme, the client would be calledapp-login
.
Test it!
Assuming you have completed the above. You should be able to send a request from the CRD Request Generator in order for the SMART app to launch by clicking the
Patient Select:
button to pre-populate the inputs. Choose aDevice, Service, or Medication Request
from the drop-down for one of the patients, then click anywhere in the row corresponding to the patient for whom you selected aDevice, Service, or Medication Request
. The data will be prefetched and you can send the request by pressing theSubmit
button. You should get a CDS Hooks Card back. Click the SMART link button forOrder Form
and you should see a login screen. Login with whatever user you've registered, and the SMART App should proceed to launch.
This project is licensed under the Apache License 2.0. See LICENSE for more details.