Mapping HL7v2 ORU^R01 to US Core Observation: Field Reference
Lab result. Maps OBX into an Observation with code, value, units, and reference range.
Field-by-field mapping
Every rule in the Interoperall template is shown below: the source field, the FHIR target path it populates, and the transform applied. This table is generated from the live template, so it matches exactly what runs when you fork it.
| Source | FHIR path | Transform |
|---|---|---|
| (literal "final") | Observation.status | Copied directly |
| (literal "laboratory") | Observation.category[0].coding[0].code | Copied directly |
| (literal "http://terminology.hl7.org/CodeSystem/observation-category") | Observation.category[0].coding[0].system | Copied directly |
| OBX-3.1 | Observation.code.coding[0].code | Copied directly |
| OBX-3.2 | Observation.code.coding[0].display | Copied directly |
| OBX-3.3 | Observation.code.coding[0].system | Value-set lookup (L→http://loinc.org, LN→http://loinc.org, LOINC→http://loinc.org; fallback "http://terminology.hl7.org/CodeSystem/v2-0396") |
| OBX-5 | Observation.valueQuantity.value | Copied directly |
| OBX-6.1 | Observation.valueQuantity.unit | Copied directly |
| OBX-6.1 | Observation.valueQuantity.code | Copied directly |
| (literal "http://unitsofmeasure.org") | Observation.valueQuantity.system | Copied directly |
| OBX-7 | Observation.referenceRange[0].text | Copied directly |
Source HL7v2 message
The sample input this template is designed to handle:
MSH|^~\&|LAB|HOSP|REC|REC|20240115140000||ORU^R01|MSGCTRL9999|P|2.5.1
PID|1||MRN12345^^^EPIC^MR||DOE^JOHN^A||19800101|M
OBR|1|||GLU^Glucose^L|||20240115135000
OBX|1|NM|GLU^Glucose^L||110|mg/dL|70-110|N|||FCommon gotchas
- HL7v2 identifiers (PID-3) carry an assigning authority and ID type in later components. FHIR needs an `identifier.system` (a URI/OID), so you must map your local authority to a real, stable system URI, not just copy the code.
- HL7v2 dates are `YYYYMMDD` (or `YYYYMMDDHHMMSS`); FHIR `date`/`dateTime` need ISO-8601 (`YYYY-MM-DD`). A date-format transform is required or validation will reject the value.
- Coded fields (gender, status, units) almost always need a value-set lookup. HL7v2 `M`/`F` is not the same token as FHIR `male`/`female`, and an unmapped code should fall back rather than pass through raw.
- Repeating segments (multiple OBX, multiple PID-11 address repetitions) map to FHIR arrays. A single template rule targets one array index, so duplicate the rules (or iterate) for additional repetitions.
Target profile
This mapping targets http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab. After mapping, validate the output against the profile — the template populates the Must Support elements, but required elements missing from your source data will still fail. Score it against US Core.
Frequently asked questions
How do I map an HL7v2 ORU^R01 message to a FHIR Observation?
Parse the ORU^R01 message into segments, then map each relevant field to its FHIR path: identifiers and coded values need value-set lookups, and HL7v2 date fields need reformatting to ISO-8601. The field table on this page lists every source-to-target rule used by the Interoperall template, which you can fork and run in the Mapping Builder.
Which segments does the ORU^R01 → Observation mapping read?
It reads the OBX segment. Other segments in the message are left unmapped unless you add rules for them.
Is this Observation mapping US Core compliant?
It targets http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab. The template populates the elements US Core marks as Must Support, but you should always validate the output against the profile. Required elements that are absent in your source data will still fail.
Can I customize this mapping?
Yes. Fork the template in the Mapping Builder to get an editable copy, then add, remove, or re-target rules, for example to handle repeating segments, extra identifiers, or a different value set.