HL7 C-CDA to FHIR STU3 Conversion

This blog post describes the mapping specifications and conversion from HL7 C-CDA to FHIR STU3.

The HL7 organization released version 2 decades ago. This version 2.x is still being updated and improved and is implemented worldwide. HL7 Version 3 messaging has also been implemented internationally, but not in the U.S. CDA (Clinical Document Architecture) and Consolidated-Clinical Document Architecture (C-CDA), both XML-based, are widely adopted in the U.S. and are considered the most successful HL7 version 3 standard. FHIR specification is a next-generation standards framework, which combines the best features of all previous HL7’s releases, including v2, v3, and CDA product lines, to facilitate interoperation between various healthcare systems.

The C-CDA contains a library of CDA templates and prescribes their use for a set of specific document types. The templates are defined in three levels: document, section, and entry.

  • Document: The document level templates define the type of CDA document, such as CCD (Continuity of Care Document).
  • Section: The section level templates define how data within specific sections will be structured, such as vital signs.
  • Entry: Entry-level templates define how specific observations, procedures, etc., will be structured, making entries appear the same regardless what document or section they are a part of.

A C-CDA message starts with a “ClinicalDocument” node. Inside the node, it has series of elements, such as realmCode, title, effectiveDate, recordTarget, participant, component, etc. The “component” node carries most of the information that will be mapped to FHIR. A “component” node typically contains a “section” node. A “section” node consists of one or many “entry” nodes. An “entry” node may have an act, substanceAdministration” or a resource node, such as “encounter”. Below is a typical example of the “component” structure in C-CDA.

Template identifier (templateId) is used in each node to assert conformance to a collection of business rules which provide various levels of interoperability.

C-CDA/FHIR STU3 Mapping

Our web-based tool is developed based on two specifications.

  • Below is a table that shows the mapping between C-CDA and FHIR STU3. Another good reference for mapping specification can be found here.
    Top Level *Title2nd Level **3rd Level ***FHIR
    templateId = 2.16.840.1.113883 .10.20.22.2.6.1Allergies, Adverse, Reactions & AlertsAllergyIntolerance
    templateId = 2.16.840.1.113883 .10.20.22.4.30AllergyIntolerance. clinicalStatus
    templateId = 2.16.840.1.113883 .10.20.22.4.7AllergyIntolerance. reaction AllergyIntolerance. substance AllergyIntolerance. type = ‘Allergy’ AllergyIntolerance. category
    templateId = 2.16.840.1.113883 .10.20.22.4.8AllergyIntolerance. criticality
    templateId = 2.16.840.1.113883 .10.20.22.2.22EncountersEncounter
    templateId = 2.16.840.1.113883 .10.20.22.4.49Encounter.type Encounter.period
    templateId = 2.16.840.1.113883 .10.20.22.4.19Encounter.code Encounter.period
    templateId = 2.16.840.1.113883 .10.20.22.2.2ImmunizationsImmunization
    templateId = 2.16.840.1.113883 .10.20.22.4.52Immunization.status Immunization.date Immunization.route Immunization. vaccineCode Immunization. performer
    Practitioner Practitioner.address Practitioner.telecom Practitioner.name Practitioner. practitionerRole
    templateId = 2.16.840.1.113883 .10.20.22.1.1MedicationsMedication
    templateId = 2.16.840.1.113883 .10.20.22.4.16Medication.code
    templateId = 2.16.840.1.113883 .10.20.22.2.5.1ProblemsCondition
    templateId = 2.16.840.1.113883 .10.20.22.4.3Condition.code Condition. clinicalStatus Condition. onsetPeriod Condition.category
    templateId = 2.16.840.1.113883 .10.20.22.2.7ProceduresProcedure
    templateId = 2.16.840.1.113883 .10.20.22.4.13Procedure.code Procedure.status Procedure. performedDateTime
    templateId = 2.16.840.1.113883 .10.20.22.2.3ResultsObservation
    templateId = 2.16.840.1.113883 .10.20.22.4.2Observation.code Observation.status Observation. effectiveDateTime Observation. valueQuantity Observation. interpretation Observation. referenceRange
    templateId = 2.16.840.1.113883 .10.20.22.2.17Social HistoryObservation
    templateId = 2.16.840.1.113883 .10.20.22.4.78Observation. valueCodeableConcept
    templateId = 2.16.840.1.113883 .10.20.22.2.4Vital Signs
    templateId = 2.16.840.1.113883 .10.20.22.4.26
    templateId = 2.16.840.1.113883 .10.20.22.4.27Observation.code Observation.status Observation. effectiveDateTime Observation. valueQuantity
    templateId = 2.16.840.1.113883 .19.5.99999.2Provider OrganizationOrganization Organization.name Organization.telecom Organization.address

    Patient
    Patient.name
    Patient.address
    Patient.telecom
    Patient.gender
    Patient.birthDate
    Patient.maritalStatus
    Patient.contact
    Patient.communication

    Top Level *: ClinicalDocument.component.strurceBody.component.section or ClinicalDocument.recordTarget.patientRole
    2nd Level **:  Section.entry.act or Section.entry or Section.entry.substanceAdministration
    3rd Level ***: Act.entryRelationship or Entry.substanceAdministration
  • The following is the mapping specifications between a CDA (R2) message and the Patient resource using STU3. Note that the section number can be changed in a different release.
    FHIR Resource Mapping Specification Section in the URL
    Patient http://hl7.org/fhir/stu3/patient-mappings.html. 8.1.14.3

    Typically, when converting a C-CDA message to FHIR, the following FHIR resources may be generated:

    • Patient,
    • Observation
    • Practitioner
    • Organization
    • Condition
    • Medication
    • Procedure
    • MedicationRequest
    • MedicationAdministration
    • Encounter
    • AllergyIntolerance

Notes about the Conversion

1.     Use Composition to bundle resources

Once a CDA file is validated and converted successfully, the output JSON file is using the “Composition” to “bundle” various resources. In this example, Organization and AllergyIntolerance are bundled in the reference tag.

"resource": {
  "resourceType": "Composition",
  "id": "Composition/0",
  "section": [
    {
      "entry": [
        {
          "reference": "Organization/1"
        }
      ]
    },
    {
      "entry": [
        {
          "reference": "AllergyIntolerance/2"
        }
      ]
    },
    …

The reference tag, as shown in the above, contains a resource name and a sequence number, so that the reference will be unique. The “Organization/1” can then be found in the same JSON file, as follows:

 {
  "resource": {
    "resourceType": "Organization",
    "id": "Organization/1",
    "name": "Community Health and Hospitals",
    "telecom": [
      {
        "use": "work",
        "system": "phone",
        "value": " 555-555-5000"
      }
    ],
    "address": [
      {
        "line": [
          "1001 Village Avenue"
        ],
        "city": "Portland",
        "state": "OR",
        "postalCode": "99123",
        "country": "US"
      }
    ]
  },
  "request": {
    "method": "POST",
    "url": "Organization"
  }
}

2.     Use uuid for the patient id

The patient id is uniquely assigned using uuid. Following is an example of the Patient.id, highlighted in red color.

"resource": {
    "resourceType": "Patient",
    "id": "Patient/898688b8-014b-466a-9962-e1da96c1161d",
    "identifier": [
     {
        "system": "urn:oid:2.16.840.1.113883.3.6309.11",
        "value": "72929"
      }
     ],

For resources that refer to the Patient resource, it has the syntax like “Patient/uuid”. The following is an example of MedicationRequest that refers to the same patient, highlighted in red color.

"resource": {
    "resourceType": "MedicationRequest",
    "id": "MedicationRequest/4",
    
    "patient": {
      "reference": "Patient/898688b8-014b-466a-9962-e1da96c1161d"
     },

3.     Use the root id for the identifier value

The identifier in FHIR is mapped using the “root” attribute defined in the “id” tag in the CDA. In the following example, the templateId “2.16.840.1.113883.10.20.22.4.49” (encounter) has the following information:

<encounter classCode="ENC" moodCode="EVN">
   <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
   <!-- Encounter activity template -->
   <id root="2a620155-9d11-439e-92b3-5d9815ff4de8"/>

The root value is mapped to the “identifier.value” in the Encounter resource:

"resource": {
    "resourceType": "Encounter",
    "id": "Encounter/5",
    "patient": {
      "reference": "Patient/8ee6b5c6-e280-4805-9869-b8d8fa7902eb"
    },
    "identifier": [
      {
        "value": "2a620155-9d11-439e-92b3-5d9815ff4de8"
      }
    ],

Web-based Tool

You can test the conversion tool online by going to Redix HIPAA Compliance and Conversions, and then enter your C-CDA file by pressing the “Select File” button.

After a file is selected, your file will be automatically converted to an FHIR message, providing the file is a valid HL7 C-CDA file. Once the file is converted, you will see two outputs:

  1. XSL View: This view is generated by using the cda.xsl (https://github.com/chb/sample_ccdas/blob/master/CDA.xsl).

  1. FHIR Output:

The output JSON file can be viewed in a tree:

 

After the conversion, you might want to upload the FHIR JSON message to your FHIR data server. The default FHIR data server is HAPI, http://fhirtest.uhn.ca/. You can press the button “Upload to FHIR Data Server” to upload your FHIR resources to the FHIR data server.

You can, of course, use your own FHIR data server. To do so, you will need to first signup and then define your data server as a default FHIR data server.

References

There are several good resources that you may be interested in this topic.

 

Posted by admin in FHIR

HL7 V2.x ORU message to FHIR conversion

Previously, we explained how to convert an HL7 ADT message to FHIR. This blog post describes how we translate an HL7 ORU (observation report) message to FHIR STU3 (3.0.1).

ORU message contains four groups: patient, patient visit, order, and observation group. For the order group, “ORC” segment is optional, which means that the order group may or may not start with “ORC”. The loop structure of an ORU message looks like as follows.

SEQUENCEOPTIONAL or REQUIREDREPEAT #GROUP?SEGMENT NAME
1R1MSH - Message header segment
O1YPATIENT GROUP
2R1PID - Patient Identification
3O1PD1 - Patient Demographic
4O*NTE - Notes and comments segment
O1YPATIENT VISIT GROUP
5R1PV1 - Patient visit
6O1PV2 - Patient visit - additional information
R*YORDER GROUP
7O1ORC - Common order segment
8R1OBR - Observation request segment
9O*NTE - Notes and comments segment
R*YOBSERVATION GROUP
10O1OBX - Observation segment
11O*NTE - Notes and comments segment
12O*CTI - Clinical Trial Identification
13O1DSC - Continuation pointer segment

The OBR (Observation request) and OBX (Observation) segments are most significant due to their functions:

  • The OBR segment is used in all ORU messages as a report header and contains important information such as order number, request date/time, observation date/time, ordering provider, etc.
  • The OBX segment transmits the actual clinical observation results and reporting information. OBX segments can be used more than once in the message and may be followed by one or more NTE segments to provide additional notes and comments about the observation.

Mapping Specifications

The ORU to FHIR mapping can be found in the FHIR observation resource, http://hl7.org/fhir/stu3/observation-mappings.html. Besides the observation resource, ORU can carry more information that should be mapped to other resources, such as practitioner, procedure, diagnostic report, etc. Below is a table that shows the mappings between an HL7 2.x ORU message and all other possible FHIR resources in STU3. Note that the section number can be changed in a different release.

FHIR Resource Mapping Specification Section in the URL
Patient http://hl7.org/fhir/stu3/patient-mappings.html. 8.1.14.4
Observation http://hl7.org/fhir/stu3/observation-mappings.html 10.1.9.4
Practitioner http://hl7.org/fhir/stu3/practitioner-mappings.html 8.4.9.2
Person http://hl7.org/fhir/stu3/person-mappings.html 8.18.11.2
RelatedPerson http://hl7.org/fhir/stu3/relatedperson-mappings.html 8.2.7.2
DiagnosticReport http://hl7.org/fhir/stu3/diagnosticreport-mappings.html 10.2.9.2
Procedure http://hl7.org/fhir/stu3/procedure-mappings.html 9.3.7.2

Some of the notes about this conversion tool:

  • It validates the input file. Only the file is validated, the file will be converted.
  • It generates FHIR in JSON format.
  • It uses “bundle” as an FHIR resourceType.
  • It uses “transaction” as type.
  • It uses uuid for the “id” in each resource.
  • It uses “urn:redix-fhir” for the identifier.system.
  • Code conversion for the observation status (OBR25). F to final, R to registered, P to preliminary, A to amended, C to canceled, E to entered-in-error, and U/X to unknown.
  • Code conversion for the observation result status (OBX11). F to final, R to registered, P to preliminary, A to amended, C to canceled, E to entered-in-error, and U/X to unknown.
  • Code conversion for the observation abnormal flags (OBX08). L to “BELOW LOW NORMAL”, H to “ABOVE HIGH NORMAL”, LL to “BELOW LOWER PANIC LIMITS”, HH to “ABOVE UPPER PANIC LIMITS”, “<” to “BELOW ABSOLUTE LOW-OFF INSTRUMENT SCALE”, “>” to “ABOVE ABSOLUTE LOW-OFF INSTRUMENT SCALE”, “N” to “NORMAL (APPLIES TO NON-NUMERIC RESULTS)”, A to “ABNORMAL (APPLIES TO NON-NUMERIC RESULTS)”.
  • Code conversion for the gender (PID08), M to male, F to female, U to unknown
  • Date conversion from “YR4MONDT” to “YR4-MON-DT”. Time conversion from “HRMINSEC” to “HR:MIN:SEC”.
  • Insert appropriate system identifier. For example, for the category in the DiagnosticReport resource, we need to add the system identifier http://hl7.org/fhir/ValueSet/diagnostic-service-sections.
  • Uses reference to refer to the Patient resource. For example, for the Observation resource, we should use “subject.reference” to refer to the patient id.
  • Uses “PUT” method in the “request” collection. To make sure that the patient data is unique in the FHIR data server, “ifNoneExist” method is used.

Web-based Tool

You can test the conversion tool online by going to Redix HIPAA Compliance and Conversion Services, and enter your file by pressing the “Select File” button. After a file is selected, your file will be automatically converted to an FHIR message, providing the file is a valid HL7 2.x ORU file. Also, you will see the message type and the version number of your HL7 file. In the following example, the file is ORU message type, and the version number is V2.3.

In front of each segment, there is a “>” sign. Press it, and you will see the definition of the segment and its corresponding value of each field in the segment.

Below is the definition of OBR segment and its values.

Below is the definition of OBX segment and its values.

 

After the conversion, you might want to upload the FHIR JSON message to your FHIR data server. The default FHIR data server is HAPI, http://fhirtest.uhn.ca/. You can press the button “Upload to FHIR Data Server” to upload your FHIR resources to the FHIR data server.

You can, of course, use your own FHIR data server. To do so, you will need to first signup and then define your data server as a default FHIR data server.

Example

Use the following ORU file as an example:

MSH|^~\&|CERNER||PriorityHealth||201701011201||ORU^R01|Q479004375T431430612|P|2.3|
PID||001677980a|001677980b||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
PV1|1|I|||||ID123ABC^JOHNSON^MARTIN^B^JR^DR^MD^^ assigning authority (HD) ^name type code(ID) ^ identifier check digit (ST) ^ code identifying the checkdigit scheme employed (ID) ^ identifier type code (IS) ^ assigning facility (HD)^ name representation code (ID)|ID123ABCx2^JOHNSON^MARTIN^B^JR^DR^MD^^ assigning authority (HD) ^name type code(ID) ^ identifier check digit (ST) ^ code identifying the checkdigit scheme employed (ID) ^ identifier type code (IS) ^ assigning facility (HD)^ name representation code (ID)|ID123ABC^JOHNSON^MARTIN^B^JR^DR^MD^^ assigning authority (HD) ^name type code(ID) ^ identifier check digit (ST) ^ code identifying the checkdigit scheme employed (ID) ^ identifier type code (IS) ^ assigning facility (HD)^ name representation code (ID)
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733||IMM|F|||||||||||20061122140000|
OBX|1|NM|JHDL^HDL Cholesterol (CAD)|1|62|CD:289^mg/dL|>40||||F|||20080511103500
OBX|2|NM|JTRIG^Triglyceride (CAD)|1|72|CD:289^mg/dL|35-150||||F|||20080511103500
OBX|3|NM|JVLDL^VLDL-C (calc - CAD)|1|14|CD:289^mg/dL|||||F|||20080511103500
OBX|4|NM|JLDL^LDL-C (calc - CAD)|1|134|CD:289^mg/dL|0-100|H|||F|||20080511103500
OBX|5|NM|JCHO^Cholesterol (CAD)|1|210|CD:289^mg/dL|90-200|H|||F|||20080511103500
OBX|1|NM|13457-7^LDL (CALCULATED)^LOINC|1|49.000|MG/DL|0.000 - 100.000|N|||F
NTE|||THIS IS A COMENT
OBX|2|NM|2093-3^CHOLESTEROL^LOINC|1|138.000|MG/DL|100.000 - 200.000|N|||F
NTE|||THIS IS A COMENT
OBX|3|NM|2086-7^HDL^LOINC|1|24.000|MG/DL|45.000 - 150.000|L|||F
NTE|||THIS IS A COMENT
OBX|4|NM|2571-8^TRIGLYCERIDES^LOINC|1|324.000|MG/DL|0.000 - 150.000|H|||F
NTE|||THIS IS A COMENT
OBX|1|NM|GLU^Glucose Lvl|1|59|mg/dL|65-99|L|||F|||20061122154733
NTE|||THIS IS A COMENT

The above ORU message is converted to the following FHIR message in JSON, which consists of Practitioner, Patient, DiagnosticReport, and Observation resources.

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
    {
      "resource": {
        "resourceType": "Practitioner",
        "id": "71258745-1448-4333-80B9-025937641441",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "ID123ABC.JOHNSON.MARTIN.JR"
          }
        ],
        "name": [
          {
            "use": "official",
            "family": "JOHNSON",
            "given": [
              "MARTIN"
            ],
            "suffix": "JR"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Practitioner?_id=ID123ABC&family=JOHNSON&given=MARTIN",
        "ifNoneExist": "identifier=redix-fhir|ID123ABC.JOHNSON.MARTIN.JR"
      }
    },
    {
      "resource": {
        "resourceType": "Patient",
        "id": "4496D001-588D-491A-8822-05A02E595440",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "19680219.SMITH.CURTIS.male"
          },
          {
            "system": "submit_mrn",
            "value": "001677980a"
          },
          {
            "system": "submit_mrn",
            "value": "001677980b"
          }
        ],
        "name": [
          {
            "use": "official",
            "family": "SMITH",
            "given": [
              "CURTIS"
            ]
          }
        ],
        "gender": "male",
        "birthDate": "1968-02-19",
        "link": [
          {
            "other": "001677980b"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Patient?family=SMITH&given=CURTIS&gender=male",
        "ifNoneExist": "identifier=redix-fhir|19680219.SMITH.CURTIS.male"
      }
    },
    {
      "resource": {
        "resourceType": "DiagnosticReport",
        "id": "71258767-1448-4333-80B9-025937641441",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.71258767-1448-4333-80B9-025937641441"
          }
        ],
        "status": "final",
        "category": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/ValueSet/diagnostic-service-sections",
              "code": "IMM"
            }
          ]
        },
        "code": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/ValueSet/report-codes",
              "code": "648088"
            }
          ]
        },
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2006-11-22T15:16:00",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "actor": {
              "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
            }
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "diagnosticReport?identifier=redix-fhir|dne.71258767-1448-4333-80B9-025937641441"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "EA24D589-9CCE-4876-AFD7-4BDB598A0544",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.EA24D589-9CCE-4876-AFD7-4BDB598A0544"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.JHDL.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "JHDL"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2008-05-11T10:35:00",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 62,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "referenceRange": [
          {
            "text": ">40"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.EA24D589-9CCE-4876-AFD7-4BDB598A0544"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "EA24D501-9CCE-4876-AFD7-4BDB598A0544",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.EA24D501-9CCE-4876-AFD7-4BDB598A0544"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.JTRIG.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "JTRIG"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2008-05-11T10:35:00",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 72,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "referenceRange": [
          {
            "text": "35-150"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.EA24D501-9CCE-4876-AFD7-4BDB598A0544"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "16A38B23-5989-429F-A66E-178462854100",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.16A38B23-5989-429F-A66E-178462854100"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.JVLDL.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "JVLDL"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2008-05-11T10:35:00",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 14,
          "system": "http://loinc.org",
          "code": "NM"
        }
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.16A38B23-5989-429F-A66E-178462854100"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "43232245-1544-4CB8-BEF4-044D7B904104",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.43232245-1544-4CB8-BEF4-044D7B904104"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.JLDL.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "JLDL"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2008-05-11T10:35:00",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 134,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "ABOVE HIGH NORMAL"
        },
        "referenceRange": [
          {
            "text": "0-100"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.43232245-1544-4CB8-BEF4-044D7B904104"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "43232267-1544-4CB8-BEF4-044D7B904104",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.43232267-1544-4CB8-BEF4-044D7B904104"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.JCHO.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "JCHO"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2008-05-11T10:35:00",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 210,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "ABOVE HIGH NORMAL"
        },
        "referenceRange": [
          {
            "text": "90-200"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.43232267-1544-4CB8-BEF4-044D7B904104"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "7FA2D989-D10F-46D1-858B-400684AB1511",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.7FA2D989-D10F-46D1-858B-400684AB1511"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.13457-7.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "13457-7"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 49,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "NORMAL (APPLIES TO NON-NUMERIC RESULTS)"
        },
        "comment": "THIS IS A COMENT",
        "referenceRange": [
          {
            "text": "0.000 - 100.000"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.7FA2D989-D10F-46D1-858B-400684AB1511"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "7FA2D901-D10F-46D1-858B-400684AB1511",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.7FA2D901-D10F-46D1-858B-400684AB1511"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.2093-3.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "2093-3"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 138,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "NORMAL (APPLIES TO NON-NUMERIC RESULTS)"
        },
        "comment": "THIS IS A COMENT",
        "referenceRange": [
          {
            "text": "100.000 - 200.000"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.7FA2D901-D10F-46D1-858B-400684AB1511"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "BB317F23-9DC9-40FA-8D02-5DBF9DB61144",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.BB317F23-9DC9-40FA-8D02-5DBF9DB61144"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.2086-7.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "2086-7"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 24,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "BELOW LOW NORMAL"
        },
        "comment": "THIS IS A COMENT",
        "referenceRange": [
          {
            "text": "45.000 - 150.000"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.BB317F23-9DC9-40FA-8D02-5DBF9DB61144"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "E8B12645-5984-4A14-9499-1A78A6B10151",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.E8B12645-5984-4A14-9499-1A78A6B10151"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.2571-8.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "2571-8"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 324,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "ABOVE HIGH NORMAL"
        },
        "comment": "THIS IS A COMENT",
        "referenceRange": [
          {
            "text": "0.000 - 150.000"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.E8B12645-5984-4A14-9499-1A78A6B10151"
      }
    },
    {
      "resource": {
        "resourceType": "Observation",
        "id": "E8B12667-5984-4A14-9499-1A78A6B10151",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.E8B12667-5984-4A14-9499-1A78A6B10151"
          },
          {
            "system": "submit_obr",
            "value": "000002006326002362.648088.GLU.1"
          }
        ],
        "status": "final",
        "code": [
          {
            "coding": [
              {
                "system": "http://loinc.org",
                "code": "GLU"
              }
            ]
          }
        ],
        "subject": {
          "reference": "Patient/4496D001-588D-491A-8822-05A02E595440"
        },
        "effectiveDateTime": "2006-11-22T15:47:33",
        "issued": "2006-11-22T15:47:33",
        "performer": [
          {
            "reference": "Practitioner/71258745-1448-4333-80B9-025937641441"
          }
        ],
        "valueQuantity": {
          "value": 59,
          "system": "http://loinc.org",
          "code": "NM"
        },
        "interpretation": {
          "text": "BELOW LOW NORMAL"
        },
        "comment": "THIS IS A COMENT",
        "referenceRange": [
          {
            "text": "65-99"
          }
        ]
      },
      "request": {
        "method": "POST",
        "url": "observation?identifier=redix-fhir|dne.E8B12667-5984-4A14-9499-1A78A6B10151"
      }
    }
  ]
}
Posted by admin in FHIR

HL7 V2.x ADT messages to FHIR conversion

This blog post explains how we convert an HL7 ADT message to FHIR STU3 (3.0.1).

There are 51 different types of HL7 ADT messages, ranging from A01 to A51. Some of the most commonly used ADT messages include:

  • ADT-A01 – patient admit
  • ADT-A02 – patient transfer
  • ADT-A03 – patient discharge
  • ADT-A04 – patient registration
  • ADT-A05 – patient pre-admission
  • ADT-A08 – patient information update
  • ADT-A11 – cancel patient admit
  • ADT-A12 – cancel patient transfer
  • ADT-A13 – cancel patient discharge

The Redix conversion tool supports the conversion of all 51 ADT messages, as well as different versions, i.e., 2.2 to 2.8.

The ADT to FHIR mapping can be found in the FHIR patient resource, http://hl7.org/fhir/stu3/patient-mappings.html. Note that some of the mappings are not a one-to-one relationship between ADT and FHIR patient resource. For example, the patient.organization can be mapped to one of the NK1 element, i.e., NK1-13, NK1-30, NK1-31, NK1-32, NK1-41, etc. This means that if there is a value in the NK1-13 field, then we can map the value to the organization. If not, we should continue checking if there is a value in the NK1-30, NK1-31, NK1-32, or NK1-41 field.

Besides the patient information, ADT can also carry other information, such as allergy intolerance and related person. Below is a table that shows the mappings between an HL7 2.x ADT message and three possible FHIR resources in STU3. Note that the section number can be changed in a different release.

FHIR Resource URL Section in the URL
Patient http://hl7.org/fhir/stu3/patient-mappings.html. 8.1.14.4
AllergyIntolerance http://hl7.org/fhir/stu3/allergyintolerance-mappings.html 9.1.7.2
RelatedPerson http://hl7.org/fhir/stu3/relatedperson-mappings.html 8.2.7.2

 

Some of the notes about this conversion:

  • Validates the input file. Only the file is validated, the file will be converted.
  • Generates FHIR in JSON format
  • Uses “bundle” as an FHIR resourceType
  • Uses “transaction” as type
  • Uses uuid for the “id” in each resource
  • Uses “urn:redix-fhir” for the identifier.system
  • Date conversion for DOB, PID07
  • Code conversion for the gender (PID08), M to male, F to female, U to unknown
  • Code conversion for allergy severity: SV for high, MO for low, MI for low
  • Uses “PUT” method in the “request” collection. To make sure that the patient data is unique in the FHIR data server, “ifNoneExist” method is used.

Web-based Tool

You can test the conversion tool online by going to Redix HIPAA Compliance and Conversion Services, and then enter your file by pressing the “Select File” button. After a file is selected, your file will be automatically converted to an FHIR message, providing the file is a valid HL7 2.x ADT file. Also, you will see the message type and the version number of your HL7 file. In the following example, it is ADT and V2.4, respectively.

In front of each segment, there is a “>” sign. Press it and you will see the definition the segment and its corresponding value of each field. Below is the definition of MSH segment.

Here is the definition of PID segment.

After the conversion, you might want to upload the FHIR JSON message to your FHIR data server. The default FHIR data server is HAPI, http://fhirtest.uhn.ca/. You can press the button “Upload to FHIR Data Server” to upload your FHIR resources to the FHIR data server.

You can, of course, use your own FHIR data server. To do so, you will need to first signup and then define your data server as a default FHIR data server.

Example

Use the following ADT file as an example:

MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A04|MSG00001|P|2.4
EVN|A01-|198808181123
PID|||PATID1234^5^M11||JONES^WILLIAM^A^III||19610615|M-||2106-3|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434~(919)277-3114||S||PATID12345001^2^M10|123456789|9-87654^NC
NK1|1|JONES^BARBARA^K|SPO|||||20011105
NK1|1|JONES^MICHAEL^A|FTH
PV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||-||1|A0-
AL1|1||^PENICILLIN||PRODUCES HIVES~RASH
AL1|2||^CAT DANDER
DG1|001|I9|1550|MAL NEO LIVER, PRIMARY|19880501103005|F||
PR1|2234|M11|111^CODE151|COMMON PROCEDURES|198809081123
ROL|45^RECORDER^ROLE MASTER LIST|AD|CP|KATE^SMITH^ELLEN|199505011201
GT1|1122|1519|BILL^GATES^A
IN1|001|A357|1234|BCMD|||||132987
IN2|ID1551001|SSN12345678
ROL|45^RECORDER^ROLE MASTER LIST|AD|CP|KATE^ELLEN|199505011201

The above ADT message is converted to the following FHIR message in JSON, which includes three resources: Patient, AllergyIntolerance, and RelatedPerson.

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
    {
      "resource": {
        "resourceType": "Patient",
        "id": "51B11A01-4125-4042-9358-415228181551",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "JONES.WILLIAM.male"
          },
          {
            "system": "submit_mrn",
            "value": "PATID1234"
          }
        ],
        "name": [
          {
            "use": "official",
            "family": "JONES",
            "given": [
              "WILLIAM"
            ],
            "prefix": "III"
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "(919)379-1212",
            "use": "home"
          },
          {
            "system": "phone",
            "value": "(919)271-3434",
            "use": "work"
          },
          {
            "system": "phone",
            "value": "(919)277-3114",
            "use": "work"
          }
        ],
        "gender": "male",
        "address": [
          {
            "use": "home",
            "line": "1200 N ELM STREET",
            "city": "GREENSBORO",
            "state": "NC",
            "postalCode": "27401-1020"
          }
        ],
        "contact": [
          {
            "relationship": [
              {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/patient-contact-relationship",
                    "code": "SPO"
                  }
                ]
              }
            ],
            "name": {
              "family": "JONES",
              "given": [
                "BARBARA"
              ]
            }
          },
          {
            "relationship": [
              {
                "coding": [
                  {
                    "system": "http://hl7.org/fhir/patient-contact-relationship",
                    "code": "FTH"
                  }
                ]
              }
            ],
            "name": {
              "family": "JONES",
              "given": [
                "MICHAEL"
              ]
            }
          }
        ],
        "link": [
          {
            "other": "PATID1234"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Patient?family=JONES&given=WILLIAM&gender=male",
        "ifNoneExist": "identifier=redix-fhir|JONES.WILLIAM.male"
      }
    },
    {
      "resource": {
        "resourceType": "AllergyIntolerance",
        "id": "B9B06723-C9AB-4485-B276-11194A3A5440",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.B9B06723-C9AB-4485-B276-11194A3A5440"
          }
        ],
        "verificationStatus": "unconfirmed",
        "patient": {
          "reference": "Patient/51B11A01-4125-4042-9358-415228181551"
        },
        "reaction": [
          {
            "manifestation": [
              {
                "coding": [
                  {
                    "system": "http://snomed.info/sct",
                    "code": "PRODUCES HIVES"
                  }
                ]
              },
              {
                "coding": [
                  {
                    "system": "http://snomed.info/sct",
                    "code": "RASH"
                  }
                ]
              }
            ]
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "sectionAllergy?identifier=redix-fhir|dne.B9B06723-C9AB-4485-B276-11194A3A5440",
        "ifNoneExist": "identifier=redix-fhir|dne.B9B06723-C9AB-4485-B276-11194A3A5440"
      }
    },
    {
      "resource": {
        "resourceType": "AllergyIntolerance",
        "id": "B9B06745-C9AB-4485-B276-41494A3A1514",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "dne.B9B06745-C9AB-4485-B276-41494A3A1514"
          }
        ],
        "verificationStatus": "unconfirmed",
        "patient": {
          "reference": "Patient/51B11A01-4125-4042-9358-415228181551"
        }
      },
      "request": {
        "method": "PUT",
        "url": "sectionAllergy?identifier=redix-fhir|dne.B9B06745-C9AB-4485-B276-41494A3A1514",
        "ifNoneExist": "identifier=redix-fhir|dne.B9B06745-C9AB-4485-B276-41494A3A1514"
      }
    },
    {
      "resource": {
        "resourceType": "RelatedPerson",
        "id": "B9B06767-C9AB-4485-B276-51194A3A0114",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "JONES,BARBARA,K.unknown"
          }
        ],
        "patient": {
          "reference": "Patient/51B11A01-4125-4042-9358-415228181551"
        },
        "relationship": [
          {
            "coding": [
              {
                "system": "http://hl7.org/fhir/patient-contact-relationship",
                "code": "SPO"
              }
            ]
          }
        ],
        "name": [
          {
            "use": "official",
            "family": "JONES",
            "given": "BARBARA"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "RelatedPerson?name=JONES,BARBARA,K&gender=unknown",
        "ifNoneExist": "identifier=redix-fhir|JONES,BARBARA,K.unknown"
      }
    },
    {
      "resource": {
        "resourceType": "RelatedPerson",
        "id": "E63F1E89-8566-4EAE-BA0D-5415DBCB1144",
        "identifier": [
          {
            "system": "urn:redix-fhir",
            "value": "JONES,MICHAEL,A.unknown"
          }
        ],
        "patient": {
          "reference": "Patient/51B11A01-4125-4042-9358-415228181551"
        },
        "relationship": [
          {
            "coding": [
              {
                "system": "http://hl7.org/fhir/patient-contact-relationship",
                "code": "FTH"
              }
            ]
          }
        ],
        "name": [
          {
            "use": "official",
            "family": "JONES",
            "given": "MICHAEL"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "RelatedPerson?name=JONES,MICHAEL,A&gender=unknown",
        "ifNoneExist": "identifier=redix-fhir|JONES,MICHAEL,A.unknown"
      }
    }
  ]
}


Posted by admin in FHIR

HL7 2.x messages to FHIR conversions

This is my first blog post about our FHIR (Fast Healthcare Interoperability Resources) development. In this post, I would like to share with you the toolsets that we developed to help promoting the FHIR to the healthcare community.

Three years ago, I learned FHIR via a Coursera course (www.coursera.org), instructed by Mark Braunstein, MD at Georgia Institute of Technology. Since then, I have been convinced that FHIR specification provides better support of electronic health record (EHR), such as allergies, medications, conditions, immunizations, and lab results. As a result, FHIR is a better approach to facilitate interoperation between various healthcare systems.

Since the legacy HL7 have been used for more than a decade for patient information (ADT), observation results (ORU), etc., there will be a need to convert those existing HL7 data to the FHIR specification. My company, Redix International, Inc, (www.redix.com), has been in the HIPAA business for more than 20 years. Two years ago, I decided to modify our flagship product, Redix AnyToAny Format Converter Engine, and our HL7 module to support the conversions between HL7 2.x and FHIR. As a result, we have developed a toolset that converts HL7 2.x (including 2.3, 2.4, 2.5, and CDA) to FHIR STU3. The HL7 2.3, 2.4, and 2.5 messages that we supported are ADT, ORU, MFN, PPP, REF, SIU, and VXU.

You can test the conversions by going to:

Conversion Type URL
HL7 2.3, 2.4, 2.5 to FHIR https://www.redixhipaa.com/HL7/mapping
HL7 CDA to FHIR https://www.redixhipaa.com/HL7/CCDA

Once you are in the above web-page (see below), you can select an HL7 file from your system and the file will be automatically converted to FHIR STU3 specification, providing the file is a legit HL7 file.

Feel free to use the tools and please let us know if there is anything that we can do to improve the tools. Feel free to reach out or connect with me at @redixfhir.

In the future, I will elaborate more on the conversion tools and our future developments in FHIR.

Posted by admin in FHIR