FHIR Module
  • 01 Jul 2022
  • 6 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

FHIR Module

  • Dark
    Light

FHIR Module Overview

The Fast Healthcare Interoperability Resources (FHIR) Module allows Decisions to integrate with the FHIR API. Developed by HL7 Inc., FHIR is a standard for electronic healthcare data exchange that was designed based on REST web services. The FHIR Module provides users with pre-built Flow steps that can help users to access and manipulate FHIR data objects.

For more information on FHIR, its mission, and other details, visit http://www.hl7.org/Special/committees/fiwg/overview.cfm and https://www.hl7.org/fhir/overview.html.
Prerequisites:
The FHIR Module currently supports FHIR STU 3. To learn more, see https://www.hl7.org/fhir/stu3/


FHIR StepInputOutput
Add Resource to BundleFHIR Bundle, Resource to AddFHIR Bundle (with the added resource)
Cast FHIR Resource to FHIR TypeFHIRTypeName - predefined list of resource types, FHIR ResourceFHIR Resource Result - Resource of a given type
For Each Resource in FHIR BundleFHIR BundleCell
Get Json ForFHIRBundle, FHIRObject, FHIRResourceThis takes in FHIR objects (bundle or resource) and converts data into JSON
Get Resources from BundleFHIR BundleResources List
Read JSON and Cast to FHIR TypeJSON String - describing a ResourceFHIR Resource Result - Resource of a given type
Read Bundle From JSONDataJSON String - describing a BundleFHIR Bundle
Read Resource From JSONJSON String - describing a ResourceFHIR Resource

What are FHIR Objects?

Example A

This example will demonstrate how to pull a patient’s data from an FHIR bundle resource (in this case the bundle type is a transaction) and then check if the patient is older than 18 years. The input of this Flow will be a JSON string describing a transaction that has a patient resource. The JSON file used in this example can be downloaded below.

   Bundle JSON  

  1. In a Designer Project, click CREATE FLOW, select Default under Flow, and click CREATE. Name the Flow and select CREATE.
  2. In the Flow Designer, add a Create Data step from the Steps panel to the Done path of the Start step.
  3. With the Create Data step selected, click Show Editor under the Data category on the Properties panel
  4. In the Data Definitions window, enter "BundleJSON" in the Name field and select String [Text] as the Type. Click Edit under Input and select input mapping to Merge Plain Text. Paste the JSON string describing a Bundle into the Merge Text Editor. Click CLOSE to save.
  5. From the Done path, add a Read Bundle from JSONData step from the Integration > FHIR category. Select Unknown next to the Json FHIRDATA field under the Inputs category on the Properties panel and click Select From Flow. Select Bundle JSON and click DONE.
  6. From the Done path add a Get Resources from Bundle step by navigating to Integration > FHIR.  Under the Inputs category, select Unknown next to the FHIRBundle field and choose Select From Flow. Select ReadBundleFromJSONData1_Output and click DONE.
  7. From the Done path, add a Cast FHIR Resource to FHIR Type step by navigating to Integration > FHIR. Under the Settings category on Properties panel, enter "patient" in the FHIRTypeName field. Select Unknown next to FHIR Resource and click Select From Flow. Click Resource List, select Last, and click DONE.
  8. On the Done path, add a Parse Date step by navigating to Data > Dates. Select Unknown next to the Date field and chose Select From Flow. Click FHIR Resource Result, select BirthDateElement, and click DONEThe Parse Date step will convert BirthDateElement to a DateTime type that can be used as input.
  9. On the Done path of the Parse Date step, add an Add Years step from the Data > Dates category. For the Source Date field, choose Select From Flow and map in ParseDate_Output. Set input mapping for Years to Constant and enter "18".
  10. Add a Run Rule step from the Rulescategory in the Steps panel to the Done path of the Add Years step to check if the patient is older than 18 years. Configure the Rule to evaluate if the given input of plus18years is less than or equal to the current date. Then, click Save to save the Rule and click Close to return to the Flow Designer.
    Learn more about creating a Rule at Creating a Rule.


  11. For the input of the Rule, chose Select From Flow and map AddYears_Output. Connect the Incorrect Type path to the End step.
  12. For this example, add a Show Popup step to the Fase path (Child) and another Show Popup step to True path (Adult). Connect the Done paths of the two Show Popup steps and the Incorrect Type path of the Read JSON and Cast to FHIR Type step to the End path. Click Save to save changes to the Flow.


Debug

  1. For example purposes, two Show PopUp steps were added to the True/False paths to show if the patient is a child or an adult. Select Debug to run the Flow in the debugger.
  2. In this example, the birthdate of the patient is 12/25/2000 meaning the patient is older than 18 and should follow the True path.
    2019-12-05_113058.PNG

Example B

In this example, a Flow will take in JSON of a Resource Patient and pull a contact’s email address and send an automated email to someone in the patient’s listed contacts.

In the Patient Json file find the Patient.contact.telecom element in the file below then locate the email of the contact. The email is currently set to ‘example@email.com’ and will need to be changed for purposes of testing sent emails.

The JSON file used in this example can be downloaded below:

   Patient JSON  

  1. In a Designer Project, click CREATE FLOW, select Default under Flow, and click CREATE. Name the Flow and select CREATE
  2. In the Flow Designer, add a Create Data step from the Steps panel to the Done path of the Start step.
  3. Set Name to "PatientJSON" and Type to "String". Select input mapping to Merge Plain Text and input JSON string describing a Patient.
    2019-12-05_113420.PNG
  4. Add the step to read the JSON string and allow us to get data from FHIR Resource Type. From the Done path add a Read JSON and Cast to FHIR Type step from the Integration > FHIR category in the Steps panel. Select "Patient" for FHIRTypeName and choose Select From Flow to input PatientJSON.
    2019-12-05_113456.PNG
  5. On the Done path, add a Send Email step from the Favorite Steps category.
  6. Pull the email of the patient’s contact from the FHIR Resource Result output. For Email > To choose Build Array and Select From Flow and map FHIR Resource Result.Contact.First.Telecom.AllValue.First.
    Data from FHIR Resource Result can be used in the Subject and Body inputs.


    2019-12-05_113819.PNG

    2019-12-05_113638.PNG

  7. Connect the remaining outcome paths to the End step. Save the Flow.
  8. After running the debugger, the following email will be received.
    2019-12-05_114911.PNG


Example C

This example will demonstrate how to take in an FHIR Bundle and use the For Each Resource in the FHIR Bundle step to cast FHIR Resources to their proper resource type. The JSON file used in this example can be downloaded below:


  1. In a Designer Project, click CREATE FLOW, select Default under Flow, and click CREATE. Name the Flow and select CREATE.
  2. On the Start step, create a string type for JSON Bundle data and input the JSON file content.
  3. Add the Read Bundle from JSONData step to the Start step. Select Unknown from next to the Json FHIRData field and select Select From Flow. Select JSONBundle and click DONE.
  4. Add the For Each Resource in FHIR Bundle step to loop through each resource in the bundle. Select ReadBundleFromJSONData1_Output from the Flow for the FHIR Bundle field.
  5. Add a String Match Step to the Next path to sort/map Resources to their proper type. In this example, the resource types expected are Patient and Organization. Map the String to Match input field to Next Resource.ResourceType.
  6. Add a Cast FHIR Resource to Type step for each Resource Type. Then, set the FHIR Resource field input to Next Resource and update the output results for each Resource. Connect the Done path to the End step. Connect the Incorrect Type and Done paths from the Cast FHIR Resource to FHIR Type to the For Each Resource in FHIR Bundle step. Click Save to save Flow.

Was this article helpful?