HL7 Message Content and Description
An HL7 Message is a structure consisting of Segments which contain elements which may contain components which may contain sub-components. Elements, components, and sub-components are separated by delimiters that are defined in the first segment of the HL7 Message. There are published rules that the message structure or order of segments, the structure of the segments or the order of the data elements etc. Rules also describe how various data types are encoded within a element and when an individual element may be repeated.
Each HL7 Message has a defined order of segments. Each segment begins with a three-character value that identifies the segment. Segments are defined within a message as required, optional, repeating or optional-repeating. Repeating means that at least 1 segment of that type is required. Each segment is defined with an ordered set of data elements which are found by their position within the segment.
The general structure is as follows:
Segment (Some are Repeatable)
Elements (Some are Repeatable)
The Lower Level Protocol is the standard for transmitting HL7 Message via TCP/IP. Since TCP/IP is a stream of bytes, the LLP mandates a enveloping protocol so that the tart and the end of each message can be recognized. The enveloping protocol consists of a header to start the message and a trailer to end the message. These headers and footers are typically non-printable characters that would not be in the actualHL7 message. The message structure using the LLP is:
Header == 0x0B
HL7 Message – each segment terminated with a 0x0D (Carriage Return)
Trailer == 0x1C 0x0d.
The MSH segment defines the element, component, subcomponent and repeating delimiters as well as the escape character. The following table contains the normal definitions of these characters:
0x0D – Marks the end of each segment.
| – element delimiter.
^ – component delimiter.
& – Sub-component delimiter.
~ – Used to separate repeating fields.
\ – Escape character.
Continue reading in the next post.