HL7 batch files allow one or more messages to be sent in a single file, using specialized segments in a structure that mirrors HL7 defined message types. These segments include the batch header segment (BHS), batch trailer segment (BTS), file header segment (FHS) and file trailer segment (FTS). HL7 batching is useful for systems that are not connected via real-time transmission protocols (such as those systems that do not transmit via TCP/IP connections).
The HL7 Standard specifies the following format for batch files:
[FHS] (file header)
{ [BHS] (batch header)
{ [MSH (HL7 messages)
….
….
….
] }
[BTS] (batch trailer)
}
[FTS] (file trailer)
HL7 batch files usually consist of only one type of message (i.e. ADT, ORM, ORU, etc.), but there are no rules in the standard restricting the batch to only one message type. The batch file’s headers and trailers are important because they include a field that supplies a count of messages expected within the batch. Therefore conformance checking can be done with an HL7 batch file, whereas it cannot be done in the same way with a batch file only containing HL7 messages and no other information.
Batch files using HL7 batch protocol are not widely implemented because of the challenges associated with using files for HL7 communications. Using HL7 batch files may present sequencing problems and/or file access issues that must be remedied by solutions such as file locking, a staging directory, or reader delay.
It is very common to have multiple messages put into a single file without utilizing HL7 batch protocol (i.e. without batch headers and trailers) or instead utilizing some other custom format. Working with non-HL7 formatted batch files requires some specialized processing to read and parse the messages, and may present some additional interfacing challenges.
How are HL7 batch files acknowledged?
The general process for HL7 acknowledgements (ACKs) of batch files is to acknowledge the entire batch at once, and only process errors on an exception basis. However the individual messages can be acknowledged in a manner chosen and appropriate for the application. These options include:
- Acknowledging all messages in the response batch.
- Generating a batch control report that is manually delivered to the sending system’s personnel.
- Acknowledging only those messages that contain errors by using an automated acknowledgement batch; this involves use of an empty ACK batch (an HL7 batch file without any HL7 ACK messages).
More information about batch file protocol and batch acknowledgements can be found in Chapter 2 of the HL7 standard.