HL7 v2.x Message Samples & Segment Specifications

Reference repository for real-world HL7 v2 message structures, segment definitions, and field mappings used in production EHR integration engine pipelines.

ADT^A01 - Patient Admission Message

Generated when a patient is admitted into a hospital or inpatient facility.

ADT / Admission
HL7 v2.3 / Pipe-Delimited
MSH|^~\&|EPIC|HOSPITAL_A|MIRTH|CLINIC_B|20260715093000||ADT^A01|MSG00001|P|2.3
EVN|A01|20260715093000
PID|1||PID12345678^^^HOSPITAL_A^MR||DOE^JOHN^MIDDLE||19850412|M||2106-3|123 MAIN STREET^^HYDERABAD^TELANGANA^500081^IND||919642373173|||M|||999-99-9999
PV1|1|I|3NW^302^1|3|||12345^SMITH^ROBERT^J^^DR|||SUR|||||ADM|20260715093000

Key Segment Breakdown

Segment Name Functional Description
MSH Message Header Defines encoding characters, sending/receiving applications, timestamp, and message type (`ADT^A01`).
EVN Event Type Contains the trigger event (`A01`) and execution timestamp.
PID Patient Identification Stores Medical Record Number (MRN), patient name, date of birth, gender, address, and contact numbers.
PV1 Patient Visit Captures visit details such as patient class (`I` for Inpatient), assigned room/bed location, and attending physician.

ORU^R01 - Observation Result (Laboratory Report)

Used to transmit diagnostic lab test results and clinical observations back to an EHR.

ORU / Results
HL7 v2.5.1 / Lab Pipeline
MSH|^~\&|LAB_SYS|CENTRAL_LAB|EHR_SYS|HOSPITAL_A|20260715101500||ORU^R01^ORU_R01|LAB2026071501|P|2.5.1
PID|1||MRN987654^^^CENTRAL_LAB^MR||SMITH^ALICE||19901123|F
OBR|1|ORD998877|LAB554433|2345-7^GLUCOSE POST 2H GLUCOSE|||20260715094500|||||||||12345^SMITH^ROBERT
OBX|1|NM|2345-7^GLUCOSE POST 2H GLUCOSE||110|mg/dL|70-140|N|||F|||20260715101000

Key Segment Breakdown

Segment Name Functional Description
OBR Observation Request Uniquely identifies the lab order request number, requested universal service code (e.g., LOINC code `2345-7`), and ordering clinician.
OBX Observation / Result Carries actual clinical observation numerical values (`110`), units (`mg/dL`), reference ranges (`70-140`), and flags (`N` for Normal).

ORM^O01 - General Order Message

Transmits lab orders, radiology requisitions, or pharmacy requests from an EHR to ancillary systems.

ORM / Order Request
HL7 v2.3 / Ancillary Routing
MSH|^~\&|EHR_SYS|HOSPITAL_A|RAD_SYS|RADIOLOGY|20260715110000||ORM^O01|ORDMSG0023|P|2.3
PID|1||PID12345678^^^HOSPITAL_A^MR||DOE^JOHN^MIDDLE||19850412|M
ORC|NW|ORD998877|||||^^^20260715110000||20260715110000|12345^SMITH^ROBERT
OBR|1|ORD998877||71020^CHEST X-RAY 2 VIEWS|||20260715110000|||||||||12345^SMITH^ROBERT

Key Segment Breakdown

Segment Name Functional Description
ORC Common Order Specifies the order control code (`NW` for New Order), filler/placer order numbers, and ordering authority.
OBR Observation Request Specifies the ordered procedure code (e.g., CPT code `71020` for Chest X-Ray) and execution priority.

ACK - General Acknowledgment Message

Returned by receiving interfaces to confirm successful ingestion or report parsing errors.

ACK / Handshake
HL7 v2.x Standard Response
MSH|^~\&|MIRTH|CLINIC_B|EPIC|HOSPITAL_A|20260715093001||ACK|ACK00001|P|2.3
MSA|AA|MSG00001|Message accepted successfully

Key Segment Breakdown

Segment Name Functional Description
MSA Message Acknowledgment Contains acknowledgment code (`AA` = Application Accept, `AE` = Application Error, `AR` = Application Reject) and referenced message control ID.