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.
SEQUENCE | OPTIONAL or REQUIRED | REPEAT # | GROUP? | SEGMENT NAME |
1 | R | 1 | | MSH - Message header segment |
| O | 1 | Y | PATIENT GROUP |
2 | R | 1 | | PID - Patient Identification |
3 | O | 1 | | PD1 - Patient Demographic |
4 | O | * | | NTE - Notes and comments segment |
| O | 1 | Y | PATIENT VISIT GROUP |
5 | R | 1 | | PV1 - Patient visit |
6 | O | 1 | | PV2 - Patient visit - additional information |
| R | * | Y | ORDER GROUP |
7 | O | 1 | | ORC - Common order segment |
8 | R | 1 | | OBR - Observation request segment |
9 | O | * | | NTE - Notes and comments segment |
| R | * | Y | OBSERVATION GROUP |
10 | O | 1 | | OBX - Observation segment |
11 | O | * | | NTE - Notes and comments segment |
12 | O | * | | CTI - Clinical Trial Identification |
13 | O | 1 | | DSC - 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.
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"
}
}
]
}