Skip to content

ASTM Format

ASTM is the predecessor to the HL7 message type. There are 2 major differences: ASTM allows single character message segments where HL7 allows only 3 character message segments and the maximum length of a segment is 240 characters including the segment terminator. If a segment exceeds that limit, an A segment follows containing the remaining characters.

Delimiter Method

The delimiter method defines how QIE determines the delimiters to use when parsing ASTM messages.

Delimiter Method Description
Read from message header
(default)
The ASTM specification indicates that the message delimiters are defined in the message, batch or file header segment. When this option is selected, QIE determines the message delimiters to use by reading each ASTM message header segment.
Use the default ASTM delimiters The ASTM specification includes recommended delimiters to be used with ASTM formatted messages. When this option is selected, QIE uses the default ASTM delimiters when parsing messages.
Define custom delimiters When this option is selected, QIE uses the specified custom ASTM delimiters when parsing messages.

Field Delimiter

The field delimiter is used to separate fields in an ASTM segment. The default delimiter is a pipe (|) character.

Component Delimiter

An ASTM field can have multiple components. The component delimiter is used to separate field components. The default delimiter is a hat (^) character.

Repeat Character

An ASTM field can repeat (have multiple values). The repeat character is used to separate multiple instances of a field value. The default repeat character is the tilde (~) character.

Escape Character

The escape character defines how delimiter characters are escaped when used in field or component values. The default escape character is the backslash (\ character.

Sub-Component Delimiter

An ASTM field component can have sub-components. The sub-component delimiter is used to separate field sub-components. The default delimiter is an ampersand (&) character.

Addendum Segments

ASTM Segments are limited to a max length of 240 bytes including the segment terminator, or to the value of the qie.astmMaxFrameSize Java option when that option is set. The length is measured in bytes of the message's encoding, so a segment containing multi-byte characters reaches the limit with fewer characters than an all-ASCII segment does, and a segment is only ever broken between characters so a multi-byte character is never split. When a segment exceeds this length, one or more addendum (A) segments are created which contain the overflow characters from the original segment. QIE can be configured to auto-combine addendum segments for inbound messages, which simplifies internal message processing, and auto-create addendum segments for outbound messages to ensure compliance with the max length limit.

Group By

ASTM supports transmitting messages individually or in batches (multiple messages per file). When processing ASTM batch files, QIE can be configured to process the entire batch as a single message (file) or to process each individual ASTM message within the batch as a separate message (message).

Response By

  • Message: An ACK is sent for each individual HL7 message.
  • File/Batch: A single ACK is sent for the first message in file/source.

Segment Delimiter for Message Parsing

Check this box to use hex 0D or 0A as the segment delimiter for incoming messages.

\"Unknown segment\" errors from embedded line breaks

With Segment Delimiter for Message Parsing checked, QIE treats any of \r, \n, or \r\n as a segment terminator. If a sender includes a bare \n inside a field value (a multi-line address comment, for example), QIE splits the field there and the next text up to the following terminator looks like a malformed segment, producing MessageModelException: Unknown segment: '<first three characters>'. Fix options:

  • Have the sender escape the literal newline as the HL7 escape sequence \X0A\ (or \X0D\ for CR).
  • Uncheck this box so QIE only treats \r (the HL7 standard) as a segment terminator, allowing \n inside fields to pass through unchanged.
  • Sanitize the bytes in the source's preprocess script before they hit the parser.