Sun HL7 Message Library User's Guide

Components of the HL7 Message

An HL7 transaction or message is comprised of a number of components in a defined sequence. This section defines the components of the HL7 transaction. The HL7 message is a unit of data transferred between systems. It consist of a group of segments in a defined sequence. Each message has a message type that defines its purpose. For example an ADT Message type is used to transmit portions of a patient's Patient Administration (ADT) data from one system to another. A three-character code contained within each message identifies its type. A trigger event, a real-world event such as a patient being admitted, initiates the exchange of messages.

Segments

A segment is a logical grouping of data fields. Segments may occur only once or repeat in a message and may be required or optional. Each segment is given a name. For example, the ADT message may include the following segments: Message Header (MSH), Event Type (EVN), Patient ID (PID), and Patient Visit (PV1). Segments are identified by unique three-character codes known as the Segment IDs.

Fields

A field is a string of characters. HL7 is not concerned with how a system actually stores data within an application. When fields are transmitted, they are sent as character strings. Except where noted, HL7 data fields may take on the null value. Sending the null value, which is transmitted as two double quote marks (""), is different from omitting an optional data field. The difference appears when the contents of a message is used to update a record in a database rather than create a new one. If no value is sent, (that is, it is omitted) the old value should remain unchanged. If the null value is sent, the old value should be changed to null.

Data field characteristics are as follows:

Message Delimiters

Message delimiters are the specific predefined characters that are used to define the beginning and end of a message component. They are the segment terminator, the field separator, the component separator, subcomponent separator, repetition separator, and escape character.

Escape Sequences in Text

Fields Escape sequences vary depending on the type of field.