Convert - HL7 to FHIR (R4)

POST /convert/v1/hl7tofhirr4/:patientID

This operation converts one or more HL7v2 messages into a FHIR R4 bundle.

See the Convert API Overview for general principles that apply to all Convert API operations.

Inputs and Outputs

The input is a single or newline-delimited set of HL7v2.7 messages. Supported message types include:

  • ADT
  • ORU
  • MDM
  • VXU

The Convert API utilizes context within the messages to intelligently process the message segments. For example, OBX segments may be converted to either Observations or LabObservations depending on the message type.

The output is a FHIR R4 Bundle containing the clinical data parsed out of the HL7 messages, along with an OperationOutcome resource detailing the results (including warnings or errors) of the conversion process.

Patient ID

You may additionally specify a patientID in the URL segment. This value will be used for the id field in the resulting Patient resource within the output bundle. Although Rosetta will generate a default patient ID if none is provided, it is strongly recommended that you provide your own patient ID.

Data Format

The input for the HL7 to FHIR conversion is plain text, so be sure to specify content-type: text/plain in your request header.

You can specify either accept: application/json or accept: application/xml in your request header to get a response in either JSON or XML format.

Message Processing Notes

  • If more than one message is included in the input, they must all represent data about the same individual.
  • If there are multiple messages, they must be listed chronologically.
  • If the input includes a mix of ADT and non-ADT message types (or multiple ADT messages), the last ADT message is treated as the source of truth for patient and encounter information.
  • Unsupported message types will be ignored and not present with the output. An OperationOutcome error will indicate this in the output bundle.

Example

Try It
Try out the operations, with examples, in the Rosetta Sandbox.
Sample Input
MSH|^~\&|||||20220308040000||ADT^A01|||2.7
EVN|A01|20220308040000
PID|1||123456||Test^Patient|||||||||||||7890
PV1|1|I||||||||||||||||||||||||||||||||||||||||||20220308040000"

FHIR Bundles are verbose, so the output below just shows a small sample to illustrate how the data is structured. For a more complete example, try out the API in one of the Quickstart Tools, or refer to the FHIR Specification.

Sample Output
{
  "resourceType": "Bundle",
  "type": "searchset",
  "entry": [
    {
      "resource": {
        "resourceType": "Patient",
        ... (patient fields)
      }
    },
    {
      "resource": {
        "resourceType": "Encounter",
        ... (encounter fields)
      }
    },
    ...
    {
      "resource": {
        "resourceType": "OperationOutcome",
        "issue": [
          ... (any processing issues)
      }
    }
  ]
}