---
title: "HL7 v2: the messaging backbone of hospitals"
description: "HL7 Version 2: pipe-delimited encoding, segments, message types (ADT, ORM, ORU, SIU, MDM), MLLP transport. Role in the Italian hospital landscape and Open Source tooling for integration."
url: "https://www.noze.it/en/insights/hl7-v2-hospital-messaging/"
lang: "en"
alternate: "https://www.noze.it/insights/hl7-v2-messaging-ospedaliero/"
published: "2012-02-20"
author: "noze S.r.l."
keywords: "Digital Health, R&D, HL7, HL7v2, Messaging, Interoperability, MLLP, Mirth Connect, HAPI"
---

# HL7 v2: the messaging backbone of hospitals

HL7 Version 2: pipe-delimited encoding, segments, message types (ADT, ORM, ORU, SIU, MDM), MLLP transport. Role in the Italian hospital landscape and Open Source tooling for integration.

20 February 2012

## A mature standard, still dominant

**Health Level Seven Version 2** — universally abbreviated **HL7 v2** — was born in **1987** as a standard for exchanging messages between healthcare information systems. Twenty-five years later it remains the most widespread integration protocol in Italian and international hospitals: in nearly every real-world scenario, communication between HIS (Hospital Information System), RIS (Radiology), LIS (Laboratory), clinical pharmacy and departmental systems goes through HL7 v2 messages.

Versions in the field coexist: **v2.3** (1997) and **v2.3.1** (1999) are still present in legacy installations; **v2.4** (2000) and **v2.5** (2003) represent the most common baseline in Italian deployments; **v2.5.1** (2007) and **v2.6** (2007) are adopted by more recent systems; **v2.7** (ANSI 2011) is the most up-to-date version of the standard at this time.

## The encoding: segments, fields, separators

HL7 v2 defines a text format with hierarchical separators. Each message is a sequence of **segments** delimited by carriage return; each segment is a sequence of **fields** separated by the pipe character `|`; fields can contain **components** separated by caret `^`, **sub-components** separated by ampersand `&`, and **repetitions** separated by tilde `~`. The backslash `\` is the escape character.

The first segment of every message is **MSH** (Message Header), which declares separators, sender, receiver, message type and control id. A hospital admission ADT typically begins:

```
MSH|^~\&|HIS|HOSP|RIS|RAD|201202201030||ADT^A01|MSG00001|P|2.5
EVN|A01|201202201030
PID|1||123456^^^HOSP^MR||ROSSI^MARIO||19501225|M
PV1|1|I|WARD1^101^1|...
```

The most common segments are **PID** (Patient Identification), **PV1** (Patient Visit), **OBR** (Observation Request), **OBX** (Observation/Result), **ORC** (Common Order), **AL1** (Allergy Information), **DG1** (Diagnosis), **NK1** (Next of Kin).

## Message types

Each clinical flow has one or more dedicated message types. The main ones:

- **ADT** (Admission, Discharge, Transfer): patient demographics and movements. Events such as `A01` (admit), `A03` (discharge), `A08` (update information), `A11` (cancel admit)
- **ORM / OMG / OML**: orders — for drugs, lab tests, radiology procedures. From v2.5, `ORM^O01` is formally deprecated in favour of domain-specific messages (`OMG`, `OML`, `OMP`)
- **ORU^R01**: observation results and reports from lab instruments and modalities
- **SIU**: scheduling — bookings, rescheduling, cancellations
- **MDM**: medical document management (textual reports, discharge letters)
- **DFT**: detailed financial transactions
- **VXU**: vaccination record update

## Transport: MLLP over TCP

HL7 v2 does not mandate a single transport protocol, but the de-facto practice is **MLLP** (Minimal Lower Layer Protocol): the message is wrapped between a start byte `<SB>` (`0x0B`), the payload, an end byte `<EB>` (`0x1C`), followed by carriage return `<CR>` (`0x0D`). The connection runs over TCP, typically on dedicated ports between servers within the hospital network. The application-level acknowledgement is an **ACK** message with `MSA-1` set to `AA` (Application Accept), `AE` (Application Error) or `AR` (Application Reject).

## The Italian landscape

In Italy HL7 v2 is the shared language of hospital integrations. Regional Electronic Health Record programmes, links between HIS and departmental systems, exchanges between laboratories and requesters all flow through HL7 v2. The **HL7 Italia** community, an affiliate of HL7 International, coordinates standardisation work locally — although the more elaborate Italian profiles concern the document level (CDA R2) rather than v2 messaging.

The coexistence of different versions and the wide customisation of messages by vendors turns integration into concrete work: an ADT from one specific HIS must be mapped and adapted to the format expected by the receiving system, even when both claim conformance to the same version of the standard.

## Open Source tooling

The Open Source ecosystem provides two mature components:

- **Mirth Connect** (Mirth Corporation) is a Java _integration engine_ based on channels: each channel consumes messages from a source (MLLP listener, file, database, HTTP), filters and transforms them via JavaScript, and routes them to multiple destinations. The 2.x release line is the current one in production use. Mozilla Public License
- **HAPI** (HL7 Application Programming Interface) is the reference Java library for parsing, validation and construction of HL7 v2 messages. Originally developed at the **University Health Network** in Toronto, it is used as the parsing engine by many engines — including Mirth Connect

Both projects cover versions from v2.1 up to v2.6/v2.7 and allow building integration nodes without depending on commercial proprietary products.

## Limits and outlook

HL7 v2’s limits are well known: non self-describing format, widespread optionality of fields, error tolerance that turns into heavy variability between implementations, no formal clinical semantics. These same limits motivate later standardisation efforts — the **CDA (Clinical Document Architecture)** for structured clinical documents, and the ongoing HL7 work on a resource-based model with REST APIs. HL7 v2 remains, however, the protocol on which the integration of currently deployed hospital systems is actually built.

---

_References: HL7 Version 2.5, 2.6, 2.7 (ANSI-approved), HL7 International. Mirth Connect (Mirth Corporation). HAPI — The Open Source HL7 API for Java (University Health Network)._
