Trigger events
How a message type and a trigger event together identify what a message is for.
HL7v2 is an event-based messaging standard: it defines how systems communicate when an event occurs, such as a patient admission, a new order, or a signed result. The standard calls such an event a trigger event, and each message reports one trigger event: it carries the data about the event and names the event with a code, such as A01 for an admission.
Trigger events are grouped by message type, the area of care or administrative function that they belong to. Admitting, transferring, and discharging a patient are three trigger events, A01, A02, and A03, of one message type, ADT (patient administration). A message names both codes in its header, written together as ADT^A01.
The grouping organizes the standard itself: each chapter covers one area of care and defines the message types and trigger events for that area. It also simplifies implementation. The trigger events of one message type carry largely the same segments, so a destination can read every ADT message the same way and handle the differences between events in its processing.
Definition
Each message carries its message type and trigger event in its header, in MSH-9, the ninth field of the MSH segment. The field holds three codes, one in each component, separated by the component delimiter ^:
MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|20230630120000||ADT^A04^ADT_A01|MSG000001|P|2.5.1|| Component | Name | Example | Values |
|---|---|---|---|
MSH-9.1 | Message type | ADT | Table 0076 |
MSH-9.2 | Trigger event | A04 | Table 0003 |
MSH-9.3 | Message structure | ADT_A01 | Table 0354 |
In this example, the message reports the registration of an outpatient (A04) but declares the structure ADT_A01, which it shares with an admission. The trigger event and the structure are separate codes, as Message structure explains.
Because MSH is the first segment of every message, a destination reads MSH-9 before the rest of the message. The field tells the destination whether it supports the message, which segments to expect, and how to process the message, as described under Reception.
Message code
Since version 2.5, the standard names the first component of MSH-9 the message code and keeps message type as the name of the whole field. Earlier versions call the component the message type, and most implementers still do.
Message types
The message type, in MSH-9.1, is a three-letter code that identifies the area of care or administrative function that a message belongs to. The following message types are among the most widely used:
| Code | Title | Carries |
|---|---|---|
ADT | Admit / Discharge / Transfer | Patient demographics and encounter changes: admissions, transfers, discharges, registration updates, and record merges. |
ORM | Order | Orders for tests, medications, procedures, and other services. ORM is the general-purpose order message and remains common in production, although later versions replace it with specialized order messages such as OML. |
OML | Laboratory Order | The order message introduced in version 2.4 for laboratory and other specimen-based orders. |
ORU | Unsolicited Observation Result | Clinical observations and results, such as laboratory panels, vital signs, and imaging reports. |
SIU | Scheduling Information Unsolicited | Appointment bookings, changes, and cancellations. |
MDM | Medical Document Management | Notifications about clinical documents, such as dictation, transcription, and signature, optionally with the document itself. |
DFT | Detailed Financial Transaction | Charges and other billing events. |
VXU | Vaccination Update | Immunization records, typically sent to a public-health registry. |
RDE | Pharmacy Encoded Order | A medication order as encoded by the pharmacy system. The dispensing and administration messages (RDS, RAS) belong to the same family. |
QBP / RSP | Query by Parameter / Response | Queries identified by parameters, and the segment-pattern responses to them. |
ACK | General Acknowledgment | The acknowledgment that reports the outcome of any of the above. |
Trigger events
The trigger event, in MSH-9.2, is a code that consists of a letter followed by two digits, such as A01, O21, R01, or S12.
Event codes are defined within a message type. For ADT, they include A01 (admit a patient), A02 (transfer a patient), A03 (discharge a patient), A04 (register an outpatient), and A08 (update patient information). An event code therefore has meaning only together with its message type: A01 under ADT is an admission, but A01 alone does not identify a message.
The standard defines several hundred trigger events, and an interface uses a small subset of them. A typical ADT interface carries the five events above and a few merge and cancellation events, and a typical results interface carries only ORU^R01. The events that an interface sends and accepts are specified in its profile.
Local trigger events
Trigger event codes that begin with Z are reserved for local use, for events that the standard does not define. Z-segments describes the reserved namespace and its costs.
Each trigger event produces a separate message. The following diagram shows the ADT messages sent during a patient admission; the destination processes each one according to its trigger event.
Message structure
The message structure, in MSH-9.3, names the segments that a message contains and the order in which they appear. Its code is a message type and a trigger event joined by an underscore, such as ADT_A01.
Several trigger events can use the same structure. An admission (A01), an outpatient registration (A04), and an update of patient information (A08) carry the same segments, so all three messages declare ADT_A01. The trigger event states why the message was sent; the structure states which segments it contains. A system that receives these messages can therefore read all three in the same way. The events reference lists the structure of every trigger event.
The structure is needed because the segments of a message do not show how they relate to one another. In a results message, each order (OBR) is followed by its observations (OBX):
OBR|1||1001|CBC^Complete blood count
OBX|1|NM|HGB^Hemoglobin||13.5|g/dL
OBX|2|NM|WBC^White blood cells||6.2|10*3/uL
OBR|2||1002|BMP^Basic metabolic panel
OBX|1|NM|GLU^Glucose||95|mg/dLNothing in these segments states that the glucose result belongs to the second order. The structure ORU_R01 does: it defines a group that begins with an OBR segment and contains the OBX segments that follow it. The structure also states which segments are required and the order in which they appear. The standard writes each structure in abstract message syntax, and Group describes how groups are defined.
Missing structure code
The structure code was added in version 2.3.1, and many messages leave it empty. When it is missing, the structure is determined by the message type and trigger event, because the standard assigns one structure to each pair.