How to convert HL7 v2.x message to FHIR JSON?

animal picture animal · Oct 20, 2016 · Viewed 10.8k times · Source

I am trying to convert HL7 v2.x message to FHIR JSON using java or python. But I am not able to find any solution. Is there any way to achieve this?

I found that FHIR is capable of converting to JSON but I don't know how to do that.

Answer

Bryan picture Bryan · Nov 10, 2016

Here is a suggestion:

  1. Download and Install Mirth Connect
  2. Create a new channel
  3. Under the "Scripts" tab, select "preprocessor"
  4. Use the following to convert the HL7 message to XML:

// Modify the message variable below to pre process data
message = SerializerFactory.getSerializer('HL7V2').toXML(message);
    
return message;

  1. Now you have the XML file in the variable message, so you can write inline code to convert it to JSON without a library from here: https://davidwalsh.name/convert-xml-json