· Feb 2 3m read

Transformation of FHIR message to HL7 V2 message

Sometimes we need to convert FHIR message to HL7 V2, e.g. to register a patient to the PACS system.
In this article, I will explain the steps to achieve the desired by using IRIS FHIR Server production.

Below are the steps we need to follow:

  1. Make sure FHIRServer production is started.
  2. Register Business Service with FHIRServer endpoint.
  3. Define Business Processes to convert FHIR message to SDA and then Convert SDA to HL7 v2.
  4. Post JSON resource to FHIRServer endpoint and get HL7 V2 response.

Let's review the steps in detail.

Step 1. Make sure FHIRServer production is started

Open the production page and make sure Production is started. In the next step, we need to make sure business service HS.FHIRServer.Interop.Service is registered with FHIRServer

Step 2. Register Business Service with FHIRServer endpoint

From the management portal, Click on Health tab

Then click on FHIR configuration from the list and then click on Server Configuration

Select the endpoint and make sure under the Service Config Name, HS.FHIRServer.Interop.Service (Business service defined in production) is defined.

Step 3. Define Business Processes to covert FHIR message to SDA and then Convert SDA to HL7 v2

Define the business process (Solution.BP.Process is already defined in the application).
Please note that we are applying a condition here that the endpoint must contain hl7 augment to proceed with conversion otherwise consider it as a normal FHIR request.

Then pass the message to the FHIR_SDA process which will convert the message to SDA.
FHIR_SDA is derived from a user-defined Solution.BP.Process class.
After conversion FHIR_SDA, the process passes the message to the SDA_HL7 process
SDA_HL7 process is derived from a user-defined Solution.BP.SDATransformProcess class which converts SDA message to HL7 V2 message.

Define processes in the production as follows:

Step 4. Post JSON resource to FHIRServer endpoint and get HL7 V2 response

From Postman, Use the Post method to call the FHIRServer endpoint.
Below is our FHIRServer endpoint:

NOTE: Our FHIRServer endpoint is http://localhost:32783/csp/fhirserver/fhir/r4/, but we are passing hl7 as an argument to detect from the Production business process that this is not a normal FHIR Post request but it is a request to transform FHIR message.

The same functionality we can use from Our Web Applications. 
Select the Patient Resource, then click on the resource from the list, select the HL7 FHIR or Resource Details tab, and click on the "Transform FHIR to HL7 V2" button

The application will get the transformation message HL7 V2 with the help of FHIR Server production.

HL7 V2 to FHIR transformation

Select HL7 to FHIR from the menu and enter HL7 V2 data, Click the convert button to transform HL7 message to FHIR message


HL7 to FHIR Transformation is also using production to convert the HL7 V2 message to the FHIR message.

HL7_Http_Service Business Service sends HL7 message to HL7_SDA process and then HL7_SDA sends SDA data to SDA_FHIR process, which finally converts it to FHIR


For more details and code review, please visit iris-fhir-lab open exchange application page.


Discussion (0)1
Log in or sign up to continue