Skip to content
Lab interface guide · facts checked 13 November 2026

HL7 lab interface integration, from the order to the corrected result

How an EHR and a laboratory information system exchange orders and results over HL7 v2: sample ORM, OML, ORU and ACK messages, the test compendium and LOINC, abnormal flags and units, reflex, add-on and cancelled orders, a test plan and a realistic timeline.

Laboratory scientist in a white coat looking into a microscope at a lab bench
At a glance
  • Orders out, results backORM^O01 or OML^O21 to the LIS, ORU^R01 to the EHR
  • Compendium firstThe lab’s orderable codes, with LOINC for every result
  • Edge cases plannedReflex, add-on, cancelled and corrected tests
  • 8–12 weeksTypical span from specification to live, two-way

What is an HL7 lab interface?

An HL7 lab interface connects an EHR and a laboratory information system (LIS). The EHR sends each order as an HL7 v2 ORM^O01 message, or OML^O21 under the US lab ordering guide (LOI). The LIS acknowledges it, runs the tests and returns results as ORU^R01 messages, with LOINC codes, UCUM units, reference ranges and abnormal flags. Most of the work is not the messages: it is agreeing the test compendium, handling cancellations, reflex and add-on tests and corrections, and testing every path before go-live.

LIS to EHR interface, both directions

The happy path takes a week. The other paths take the rest

Sending a CBC order and getting a result back is easy to demonstrate. Live lab interfaces fail on everything around it: an order for a test code the lab retired last month, a result for a patient the EHR cannot match, a reflex culture the clinician never ordered and the EHR refuses to file, a cancellation that arrives after the sample was already run, and a corrected potassium that lands as a second result instead of replacing the first.

This guide covers a bidirectional lab interface as we build it in November 2026: the message flow, annotated sample messages, acknowledgements, the compendium and LOINC, flags, units and critical values, the order lifecycle edge cases, where analysers and ASTM fit, the test cases we run before go-live, and a week-by-week timeline with effort.

We build lab interfaces as part of our HL7 and EDI integration and healthcare interfaces work, usually on an engine you already run. We also build and run our own lab information system, so we see these messages from the lab side as well as the EHR side.

How orders and results flow between an EHR and a LIS

StepDirectionMessageWhat it means
1. Clinician ordersEHR → LISORM^O01 or OML^O21, ORC-1 = NWNew order with the placer order number (ORC-2), the lab’s test code (OBR-4), patient, insurance and answers to the lab’s questions.
2. ReceiptLIS → EHRACK (MSA-1 = AA, AE or AR)The message arrived and was, or was not, accepted. Not the same as “the lab will do it”.
3. Order acceptedLIS → EHRORR^O02 or ORL^O22, ORC-1 = OK, with the filler number (ORC-3)Optional application response. Many reference labs skip it and send the filler number on the first result.
4. Specimen receivedLIS → EHRORM or OML with ORC-1 = SC, or an ORU with OBR-25 = IStatus update; useful when the EHR tracks outstanding orders.
5. Preliminary resultLIS → EHRORU^R01, OBR-25 = P, OBX-11 = PPartial or unverified results, for example a culture with no organism identified yet.
6. Final resultLIS → EHRORU^R01, OBR-25 = F, OBX-11 = FVerified results. Replaces the preliminary values for the same order and test.
7. CorrectionLIS → EHRORU^R01, OBR-25 = C, OBX-11 = CA changed final result. Must update the original, keep the history and alert the clinician.

Each message the receiver accepts gets an ACK. Each identifier above has a job: the placer number is the EHR’s key, the filler number is the lab’s, and the specimen ID (SPM-2, or OBR-20 in older feeds) is the barcode on the tube. Every edge case later on this page comes down to keeping those three in step.

ORM^O01 or OML^O21?

ORM^O01 is the general order message from HL7 v2.3 and earlier, still the most common in existing lab interfaces. HL7 v2.5 introduced OML^O21, a laboratory order message with a specimen segment (SPM) and a timing segment (TQ1). The US realm Laboratory Orders Interface guide (LOI) specifies OML^O21 on v2.5.1, with its companion Laboratory Results Interface guide (LRI) for ORU^R01 results; both are now published as editions, with LOI Edition 5 published in May 2024. Use whatever the lab’s specification asks for. A new interface between two systems you control should use OML^O21 and the LOI and LRI profiles, because the specimen and timing data have a proper home.

Sample ORM^O01 (v2.3.1)

Illustrative and abridged; patient, clinic, lab and identifiers are invented. Two tests in one requisition, sharing a placer group number.

MSH|^~\&|EHR|CLINIC01|LIS|CITYLAB|20261113091500||ORM^O01|ORD000457|P|2.3.1
PID|1||884512^^^CLINIC01^MR||Sample^Asha^K||19880614|F|||12 Lake View Road^^Chennai^TN^600017^IND
PV1|1|O|OPD^^^CLINIC01||||D4521^Iyer^Anand^^^Dr
ORC|NW|PL-10045^EHR||GRP-77^EHR|||||20261113091400|||D4521^Iyer^Anand^^^Dr
OBR|1|PL-10045^EHR||CBC^Complete Blood Count^99CITYLAB^58410-2^CBC panel - Blood by Automated count^LN|||20261113090000|||||||||D4521^Iyer^Anand^^^Dr
DG1|1||R53.83^Other fatigue^I10
ORC|NW|PL-10046^EHR||GRP-77^EHR|||||20261113091400|||D4521^Iyer^Anand^^^Dr
OBR|2|PL-10046^EHR||HBA1C^Hemoglobin A1c^99CITYLAB^4548-4^Hemoglobin A1c/Hemoglobin.total in Blood^LN|||20261113090000|||||||||D4521^Iyer^Anand^^^Dr
  • OBR-4 carries the lab’s own orderable code first (CBC in the lab’s code system 99CITYLAB) and LOINC second. The lab bills and routes on its code; the LOINC is a courtesy.
  • ORC-4, the placer group number, ties the two tests to one requisition so the lab can print one label set.
  • OBR-7 is the collection time because the sample was drawn in the clinic. If the lab collects, leave it empty and the lab fills it.
  • Real ORMs usually add IN1 and GT1 segments for billing, and NTE or OBX segments for the lab’s questions.

Sample OML^O21 (v2.5.1, LOI style)

MSH|^~\&|EHR|CLINIC01|LIS|CITYLAB|20261113091500+0530||OML^O21^OML_O21|ORD000458|P|2.5.1|||AL|NE
PID|1||884512^^^CLINIC01^MR||Sample^Asha^K||19880614|F
ORC|NW|PL-10047^EHR||GRP-78^EHR|||||20261113091400+0530|||D4521^Iyer^Anand^^^Dr
TQ1|1||||||||R
OBR|1|PL-10047^EHR||GLUF^Glucose, fasting^99CITYLAB^1558-6^Fasting glucose [Mass/volume] in Serum or Plasma^LN|||20261113083000+0530|||||||||D4521^Iyer^Anand^^^Dr
OBX|1|CWE|49541-6^Fasting status - Reported^LN||Y^Yes^HL70136||||||O
SPM|1|SP-88123^EHR||119297000^Blood specimen^SCT|||||||||||||20261113083000+0530
  • MSH-15 = AL asks for an accept acknowledgement every time; MSH-16 = NE says no separate application acknowledgement is expected.
  • TQ1-9 carries the priority (R routine, S stat) that ORM put in the old quantity/timing field.
  • The OBX with result status O is an ask-at-order-entry answer: the lab’s compendium says a fasting glucose needs the fasting status, so the EHR must ask the clinician and send the answer.
  • SPM-2 is the specimen ID printed on the tube label; SPM-17 is the collection time.

Sample ORU^R01 (v2.5.1) with a critical value

MSH|^~\&|LIS|CITYLAB|EHR|CLINIC01|20261113143022+0530||ORU^R01^ORU_R01|RES004521|P|2.5.1|||AL|NE
PID|1||884512^^^CLINIC01^MR~LB-55120^^^CITYLAB^PI||Sample^Asha^K||19880614|F
ORC|RE|PL-10045^EHR|FL-99031^CITYLAB|GRP-77^EHR|CM
OBR|1|PL-10045^EHR|FL-99031^CITYLAB|CBC^Complete Blood Count^99CITYLAB^58410-2^CBC panel - Blood by Automated count^LN|||20261113090000+0530|||||||||D4521^Iyer^Anand^^^Dr||||||20261113142900+0530|||F
OBX|1|NM|718-7^Hemoglobin [Mass/volume] in Blood^LN||10.9|g/dL^g/dL^UCUM|12.0-15.5|L|||F|||20261113090000+0530
OBX|2|NM|6690-2^Leukocytes [#/volume] in Blood by Automated count^LN||7.2|10*3/uL^10*3/uL^UCUM|4.0-11.0|N|||F|||20261113090000+0530
OBX|3|NM|777-3^Platelets [#/volume] in Blood by Automated count^LN||48|10*3/uL^10*3/uL^UCUM|150-450|LL|||F|||20261113090000+0530
NTE|1|L|Critical value phoned to Dr Iyer 14:28 by technologist RK, read back confirmed.
SPM|1|SP-88123^EHR||119297000^Blood specimen^SCT|||||||||||||20261113090000+0530|20261113101500+0530
  • ORC-1 = RE means “observations to follow”; ORC-5 = CM says the order is complete. The filler number FL-99031 appears for the first time, and the EHR must store it against PL-10045.
  • The second PID-3 repetition is the lab’s own patient ID. Keep it; it is what the lab will quote when it phones.
  • OBX-3 is LOINC per analyte, OBX-6 is UCUM, OBX-7 the lab’s reference range, OBX-8 the flag: L low, N normal, LL below the lab’s critical limit.
  • The NTE after the platelet OBX belongs to that result, not the report. File it where the clinician sees it next to the value.

Acknowledgements

MSH|^~\&|EHR|CLINIC01|LIS|CITYLAB|20261113143023+0530||ACK^R01^ACK|ACK88812|P|2.5.1
MSA|AA|RES004521

MSH|^~\&|EHR|CLINIC01|LIS|CITYLAB|20261113150210+0530||ACK^R01^ACK|ACK88813|P|2.5.1
MSA|AE|RES004530
ERR||OBX^2^3|103^Table value not found^HL70357|E|||Unknown result code GLU-X

MSA-2 echoes the control ID from MSH-10 of the message being acknowledged. In original mode the codes are AA (accepted), AE (error, the sender should fix and resend) and AR (rejected, usually structural or a system problem). Enhanced mode, set through MSH-15 and MSH-16, splits a commit acknowledgement (CA, CE, CR: “I have stored it safely”) from a later application acknowledgement. Agree in writing which mode each side uses, and what the sender does on AE: retry forever, park the message in an error queue, or alert a person. An ACK sent before the message is safely stored is the root of most “lost results” incidents.

The test compendium and LOINC mapping

The compendium is the lab’s catalogue: every orderable test with its code, name, specimen and container, ask-at-order-entry questions, and the result codes it produces. HL7’s eDOS guide (Laboratory Test Compendium Framework) defines a way to send it electronically; in practice many labs still send a spreadsheet. Either way:

  • Orders use the lab’s codes. The EHR’s order catalogue must hold the lab’s orderable codes, because the lab routes, prices and bills on them. A LOINC order code is an optional extra, and many panels have no exact LOINC equivalent.
  • Results use LOINC per analyte. Each result code maps to one LOINC term chosen on component, property, timing, system, scale and method. Glucose in serum and glucose in whole blood are different LOINC codes; so are an automated and a manual differential count.
  • One owner, one version. Labs add and retire tests every month. Give the compendium a version, store it, diff each new release against the old one, and update the EHR catalogue before the lab switches codes, not after orders start failing.
  • Keep LOINC current. Regenstrief releases LOINC twice a year, in February and August; version 2.83 was announced in August 2026. Map new tests against the current release.
  • Ask-at-order-entry questions come from the compendium too: fasting status, collection volume for 24-hour urine, gestational age for prenatal screens. If the EHR does not ask them, the lab phones the clinic.

Abnormal flags, units, reference ranges and critical values

OBX-8Meaning (HL7 table 0078)What the EHR should do
NNormalDisplay without emphasis. An empty flag is not the same as N; it means the lab did not assess it.
L / HBelow low normal / above high normalHighlight; include in result review.
LL / HHBelow or above the lab’s critical (panic) limitHighest priority in the clinician’s inbox. The lab still telephones: US CLIA rules (42 CFR 493.1291(g)) require it to alert the requester immediately.
A / AAAbnormal / critically abnormal, for non-numeric resultsSame handling as H/HH for coded or text results.
< / >Below or above the measurable rangeShow with the value; never drop the comparator.
S / R / ISusceptible / resistant / intermediateMicrobiology sensitivities, displayed per organism and antibiotic.
  • Use the lab’s range, not the EHR’s. OBX-7 is the range for that analyser, method and patient. Many EHRs hold their own default ranges and recompute flags; switch that off for interfaced results or the flags disagree with the printed report.
  • Units in UCUM, never converted silently. If one lab reports glucose in mmol/L and another in mg/dL, store each as sent and convert only for display, labelled. A silent conversion is a clinical change.
  • Non-numeric values. “<0.01” belongs in an SN (structured numeric) value, “Positive” in CWE, a narrative in TX or FT. A value type the EHR cannot file must reject loudly, not truncate.

Reflex, add-on and cancelled orders

SituationHow it is signalledDecide up front
Reflex test (abnormal TSH triggers free T4; positive culture triggers sensitivities)The LIS creates a new order and sends its results as an extra OBR. OBR-29 (parent) points at the original placer and filler numbers; OBR-26 (parent result) names the OBX that triggered it.The EHR must file results for an order it never placed, link them to the parent, and show the clinician why the test was added. Billing needs to know too.
Add-on test (clinician phones to add a lipid panel to a sample already at the lab)Either the EHR sends a new NW order quoting the same specimen ID, or the lab creates it and sends ORC-1 = SN (send order number); the EHR replies NA (number assigned) with a placer number.Which side creates add-ons, and how the EHR finds the existing specimen.
Cancel before processingEHR sends ORC-1 = CA; the lab answers CR (cancelled as requested) or UC (unable to cancel) if the test has started.What the EHR shows while the cancel is pending, and that UC leaves the order open.
Lab cancels (haemolysed, insufficient volume, wrong tube)LIS sends ORC-1 = OC, or an ORU with OBX-11 = X (results cannot be obtained) and a reason in NTE.The clinician must be told and offered a reorder; a silently closed order is a missed diagnosis.
Corrected resultORU with OBR-25 = C and OBX-11 = C on the changed values, same placer, filler and OBX-3.Update in place, keep the old value visible as history, and notify whoever saw the original.
Wrong patientOBX-11 = W on the results filed to the wrong record, then a new result for the right patient.A manual review step: results must be removed from one chart and any action taken on them traced.
Unsolicited result (sample arrived on a paper requisition)ORU with a filler number and no placer number.Patient matching rules, and which clinician’s inbox receives it.

HL7’s newer LRI edition prefers parent/child linkage between orders over packing several OBRs under one ORC, which is another reason to agree the structure with real samples rather than from the specification alone.

Where analysers and ASTM fit

An EHR almost never talks to an analyser. The EHR talks HL7 to the LIS; the LIS, or middleware beside it, talks to each instrument. Many analysers use the ASTM protocols, now maintained by CLSI as LIS01-A2 (low-level transfer over serial or TCP) and LIS02-A2 (record format, formerly ASTM E1394), with header, patient, order, result and terminator records. Newer instruments often speak HL7 v2 directly, and some export files. Keep the two interfaces separate in your plan: the analyser side is about worklists, sample barcodes, reruns and QC flags; the EHR side is about orders, patients and clinicians. A result should reach the EHR only after the LIS has verified it, never straight from the instrument.

Transport and engine

  • MLLP over a VPN is still the usual transport for real-time HL7 between organisations; each side runs a listener and a sender, and agrees ports, IP allow-lists and certificates if MLLP is wrapped in TLS.
  • SFTP batches suit small clinics and reference labs that post results every few minutes; you lose immediate ACKs, so add file-level reconciliation.
  • HTTPS endpoints carrying HL7 v2 are increasingly common with cloud LIS and EHR products.
  • An integration engine (Mirth Connect, the Open Integration Engine, Rhapsody or Iguana) holds queues, retries, mapping and alerting. Our engine comparison covers the choice; if you are moving off an old Mirth version, see Mirth Connect migration.

The test plan we run before go-live

Each case is run in the test environments of both systems with the real compendium, and signed off by someone from the lab and someone from the clinic.

  1. New order for each order type: single test, panel, multiple tests in one requisition, stat and routine.
  2. Order with ask-at-order-entry answers, and an order missing a required answer (should be blocked in the EHR).
  3. Order with an unknown or retired test code (should be rejected with AE and reach a person).
  4. Cancel before receipt (CR), cancel after processing has started (UC), and a lab-initiated cancel with reason.
  5. Preliminary result followed by final; final followed by a correction; correction of a single analyte in a panel.
  6. Normal, high, low and critical results, including the phone-call note and the inbox priority.
  7. Non-numeric values: SN with comparators, coded results, long text reports and an embedded PDF if the lab sends one.
  8. Reflex test with parent linkage, and an add-on to an existing specimen.
  9. Microbiology: preliminary culture, organism identified, sensitivities with S, R and I.
  10. Unsolicited result, unmatched patient, and a patient whose demographics changed after the order.
  11. Duplicate message (same MSH-10 resent): must not file twice.
  12. Outage: stop the receiver for an hour, restart, confirm queued messages arrive in order with nothing lost.

After the scripted cases, run a parallel period: live orders flow electronically while the lab keeps sending the paper or PDF report, and someone compares the two daily until they match for a full week.

A realistic timeline: 8–12 weeks

Illustrative, not client work: one clinic group’s EHR and one reference lab’s LIS, orders and results both ways, on an existing integration engine. Effort is in engineer-days for our side and excludes the lab’s and the EHR vendor’s own staff.

WeeksPhaseWhat happensTypical effort
1–2Specifications and connectivityBoth sides’ HL7 specifications compared, message versions and ACK mode agreed, VPN and MLLP ports requested, sample messages collected4–6 engineer-days
2–4Compendium and mappingOrderable codes loaded into the EHR catalogue, result codes mapped to LOINC and units to UCUM, questions configured, edge-case rules written down6–10 engineer-days
3–6BuildOutbound order and inbound result channels, ACK handling, error queues, patient matching, alerting8–14 engineer-days
6–9TestingThe test plan above in both test environments, fixes, sign-off by lab and clinic6–10 engineer-days
9–12Parallel run and go-liveLive traffic alongside paper or PDF reports, daily comparison, cutover, a week of close monitoring, handover4–8 engineer-days

Total: roughly 28–48 engineer-days. What pushes it toward twelve weeks or beyond: waiting for the other side’s VPN and test environment (often the longest single delay), a lab compendium delivered as a PDF, microbiology and pathology reports, and EHR vendors who charge for and schedule their own interface work. A results-only interface, with orders still on paper, is usually five to seven weeks.

Packages

Lab interface packages

Typical effort in engineer-days. We confirm a fixed price per phase after reading both sides’ specifications and a set of sample messages.

Bidirectional lab interface

The problem

You need electronic orders to a lab and results back into the EHR, with the edge cases handled, not a demo.

How we do it

We compare both specifications, load the compendium, map results to LOINC and UCUM, build the order and result channels on your engine with ACK handling and error queues, run the full test plan and the parallel period. Typical effort: 28–48 engineer-days over 8–12 weeks.

What you get

  • Order and result channels in production
  • Compendium and LOINC mapping with version history
  • Signed-off test cases
  • Runbook and alerting
Timeline

How a lab interface engagement runs

For one EHR and one lab. Each further lab reuses the build and adds compendium, mapping and testing.

Weeks 1–2

Specifications and access

Both HL7 specifications, sample messages, ACK mode, VPN and test environments requested on day one.

Weeks 2–4

Compendium and rules

Order catalogue, LOINC and UCUM mapping, ask-at-order-entry questions, and written rules for every edge case.

Weeks 3–9

Build and test

Channels on your engine, error queues and alerts, then the full test plan with sign-off from the lab and the clinic.

Weeks 9–12

Parallel run and handover

Electronic and paper results compared daily, cutover, a week of close monitoring, runbook and handover.

Senior engineers firstYour first call is with someone who will do the work, not a sales script.
You own everythingCode, configuration, reports and documentation stay in your accounts and are handed over.
We run our own products15 live platforms we build and operate, so we feel production pain too.
Honest about fitIf a cheaper route or another provider suits you better, we will say so.
FAQ

HL7 lab interfaces: common questions

ORM^O01 carries an order from the EHR to the lab: the patient, the tests requested, the ordering clinician and the placer order number. ORU^R01 carries results back: one OBR per test or panel and one OBX per result value, with LOINC codes, units, reference ranges and abnormal flags. Newer interfaces use OML^O21 in place of ORM.

If the lab’s specification asks for ORM, use ORM. Between systems you control, prefer OML^O21 on HL7 v2.5.1 following the US Laboratory Orders Interface guide, because it has proper segments for the specimen and for timing and priority, and pairs with the Laboratory Results Interface guide for ORU^R01.

A bidirectional interface between one EHR and one lab usually takes 8 to 12 weeks from specification to live, or roughly 28 to 48 engineer-days of our effort. The longest delays are often waiting for the other side’s VPN, test environment and compendium. A results-only interface is usually five to seven weeks.

The compendium is the lab’s catalogue of orderable tests, with codes, specimen requirements, ask-at-order-entry questions and the results each test produces. Orders must use the lab’s codes, so the EHR’s catalogue has to match the current compendium. Labs change it often, so it needs an owner and a version history.

The lab creates a new order and sends its results as an additional OBR, with OBR-29 pointing to the original order’s placer and filler numbers and OBR-26 naming the result that triggered it. The EHR must be able to file results for an order it never placed and show the clinician the link to the parent test.

The lab resends the result with status C in OBR-25 and OBX-11, using the same order numbers and test code. The EHR should update the existing result rather than add a second one, keep the previous value visible as history, and notify the clinician who saw the original.

Almost never. Analysers connect to the LIS or to middleware, often over the ASTM protocols now maintained by CLSI as LIS01-A2 and LIS02-A2, or over HL7 v2. The LIS verifies results and only then sends them to the EHR as ORU messages.

Original mode, with AA, AE and AR in MSA-1, is the most common and is enough for most lab interfaces. Whichever mode you choose, the receiver should acknowledge only after the message is safely stored, and both sides should agree in writing what happens to messages that get an AE or AR.

Last updated