{{announcement.body}}
{{announcement.title}}

Sending HL7 Message to Azure FHIR API Using Mule

DZone 's Guide to

Sending HL7 Message to Azure FHIR API Using Mule

In this tutorial, we take a look at working with HL7 messages and sending them to the Azure API, as well as configuring the API for FHIR.

· Integration Zone ·
Free Resource

This document demonstrates how to:

  • Work with HL7 messages
  • Sending HL7 message to Azure API for FHIR
  • Configuring the Azure Service bus
  • Configuring Azure API for FHIR

Technologies Used:

  • Azure Service Bus (use of ACK and NACK Mule3 connectors)
  • Azure API for FHIR
  • Anypoint Studio Mule3 Runtime
  • HL7 EDI Connector from Anypoint Connectors Update Site

Architecture

Alternative


  1. HAPI Test Panel sends the message to MuleSoft.
  2. MuleSoft sends the same message to Azure Service Bus Queue.
  3. MuleSoft reads the message from Azure Service Bus Queue and sends it to Azure API for FHIR appropriately after converting it to FHIR format.

Configuring HAPI Test Panel

Clicking the Test -> ‘Populate TestPanel with Sample Message and Connections’. It will create a localhost connection.

Populate TestPanel

Populate the port number on which the HL7 Mule Connector is configured to run.

HAPI Test Panel Configuration

Mule3 HL7 MLLP Connector

Detailed Implementation and Commentary on the implementation flow.

Implementation flow


Once the HL7 message sent from HAPI Test Panel, it will be received on the HL7 MLLP Listener as shown in the above ‘test-healthcareFlow’ flow.

In the first flow i.e. ‘test-healthcareFlow’ is then further checking whether the element that we need to work upon inside the HL7 message is present in the HL7 message or not. The above choice router is checking if the HL7 message contains the PID or not. If we won’t get the PID inside HL7 message, the NACK i.e. negative acknowledgment will be sent back to HAPI Test Panel.

No errors

If the choice router gets the PID inside HL7 message, HL7 message will be sent to Microsoft Azure Service Bus and a success acknowledge will be sent to HAPI.

Success message


NOTE: Creating the Microsoft Azure Service Bus and Queue is described below in separate section.

In the second flow i.e. ‘test-healthcareFlow1’, Microsoft Azure Service Bus (Streaming) connector is consuming the previously saved message in queue. The message would be in HL7 format and we first need to transform it to XML format. This transformation is done through out of the box Mule3 HL7 Encoding Transformer component.

We further need to transform the resultant XML into JSON before sending it to Azure API for FHIR because Azure API for FHIR only takes the JSON as input.

NOTE: Creating the Azure API for FHIR is described below in separate section.

Once the JSON message sent to Azure API for FHIR, we can check it via Postman.

NOTE: Configuring the Postman to fetch data from Azure API for FHIR is described below in separate section.

Creating the Microsoft Azure Service Bus and Queue

After login into the Azure Portal, click on create a resource as follows.

Create a resource

Search Service Bus as follows and click on it.

Service bus


Click on Create button.

Create


Select an appropriate subscription, resource group and enter the name of Service Bus.

Click Review + Create button to review and create the Service Bus.

Review + create


After creating the Service Bus, we need to enable Shared access policies. Click on the Shared access policies inside the newly created Service Bus and add RootManagedSharedAccessKey. It’s a default access policy and we just need to add it to the Service Bus.

Added to service bus


Here you will see all the connection details that need to enter while connecting the Mule3 flow to this Service Bus.

Connection details


Now the Service Bus has been created, we can create a Queue inside it.

Click on the Queue button to create Queue inside the Service Bus.

Click queue button


Fill up the required details for creating the Queue.

Create queue

A queue has been created inside the Service Bus.

Queue inside service bus

Creating the Azure API for FHIR

Again, click on create a resource and search for Azure API for FHIR as follows.


Create Azure API for FHIR


Click on Create button.

Create button


Select an appropriate subscription, resource group and enter the n.

Click Review + Create button to review and create the Service Bus.

Service bus


Once the Azure API for FHIR is created, you will see its endpoint as follows:

Endpoint

We need to assign the Read and Write Roles to Azure API for FHIR by clicking on the Access control (IAM).

Assign read and write roles


Click on Add button and add Read and Write roles to Azure API for FHIR as follows.

Add button



Configuring the Postman to Fetch Data From Azure API for FHIR

A detailed tutorial has been provided on below location.

https://docs.microsoft.com/en-gb/azure/healthcare-apis/access-fhir-postman-tutorial

In addition to this tutorial, the following are the things need to be documented:

The Tenant ID or Directory ID, Client ID, and Client Secret can be obtained after following the above tutorial and creating a new app registration.


Topics:
azure api, azure service bus, hl7 messages, integration, mule 3

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}