Message Framing

If HL7Spy does not automatically detect the correct file format for a stream of messages, it is possible to manual configure the message delimiters using the Message Framing dialog shown below.

The Message Framing dialog allows you to configure both the Message Framing (how each message is delimited in the file) as well as setting the character encoding of the message stream. The options of this dialog are described next.

  1. Presets - HL7Spy has some predefined Message Framing configurations that are available when saving data, send data via TCP/IP, and for loading files. Selecting a preset will update the dialog contents so it is instructive to select a preset and see what differentiates its configuration from other presets in the list.
  2. Encoding - Select one of the many character encodings provided by the Windows operating system.
  3. Start of Frame - Defines the bytes (in hexadecimal format) that indicate the start of an HL7 message. For the Standard HL7 preset we are using 0x0b as defined for the Minimum Lower Layer Protocol (MLLP), or HL7 over TCP/IP. Note: It is possible to specify nothing here, which is the case for some of the other presets.
  4. Containing - Besides the “start of frame”, for a message to be identified as an HL7 message, the text contained in this textbox must be found. By default it is set to MSH, but in a difficult to parse message stream it could be set to MSH|^~\&|, or whatever encoding characters are being used.
  5. End of Frame - Defines the bytes (in hexadecimal format) that indicate the end of an HL7 message. For the Standard HL7 preset we are using 0x1C0x1D as definesd for the Minimum Lower Layer Protocol (MLLP), or HL7 over TCP/IP.
  6. Summary - Gives a summary of the message framing settings that were selected.
  7. Replacement Strings - Replacement Strings allow you to perform some message clean-up when loading messages. For example look at the ASCII Separators preset. This preset is used for reading messages that are formatted as such:

<11>MSH....<13>\r\rPID...<13>\r\r....<28><13>

A pretty awful format, but HL7Spy can still handle it. In the replacement strings section you will see that <13> is to be replaced with an empty string, and \r\r (2 carriage returns) is to be replaced with a single \r. This is done twice since some messages from this vendor have 4 \r's in a row. After the string replacements are made, the message conforms to a standard HL7 message which will be properly handled by HL7Spy.