Apache Camel is on FHIR!

Camel FHIR has been merged! It's available now at HEAD revision in the master branch and will be in our next release (2.23.0). It comes with tight integration with the HAPI-FHIR library which is an open-source implementation of the FHIR (Fast Healthcare Interoperability Resources) specification in Java. In a nutshell, FHIR (pronounced "fire") is a healthcare standard that describes how to exchange health records.

The Camel FHIR component comes with some exciting new features. Two new Camel Dataformats were added to transform to and from XML/JSON to FHIR resources. A Camel FHIR component was added to provide easy integration between Camel and your FHIR RESTful server. With these new features, along with the older HL7 component, we should be able to address some nice integration scenarios! Let's checkout an example combining all of the above!

The scenario described here will be a migration scenario. We will map an old HL7 V2 Patient to a new FHIR DSTU3 Patient that we will then store in a FHIR server. Source code for this example can be found here. The example assumes you have a running FHIR server. If you don't have one, you may use HAPI-FHIR's server.

This post will focus on integrating FHIR and Camel. For more information on mapping HL7 V2 to FHIR Messages, please checkout David Hay's blog.

To run the example, go into the example directory and modify the application.properties file to point to your FHIR server that you've setup. Now run the application by typing in the command mvn camel:run. This will fire up the Camel application which will read HL7 V2 patients from your local directory target/work/fhir/input (relative to the example directory). Copy the file `hl7v2.patient` located in the `data` folder into it. You should see the following console output:

We've successfully mapped our sample patient. Let's dive into the code to see what just happened. Here is the full route which we will explain in detail:

  1. Poll the directory configured in your application.properties file.
  2. Configure some Camel exception handling.
  3. Unmarshall the HL7 V2 message using the HL7 Dataformat
  4. Simple mapping from a HL7 V2 ORU_R01 message to a FHIR DSTU3 Patient
  5. Marhsall the Patient into JSON. This is useful when logging. Note that we could have used the XML data format but we find the JSON one to be more readable.
  6. Insert the Patient into our FHIR server. This uses the new Camel FHIR Component which we will discuss a bit later.
  7. Log whether the patient was successfully created.

The most complex part here was step number 6 where we made the call to our FHIR server through the FHIR component. The FHIR component was built using the camel-api-component-maven-plugin which follows the URI syntax fhir//:apiName/methodName?[options] where apiName is one of the following:

If you know a little about the FHIR specification, you will recognize that these are ALL the operations defined in the RESTful API which is now fully integrated with Camel! For detailed examples on every operations, check out our integration tests.

We couldn't cover everything that Camel FHIR has to offer in one blog post (like OSGI support and the Karaf features). More to come!

Happy Camel FHIR ridding!

Comments

  1. I think you can leverage the TypeConverter to turn the HL7 V2 ORU_R01 message to a FHIR DSTU3 Patient.

    ReplyDelete
  2. Hi Williem! Thanks for your feedback! However I don't think there exists a Camel TypeConverter to turn HL7 V2 ORU_R01 message to a FHIR DSTU3 Patients.

    One could create one but I don't think there is a standard for that (i.e fields might have different meanings from case to case.)

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. LifeVoxel.AI platform offers a better alternative for the medical imaging community. Its unique approach is based on 12 international patents that encompass critical patient-centric delivery of care using intuitive, diagnostic and instantly accessible visualizations over the Internet. It works 100X faster and its cheaper by 42% -80% than other service providers.

    Interactive Streaming and Artificial Intelligence Platform

    ReplyDelete

Post a Comment

Popular Posts