HL7 v2.5.1 segment reference

Field guides for the segments you meet most on hospital interfaces. Original notes checked against HL7 v2.5.1, not a copy of the standard.

MSHEVNPIDPV1NK1AL1DG1IN1MRGORCOBROBXMSAERR

MSH — Message Header

The envelope on every v2 message: who sent it, who should get it, what kind it is, and its unique control ID. Chapter 2 (Control) HL7 v2.5.1

FieldName / typeIn plain words
MSH-1Field Separator
ST
The character that separates fields. Almost always |.
MSH-2Encoding Characters
ST
Four characters: component, repetition, escape, subcomponent. Usual value: ^~\&.
MSH-3Sending Application
HD
Software that built the message (Penford example: PENEHR).
MSH-4Sending Facility
HD
Site or organization that sent it (PMC).
MSH-5Receiving Application
HD
Intended receiving application.
MSH-6Receiving Facility
HD
Intended receiving facility.
MSH-7Date/Time of Message
TS
When the message was created (YYYYMMDDHHMMSS±ZZZZ).
MSH-8Security
ST
Optional security field; rarely used on hospital ADT feeds.
MSH-9Message Type
MSG
Message code ^ trigger ^ structure, e.g. ADT^A04^ADT_A01.
MSH-10Message Control ID
ST
Unique id for this instance; the ACK echoes it.
MSH-11Processing ID
PT
P (production), T (training), or D (debugging) — Table 0103.
MSH-12Version ID
VID
v2 version claimed by the sender, e.g. 2.5.1.
MSH-15Accept Acknowledgment Type
ID
Enhanced-mode accept ACK expectation (AL/NE/ER/SU) — Table 0155.
MSH-16Application Acknowledgment Type
ID
Enhanced-mode application ACK expectation — Table 0155.
MSH-18Character Set
ID
Character set(s), e.g. ASCII, UNICODE UTF-8 — Table 0211.

Back to top

EVN — Event Type

When the real-world event happened, and who recorded it — separate from MSH-7 (when the message was built). Chapter 3 (Patient Administration) HL7 v2.5.1

FieldName / typeIn plain words
EVN-1Event Type Code
ID
Optional echo of the trigger (A04…). Often empty when MSH-9 already carries it.
EVN-2Recorded Date/Time
TS
When the event was recorded in the system.
EVN-3Date/Time Planned Event
TS
For planned events.
EVN-4Event Reason Code
IS
Why the event occurred — Table 0062 / user-defined.
EVN-5Operator ID
XCN
Who entered the event.
EVN-6Event Occurred
TS
When the event actually happened (may differ from recorded time).
EVN-7Event Facility
HD
Facility where the event occurred.

Back to top

PID — Patient Identification

Who the patient is: identifiers, name, DOB, sex, address, phone, account. Chapter 3 HL7 v2.5.1

FieldName / typeIn plain words
PID-1Set ID – PID
SI
Sequence when multiple PID segments appear (usually 1).
PID-2Patient ID
CX
Deprecated/withdrawn path; prefer PID-3.
PID-3Patient Identifier List
CX
MRN, account, etc. with assigning authority and type (MR, AN…).
PID-4Alternate Patient ID
CX
Deprecated; prefer PID-3 repetitions.
PID-5Patient Name
XPN
family^given^middle^…
PID-6Mother's Maiden Name
XPN
Sometimes used for matching newborns.
PID-7Date/Time of Birth
TS
YYYYMMDD (optionally with time).
PID-8Administrative Sex
IS
Table 0001: M, F, O, U, A, N…
PID-10Race
CE
Coded race; privacy-sensitive.
PID-11Patient Address
XAD
Street, city, state, ZIP…
PID-13Phone Number – Home
XTN
Prefer XTN components over a free-text blob.
PID-14Phone Number – Business
XTN
Work phone.
PID-16Marital Status
CE
Table 0002.
PID-18Patient Account Number
CX
Visit/account id many ancillaries require.
PID-19SSN Number – Patient
ST
Backward-compatible in 2.5.1; prefer PID-3 type SS. PHI.
PID-22Ethnic Group
CE
Coded ethnicity; privacy-sensitive.
PID-29Patient Death Date and Time
TS
Populated on discharge/death events.
PID-30Patient Death Indicator
ID
Y/N style death indicator — Table 0136.

Back to top

PV1 — Patient Visit

How the patient is here now: class, location, attending, admit time. Chapter 3 HL7 v2.5.1

FieldName / typeIn plain words
PV1-1Set ID – PV1
SI
Usually 1.
PV1-2Patient Class
IS
Table 0004: E, I, O, P, R…
PV1-3Assigned Patient Location
PL
Point of care / room / bed / facility.
PV1-4Admission Type
IS
Table 0007.
PV1-7Attending Doctor
XCN
Current attending.
PV1-8Referring Doctor
XCN
Referring provider.
PV1-10Hospital Service
IS
Service code (MED, SUR…).
PV1-14Admit Source
IS
Table 0023.
PV1-17Admitting Doctor
XCN
Who admitted the patient.
PV1-18Patient Type
IS
User-defined patient type.
PV1-19Visit Number
CX
Visit identifier.
PV1-36Discharge Disposition
IS
Table 0112.
PV1-44Admit Date/Time
TS
When the visit started.
PV1-45Discharge Date/Time
TS
When the visit ended.

Back to top

NK1 — Next of Kin / Associated Parties

Emergency contact or related person. Chapter 3 HL7 v2.5.1

FieldName / typeIn plain words
NK1-1Set ID – NK1
SI
Sequence number.
NK1-2Name
XPN
Contact name.
NK1-3Relationship
CE
Table 0063 (SPO, ENC…).
NK1-4Address
XAD
Contact address.
NK1-5Phone Number
XTN
Contact phone.
NK1-7Contact Role
CE
Table 0131.

Back to top

AL1 — Patient Allergy Information

Allergy or adverse reaction on the patient record. Chapter 3 HL7 v2.5.1

FieldName / typeIn plain words
AL1-1Set ID – AL1
SI
Sequence.
AL1-2Allergen Type Code
CE
Table 0127 (DA drug, FA food…).
AL1-3Allergen Code/Mnemonic/Description
CE
What they are allergic to.
AL1-4Allergy Severity Code
CE
Table 0128.
AL1-5Allergy Reaction Code
ST
Reaction description.
AL1-6Identification Date
DT
When the allergy was identified.

Back to top

DG1 — Diagnosis

A diagnosis code tied to the visit or account. Chapter 6 (Financial) / used widely HL7 v2.5.1

FieldName / typeIn plain words
DG1-1Set ID – DG1
SI
Sequence.
DG1-2Diagnosis Coding Method
ID
Deprecated in later versions; often empty in 2.5.1 feeds.
DG1-3Diagnosis Code – DG1
CE
ICD code ^ text ^ coding system.
DG1-4Diagnosis Description
ST
Free-text description when not fully coded.
DG1-5Diagnosis Date/Time
TS
When diagnosed.
DG1-6Diagnosis Type
IS
Table 0052 (A admitting, W working, F final…).

Back to top

IN1 — Insurance

Coverage information for billing interfaces. Chapter 6 HL7 v2.5.1

FieldName / typeIn plain words
IN1-1Set ID – IN1
SI
Sequence (primary = 1).
IN1-2Insurance Plan ID
CE
Plan identifier.
IN1-3Insurance Company ID
CX
Payer id.
IN1-4Insurance Company Name
XON
Payer name.
IN1-16Name Of Insured
XPN
Subscriber name.
IN1-17Insured's Relationship To Patient
CE
Table 0063.
IN1-36Policy Number
ST
Member/policy number.

Back to top

MRG — Merge Patient Information

On merge events (A18/A34/A40…): which prior identifiers are being retired. Chapter 3 HL7 v2.5.1

FieldName / typeIn plain words
MRG-1Prior Patient Identifier List
CX
Old MRN(s) being merged away.
MRG-2Prior Alternate Patient ID
CX
Deprecated alternate id.
MRG-3Prior Patient Account Number
CX
Old account if merging accounts.
MRG-5Prior Visit Number
CX
Old visit number.
MRG-7Prior Patient Name
XPN
Name on the prior record.

Back to top

ORC — Common Order

Order control and status that apply across the order — pairs with OBR on ORM/ORU. Chapter 4 (Order Entry) HL7 v2.5.1

FieldName / typeIn plain words
ORC-1Order Control
ID
Table 0119: NW new, CA cancel, SC status change…
ORC-2Placer Order Number
EI
Order id from the placer (EHR).
ORC-3Filler Order Number
EI
Order id from the filler (lab/RIS).
ORC-5Order Status
ID
Table 0038.
ORC-9Date/Time of Transaction
TS
When this ORC was produced.
ORC-12Ordering Provider
XCN
Who ordered.
ORC-17Entering Organization
CE
Organization that entered the order.

Back to top

OBR — Observation Request

What was ordered or reported: service id, times, specimen, result status. Chapters 4 & 7 HL7 v2.5.1

FieldName / typeIn plain words
OBR-1Set ID – OBR
SI
Sequence under the order.
OBR-2Placer Order Number
EI
Placer id (may mirror ORC-2).
OBR-3Filler Order Number
EI
Filler id.
OBR-4Universal Service Identifier
CE
Test/procedure code ^ text ^ system.
OBR-7Observation Date/Time
TS
Clinically relevant observation time.
OBR-14Specimen Received Date/Time
TS
When specimen arrived.
OBR-16Ordering Provider
XCN
Ordering clinician.
OBR-22Results Rpt/Status Chng – Date/Time
TS
When results were reported/changed.
OBR-24Diagnostic Serv Sect ID
ID
Table 0074: LAB, RAD…
OBR-25Result Status
ID
Table 0123: F final, P preliminary…

Back to top

OBX — Observation/Result

One result row: what was measured, the value, units, flags, status. Chapter 7 (Observation Reporting) HL7 v2.5.1

FieldName / typeIn plain words
OBX-1Set ID – OBX
SI
Sequence under the OBR.
OBX-2Value Type
ID
Table 0125: NM, ST, TX, CWE, SN…
OBX-3Observation Identifier
CE
Code ^ text ^ coding system (often LOINC / LN).
OBX-4Observation Sub-ID
ST
Distinguishes repeats of the same OBX-3.
OBX-5Observation Value
varies
The result; shape must match OBX-2.
OBX-6Units
CE
Units for numeric results.
OBX-7References Range
ST
Normal range text.
OBX-8Abnormal Flags
IS
Table 0078: H, L, N, AA…
OBX-11Observation Result Status
ID
Table 0085: F, P, C, X…
OBX-14Date/Time of the Observation
TS
Observation time for this row.

Back to top

MSA — Message Acknowledgment

How the receiver answered, plus the echoed control ID. Chapter 2 HL7 v2.5.1

FieldName / typeIn plain words
MSA-1Acknowledgment Code
ID
Table 0008: AA, AE, AR, CA, CE, CR.
MSA-2Message Control ID
ST
Echo of the original MSH-10.
MSA-3Text Message
ST
Optional human-readable note.
MSA-4Expected Sequence Number
NM
For sequence-number protocol.
MSA-6Error Condition
CE
Older error coding; prefer ERR segment in 2.5+.

Back to top

ERR — Error

Structured error detail for AE/AR (and enhanced-mode CE/CR) responses. Chapter 2 HL7 v2.5.1

FieldName / typeIn plain words
ERR-1Error Code and Location
ELD
Deprecated location form; still seen on older feeds.
ERR-2Error Location
ERL
Segment/field/component location of the problem.
ERR-3HL7 Error Code
CWE
Table 0357 message error condition.
ERR-4Severity
ID
Table 0516: I/W/E/F…
ERR-5Application Error Code
CWE
App-specific code (detail for 207).
ERR-6Application Error Parameter
ST
Parameters for the app error.
ERR-7Diagnostic Information
TX
Technical diagnostics.
ERR-8User Message
TX
Message safe to show an analyst.

Back to top

Official definitions: HL7 v2.5.1. Related: ACK & error codes · Glossary · HL7 viewer