Introduction to HL7v2
The messaging standard that carries clinical and administrative data between healthcare systems.
HL7v2 is the messaging standard that makes healthcare information systems interoperable. A hospital runs many such systems, typically from different vendors: the electronic health record (EHR), the laboratory information system (LIS), and the pharmacy, scheduling, and billing systems. Each holds part of a patient's information and depends on data that the others produce. HL7v2 gives these systems a common format for exchanging clinical and administrative data, so that each can interpret data from the others without a custom interface for each pair.
A system sends an HL7v2 message when an event occurs, such as a patient admission, a new order, or a completed result. Because every system follows the same message types and structures, systems built independently can exchange these messages and interpret them in the same way, and a profile fixes the options that the standard leaves open for each interface.
First published in 1988, HL7v2 is one of the most widely implemented healthcare standards. The name HL7 refers both to a family of standards and to the organization that develops them, and HL7v2 is one standard in that family.
HL7 standards
HL7 (Health Level Seven) is a family of international standards for the exchange, integration, sharing, and retrieval of electronic health information. The name refers to the seventh layer of the OSI model (opens in a new tab), the application layer, because the standards define the content and meaning of the data that applications exchange rather than the transport that carries it.
The family includes several standards, which differ in format and in how systems interact:
| Standard | First published | Format and interaction |
|---|---|---|
| HL7v2 | 1988 (v2.0) | Delimited text messages, pushed from system to system as events happen. |
| HL7v3 | 2005 | XML messages derived from a formal Reference Information Model (RIM). |
| Clinical Document Architecture (CDA) (opens in a new tab) | 2000 (R1), 2005 (R2) | XML clinical documents built on the HL7v3 model. |
| FHIR | 2014 (DSTU 1), 2018 (R4) | REST APIs over JSON or XML resources. |
HL7v3 messaging was adopted mainly in national programs. CDA is widely used for clinical documents, and FHIR is HL7's standard for API-based exchange. HL7v2 remains the predominant standard for event-driven integration within and between institutions, and FHIR is usually deployed alongside HL7v2 rather than as a replacement for it.
HL7 International
The standards are developed and maintained by Health Level Seven International (opens in a new tab), a not-for-profit, ANSI (opens in a new tab)-accredited standards-developing organization founded in 1987. The same abbreviation names both the organization and its standards.
HL7 International develops its standards through work groups of volunteers from member organizations worldwide. It publishes the standards, implementation guides that constrain them for specific uses, and the terminology that coded fields use. Since 2013, the standards have been available free of charge after registration.
HL7v2
HL7v2 defines a text format for messages, a catalog of message types that correspond to events in a healthcare organization, and the rules for acknowledging each message. Messages travel between the systems within a hospital and between institutions.
The text format belongs to the lineage of electronic data interchange (EDI) standards such as X12 (opens in a new tab), which businesses have used since the 1980s to exchange documents such as orders and invoices, and which US healthcare uses for claims and payments. Like X12, HL7v2 represents data as segments whose values are separated by delimiter characters.
Example
A laboratory order shows the typical pattern. The EHR holds the patient's demographic data and records the physician's order. The EHR sends the order to the LIS as an order message. The LIS performs the test and returns the result to the EHR as a result message, where the physician can review it. Each transfer is a separate HL7v2 message, sent by a source system to a destination system.
A message is a hierarchy of segments, fields, and components that represent the data associated with an event, such as patient demographics, clinical observations, orders, and results. The following example shows a laboratory order as a version 2.8 OML O21 message:
MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|20230630120000||OML^O21^OML_O21|MSG000001|P|2.8|
PID|1||12345||Doe^John||19700101|M|||123 Main St^Anytown^CA^12345||555-123-4567|||||S||12345678|
PV1|1|O|^^^Hospital^Bed^100|||12345^Smith^Jane^^Dr.|^|||Ward^^^Hospital|||||||||||||||||||||||||20230630120000|
ORC|NW|ORD000001^Lab|
OBR|1|ORD000001^Lab||^Complete Blood Count|||20230630120000|||12345^Smith^Jane^^Dr.|||20230630120000||Urgent|||Specimen^Blood|||||||||||||F|Reading the example
Message structure explains each part of this message: segments, fields, components, and delimiters.
Scope
HL7v2 messages report the events in a patient's care to the systems that need them. A hospital typically uses HL7v2 for the following workflows:
- Patient administration. Registration, admission, transfer between units, and discharge, sent as
ADTmessages. - Orders. Requests for laboratory tests, imaging studies, and medications, sent as order messages such as
ORMandOML. - Results. Laboratory results, vital signs, and imaging reports, sent as
ORUmessages. - Scheduling. Appointment bookings, changes, and cancellations, sent as
SIUmessages. - Billing. Charges for services, sent as
DFTmessages. - Documents. Clinical notes and reports, such as discharge summaries, sent as
MDMmessages.
The same messages connect a hospital to external laboratories, imaging centers, and public-health registries. Trigger events describes these messages and the events that trigger them.
Each message is sent when its event occurs: the registration system sends an ADT message as soon as a patient is admitted, without waiting for another system to ask for it. HL7v2 also defines query messages, which request data from another system, but most interfaces use event messages.
Versions
The standard has been revised regularly since 1988. Each release adds segments, fields, and data types while keeping earlier structures intact, so a system built for a later version can, in principle, read messages from an earlier one. Installations commonly run several versions at once; versions 2.3, 2.3.1, and 2.5.1 are the most common in production. Versioning describes what changed between versions, what backward compatibility guarantees, and how to select a version when the source and destination systems support different ones.
Limitations
Several elements of a working interface are outside the scope of the standard.
- Transport. The standard defines messages, not the means of delivering them. MLLP is published as a separate transport specification, and HTTP and web-service bindings are defined separately from both.
- Security. The standard does not define authentication, authorization, or encryption. These are provided by the transport layer, for example through TLS and network controls, and by local policy.
- Clinical terminology. The standard defines its own tables for administrative values, such as patient class and acknowledgment codes, and refers to external vocabularies for clinical content: LOINC for observations, SNOMED CT for findings, and ICD for diagnoses. See Tables.
- Document content. A discharge summary or a pathology report is a clinical document. A message can carry a document, but the document's structure is defined by another standard, usually the Clinical Document Architecture (CDA) (opens in a new tab).
- The interface agreement. The standard defines what a message can contain. The options that a particular pair of systems uses are specified in their profile; the standard defines only how to write a profile.
- Destination processing. The standard defines the meaning of an
ADT^A08(update patient information). The processing that the destination system performs in response, including the records it changes and the workflows it starts, is defined by the destination system itself.
Further reading
The pages in this section first describe how HL7v2 works as a whole, then the details of messages and how interfaces vary.
- Message flow — how systems exchange messages: an event in one system produces a message that another system processes and acknowledges.
- Trigger events — what each message means: the event that triggered it and the kind of information it carries.
- Message structure — what a message is made of: segments, fields, components, and the delimiters between them.
- Conformance — how two systems agree on exactly which messages, segments, and fields an interface uses.
- Acknowledgments, MLLP, and Interface engines — how delivery is confirmed, how messages travel over the network, and how production deployments connect many systems.
- Data types and Tables — what goes inside a field: how each value is written, and the code lists that coded values come from.
- Z-segments and Versioning — how interfaces differ in practice: local extensions and differences between releases of the standard.
The glossary defines the vocabulary of HL7v2.