DEV Community

Cover image for Lab Integration: Why Results Break and How to Fix It
Nirmitee.io
Nirmitee.io

Posted on Originally published at nirmitee.io

Lab Integration: Why Results Break and How to Fix It

Lab data still moves on 1990s HL7 v2 messages, and every lab sends them differently. The production problems to plan for.

Originally published on Nirmitee.io: The Lab Integration Nobody Wants to Talk About: Mapping HL7 ORM/ORU to FHIR DiagnosticReport in Production

Healthcare interoperability has made real progress in the last decade. But lab data still moves on HL7 v2 messages designed in the 1990s. The reason, per the source, is simple: the lab system ecosystem is extraordinarily fragmented.

  • Reference labs such as Quest, Labcorp and BioReference each send results with their own ordering, codes and abnormal flags.
  • Hospital core labs produce feeds that reflect their own internal data models, not what the receiving EHR expects.
  • Point-of-care devices may send standard messages, device-specific formats, or results someone typed in by hand.
  • Specialty labs in genetics, toxicology and pathology send embedded PDF reports, long text narratives or local codes.

So lab integration is hard not because the standards are bad, but because adherence varies wildly across vendors. If you are connecting an EHR or product to labs, budget time for mapping each lab separately.

Orders out, results back

Lab integration data flow: LIS to EHR via HL7 v2 ORM and ORU messages translated to FHIR DiagnosticReport

Orders out, results back, mapped to FHIR. Source: Nirmitee.io

Two HL7 v2 messages drive lab integration:

  • The order message (ORM) goes from the EHR to the lab system when a clinician orders a test. It carries the patient, the visit, the ordering provider and the test requested. The order context matters, because it affects how you interpret the results.
  • The result message (ORU) carries results back. This is where the real complexity lives, and the message type that causes the most integration failures in production.

Each result message carries the test or panel, an overall status (preliminary, final, corrected or cancelled), and one line per result with its value, units and an abnormal flag. A small field on each line says what kind of value it holds: a number, text, a code or free text. Read it wrong and the data is corrupted.

How it maps to FHIR

When downstream systems use FHIR, the mapping is consistent:

  • An order becomes a FHIR ServiceRequest, plus a Task if you need to track progress.
  • A result message becomes a DiagnosticReport that points to one Observation for each result.

The original guide includes the complete field-by-field mapping table, with a sample message explained.

Six production problems

Top lab integration gotchas: vendor-specific result ordering, panel grouping, abnormal flags and more

The production issues every lab interface meets. Source: Nirmitee.io

The mapping table looks clean. Production is not. The source's list:

1. Panels versus single tests. A complete blood count is one order that produces many results. Some labs send it as one group, others as separate groups for each result. Your system has to group them correctly either way.

2. Abnormal flags do not map one to one. Some labs use their own symbols for abnormal or critical results, and some omit the flag for normal results. You need a lookup table for each lab vendor.

3. Preliminary, then final, then corrected. Labs often send a preliminary result, then a final one, and sometimes a correction. The final must update the existing report, not create a new one. Otherwise clinicians see the same result twice in the chart, which the source calls a patient safety risk. Going backward, from final to preliminary, should be rejected or flagged.

4. Missing or local codes. Ideally every result carries a standard LOINC code. In reality, many labs send their own codes, so you need a mapping table from each lab's codes to LOINC.

5. Time zones. Many labs leave the time zone off timestamps. Assume wrong, and a sample collected at 12:15 PM Eastern can be stored as 7:15 AM Eastern. Clinicians will see the wrong collection time. Each lab interface needs its own time zone setting.

6. Specimen details. The specimen source, such as venous blood, maps to its own FHIR resource that both the order and the report must point to.

Per the source, time zones, abnormal flags and panel grouping are the three issues every lab interface meets. Design for them from the start.

The takeaway

Lab integration will never be plug and play. But with solid message parsing, disciplined FHIR mapping and configuration for each lab, it can become a reliable pipeline instead of the fragile point-to-point interface it so often is. The full guide covers each issue with examples.


Nirmitee.io builds lab integrations between EHRs, lab systems and reference labs, across HL7 v2 and FHIR. For the full mapping reference and production fixes, read the original: Mapping HL7 ORM/ORU to FHIR DiagnosticReport on Nirmitee.io.

Dinesh Thorat is Healthtech Growth Partner at Nirmitee.io.

Originally published at nirmitee.io.

Top comments (0)