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 FHI
You can convert HL7 to FHIR JSON in Java using Apache Camel. Camel supports both formats:
The exact implementation depends on how you're receiving and sending the HL7 and FHIR; but broadly speaking, you would write a Camel route which unmarshals from HL7 using the HL7 dataformat component, then transforms the data into a target FHIR Java object by mapping the source to target fields using a custom class (you would need to write this, but see below for a starting point), and then marshals the data out to JSON using the FHIR dataformat. For example:
from("file:/input/directory")
.unmarshal().hl7() // convert from HL7 text format to Java object
.process(new PatientProcessor()) // map source to target fields
.marshal().fhirJson() // serialise out to FHIR JSON format
.to("file:/output/directory");
The processor in the middle is where your transformation/mapping class goes.
There is a fully worked example in Camel's unit tests, showing how to convert from HL7 to FHIR. See: