HL7v2 Healthcare Integrations with đź«Ź Mulesoft

Patient 360 with MuleSoft Accelerator for Healthcare

MuleSoft Accelerator for Healthcare offers a comprehensive solution for healthcare organizations to gain a 360-degree view of their patients. This is crucial for providing top-notch service and implementing a value-based care model. In this article, we will explore how to utilize the MuleSoft Accelerator for achieving a comprehensive patient view through FHIR and HL7 v2-based integrations with EHRs and other clinical applications.

Healthcare organizations are striving to provide personalized care by understanding patients' medical history, lifestyle, preferences, and other determinants. To achieve this, it's essential to unify data from various sources, especially electronic health records (EHR). The Patient 360 solution by MuleSoft accelerates this integration, enabling organizations to power innovative initiatives like the Digital Front Door and CRM, and derive powerful patient insights through AI and data science.

  1. Purpose-Built for Healthcare: The accelerator is specifically designed to cater to the healthcare domain, addressing its unique challenges, standards, and requirements.

  2. Pre-built APIs and Integration Templates: It provides out-of-the-box APIs and integration templates for common healthcare use cases, such as electronic health record (EHR) integration, patient data synchronization, and more. This significantly reduces the time and effort required to develop integrations from scratch.

  3. Support for Healthcare Standards: The accelerator supports key healthcare standards like HL7 v2, FHIR, and more, ensuring interoperability between different systems and adherence to industry norms.

  4. API-led Connectivity: In line with MuleSoft's philosophy, the accelerator promotes an API-led approach to connectivity. This means healthcare systems are exposed as reusable APIs, making it easier to integrate with other systems, mobile apps, or external partners.

  5. Security and Compliance: Given the sensitive nature of healthcare data, the accelerator is designed with robust security features. It ensures that integrations are compliant with regulations like HIPAA, ensuring the confidentiality, integrity, and availability of patient data.

  6. Flexibility and Scalability: Built on the Anypoint Platform, the accelerator offers flexibility in deployment (on-premises, cloud, or hybrid) and can scale to handle large volumes of data, ensuring performance isn't compromised.

Getting started

There are two main ways of hydrating Salesforce with patient data from the EHR, HL7 v2 and FHIR. We are going to focus on the HL7 v2 method for this post.

  1. FHIR Patient Search
    • Use the Patient EHR Search form available from Salesforce Patient Sync LWC component to search for a patient in an EHR system using their name and date of birth.
    • Select the patient card and click 'Sync Patient and Selected Records' to synchronize patient demographics and clinical resources using the MuleSoft Health Cloud Patient Data Synchronization Process API.
  2. Ingest HL7 v2 Events:
    • An EHR system or Interface Engine sends HL7 v2 ADT, ORU, and SIU events over HTTP or MLLP.
    • The HL7 v2 Events Management Listener consumes and validates the events, stores them in an intermediate datastore, and sends an ACK.

Infrastructure

We host different parts of Anypoint Platform in different locations, either in the cloud or in a physical data center.

  • Control plane The components of the Anypoint Platform architecture that is used to design, deploy, and manage APIs and Mule applications. The control plane contains product features and components that are part of the Anypoint Design Center, Anypoint Management Center, and Anypoint Exchange.

  • Runtime plane The components of the Anypoint Platform architecture where APIs and Mule applications are deployed and made available to users. The runtime plane includes the Mule runtime server and supporting services.

These may resonate with you as this will be an on premise operation. Let’s get up and running with Mulesoft for HL7v2 integrations. This will allow us to work with hospital events using modern technologies like the Salesforce CRM.

Setting Up the HL7v2 Events Management Listener

Importing Templates into Anypoint Studio:

  1. In Studio, click the Exchange X icon in the upper left of the taskbar.
  2. Log in with your Anypoint Platform credentials.
  3. Search for the template.
  4. Click Open.

Running Templates in Anypoint Studio: After importing your template into Studio, follow these configuration steps to run it:

1. Start by creating a simple app in Studio like the one depicted above. Please note the MLLP listener should have default settings, host 0.0.0.0 and port 30500.
2. Export your project to a JAR file.
3. Follow this knowledge article to upload the JAR to Cloudhub 2.0, but use the following payload in place of step #5:




Deploying the JAR

  1. In order to use any of following APIs to deploy an asset to the Exchange or deploy CloudHub 2.0 app via AMC Application Manager, you will need to obtain Anypoint platform Environment Id and Anypoint platform Organization Id. a. Organization ID: How to know my Organization ID (Org ID) on the Anypoint Platform b. Environment ID: How to get the Environment ID

  2. Please refer to KB "Creating connected app and getting the bearer token example" or "How to generate your Authorization Bearer token for Anypoint Platform" to get a bearer token. For Example:

  3. Modify the pom.xml to define the right groupId, artifactId, version as requested in Exchange REST API here. For Example:

    <groupId>18a04ea1-3b84-42fb-837a-bbcbe964f394</groupId>
	<artifactId>demo-ch2-helloworld</artifactId>
	<version>1.0.4</version>
	<packaging>mule-application</packaging>
	<name>demo-ch2-helloworld</name>
  1. Publish the asset to Exchange with the info collected in the steps above. Please replace the values in the angle brackets with the values collected in the previous steps.

Please keep in mind that the "path_to_app_jar_name.jar" refers to the location of the executable Mule application jar file.

You can find more information about packaging a mule app by referring to this document here.  Alternatively, you can use Anypoint Studio to export the application by following the steps outlined in the document document.

curl -X POST \
https://anypoint.mulesoft.com/exchange/api/v2/organizations/<;orgID>/assets/<groupId>/<artifactId>/<version> \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Authorization: Bearer <token>' \
  -H 'X-ANYPNT-ENV-ID: <envID>' \
  -H 'X-ANYPNT-ORG-ID: <orgID>' \
  -F 'files.mule-application.jar=@<path_to_app_jar_name.jar>' \
  -F 'files.pom=@<path_to_pom.xml>'

For Example:

curl -X POST \
https://anypoint.mulesoft.com/exchange/api/v2/organizations/18a04ea1-3b84-42fb-837a-bbcbe964f394/assets/18a04ea1-3b84-42fb-837a-bbcbe964f394/demo-ch2-helloworld/1.0.4 \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Authorization: Bearer <token>' \
  -H 'X-ANYPNT-ENV-ID: 7d1a0de5-8c49-4cc3-a21d-2566312469d2' \
  -H 'X-ANYPNT-ORG-ID: 18a04ea1-3b84-42fb-837a-bbcbe964f394' \
-F 'files.mule-application.jar=@/Users/<user_name>/demo-ch2-helloworld.jar' \
-F 'files.pom=@/Users/<user_name>/pom.xml'
  1. Deploy a CloudHub 2.0 app via AMC Application Manager REST API

    Below is an example of deploying a mule app "demo-helloworldb" to Shared Private Space with asset version 1.0.4 that got published in step 4.

    curl --location 'https://anypoint.mulesoft.com/amc/application-manager/api/v2/organizations/<orgID>/environments/<envID>/deployments'; \
    --header 'X-ANYPNT-ENV-ID: <envID>' \
    --header 'X-ANYPNT-ORG-ID: <orgID>' \
    --header 'Content-Type: application/json;charset=UTF-8' \
    --header 'Authorization: Bearer <token>' \
    --data '{
        "name": "demo-helloworlb",
        "labels": [
            "beta"
        ],
        "target": {
            ...
            "vCores": "0.1"
        }
    }'
    
    

    🎉 Awesome we are now deployed 🚀 Let’s get back to the networking bits.

  2. You can only access this from your private network and not through the internet*.

  3. You can now access this endpoint per this format:{application-url}.tcp.{environment}.

cloudhub.io

For my app viper, I took the app's name and only added "tcp" before

cloudhub.io: viper-azb63uc.mssa.usa-w1.tcp.cloudhub.i

Running a dig command, I can see that these are only accessible in the local network as RFC1918 address: dig +viper-azb63uc.mssa.usa-w1.tcp.cloudhub.io

Result:

136.32.32.222
111.32.32.222
  1. Doing a socket test from my local network, you should see succeeded like below:
app@psfour-549555dc46-pwdg8:/opt/mule$ nc -zvviper-azeiuc.yvs7m6.usa-w1.tcp.cloudhub.io 30500
Connection toviper-azeiuc.yvs7m7.usa-w1.tcp.cloudhub.io 30500 port [tcp/*] succeeded!

Testing the Application

The template accepts requests using HTTPS as well as MLLP listeners. Use tools like Advanced Rest Client or Postman to send requests over HTTPS. The template includes a postman collection in the src/test/resources folder for data ingestion simulation.

Troubleshooting

Validate Common Configuration

  • mule.env: Sets the environment where the application is to be deployed. Configure it in config-<mule.env>.yaml file. For a studio deployment, the recommended mule.env value is local.
  • mule.key: Sets the encryption password for encrypting secure properties. Update as needed.

MariaDB

  • A MariaDB is required to store the HL7 message. Run the create-schema.sql script available under src/test/resources/scripts folder after obtaining access to a MariaDB instance.
  • Configure the necessary credentials in the properties file located in the config folder. Encrypt sensitive information and configure it in the config-secured-<env>.yaml file.

HTTPS

  • https.host: Sets the service host interface. Configure it in config-<mule.env>.yaml file.
  • https.port: Sets the HTTPS service port number. Configure it in config-<mule.env>.yaml file.

TLS

  • Set up keystore properties for HTTPS operation. Please refer to this link on how to generate the Keystore.

HL7 v2 Message Processing

  • Configure the order of messages/events to be processed, parallel processing, sequential processing, and other specific configurations/rules for processing HL7 v2 messages.