Lesson 2 of 51 · Foundations
Anatomy of an HL7 v2 Message
A message is a stack of segments
An HL7 v2 message is plain text. Each line is a segment, identified by a three-letter code, and the segments appear in an order defined for that message type 1. Here is a minimal admit message:
MSH|^~\&|ADT1|HOSP|LAB|HOSP|202406011230||ADT^A01|MSG00001|P|2.5
EVN|A01|202406011230
PID|1||100711^^^HOSP^MR||DOE^JANE^Q||19800101|F
PV1|1|I|2000^2012^01||||004777^SMITH^JOHN
Read it top to bottom: the message header (MSH), the event (EVN), the patient
identification (PID), and the patient visit (PV1). Each line is one segment.

Fields, components, and the encoding characters
Within a segment, the vertical bar | separates fields. Inside a field, the
caret ^ separates components. Two more characters complete the set: ~
repeats a field, and & separates subcomponents. Together these four — plus the
field separator itself — are the encoding characters.
Crucially, a message declares its own delimiters. Look at the start of MSH:
MSH|^~\&|...
The character immediately after MSH (here |) is defined as the field
separator, and the next four (^~\&) are the component, repetition, escape, and
subcomponent characters. A parser reads these first and uses them to interpret
everything that follows 1.
So in DOE^JANE^Q, the PID name field carries three components — family name,
given name, and middle initial — not three separate fields.
Trigger events: why this message exists
The MSH-9 field above holds ADT^A01. The ADT message type covers
Admission, Discharge, and Transfer activity; A01 is the specific
trigger event meaning “patient admit.” HL7 v2 is event-driven: a real-world
occurrence in one system (an admission) generates a message that notifies the
others 2. The same ADT structure, with a different trigger
code, carries a discharge (A03) or a transfer (A02).
This pairing — a reusable message structure selected by a specific trigger event — is the core mental model of v2, and the thing to carry forward: later standards change the syntax, but the idea that a clinical event drives a structured exchange never goes away.
References
- HL7 Standards — Section 1d: Version 2 (V2). HL7 International. verified
- Tim Benson, Grahame Grieve. Principles of Health Interoperability: FHIR, HL7 and SNOMED CT. 4th ed. Springer. 2021. verified