· Sep 20, 2016 4m read

Diagnosing Framing Errors

Framing refers to the characters that mark the start and end of an HL7 message (or other types of framed messages).  Most HL7 services and operations have a Framing setting that allows the user to define this framing.  The most common choices are available as defaults, but with the AsciiMM/NN setting, components can be configured to recognize any framing characters.

The most common framing error is ErrEndBlock.  Other typical errors include a warning saying "Discarding received non-HL7 data", a warning saying "Returning unused unexpected n-char segment", and "Discarding leftover input ''".

These errors will usually report what character was expected and which character was missing or unexpected.  For non-printing characters, it will report these using a mapping to printing characters as in the following table:

Character    ASCII(Dec)    Hex       Description
1            1             01        Start of Heading (SOH)
2            2             02        Start of Text (STX)
t            9             09        Tab (TAB)
l            10            0A        Line Feed (LF)
s            11            0B        Vertical Tab (VT)
r            13            0D        Carriage Return (CR)
e            28            1C        File Separator (FS)


Below are some sample errors and warnings you might see in the Ensemble event log that are related to framing.  If any image is too small to read, right click it and open it in another tab to see the full size version.  Any ASCII values mentioned below will be in decimal format.


Sample 1:

The "Discarding received non-HL7 data(1)..." warning means that the component received an ASCII 11 before the message but it wasn't expecting an ASCII 11.  The error means that the component received ASCII 28, ASCII 13 after the message, but wasn't expecting those either.  What is being sent is known as MLLP framing (11 before message, 28,13 after message) but the component is set to use Framing "None".  To fix this problem, framing needs to be changed to MLLP.

Sample 2:

The previous sample had 1 character get discarded.  In this sample, we see a whole message get discarded in the first two warnings, followed by a read timeout error.  When a TCP Service discards what looks like a perfectly valid message, this typically means that the start block characters were missing.  The service is discarding all of the characters that weren't a start block.  We don't see any characters from the table just before the MSH| segment in the first "Discarded..." warning, so this leads us to believe that there is no start block.  Looking at the end of the second warning, we see an r for the segment terminator and nothing after that before we get the read timeout error.  So there is no end block being sent either.  So this is a case of the service expecting leading and trailing framing characters but not getting any of them.  The solution is to change the framing setting to "None"

Sample 3:

Here we see an ErrEndBlock error and it fully explains the problem.  We got an end block of '' but we expected 'l', which is ASCII 10.  This means that the chosen framing expects an endblock but isn't receiving one.  The fix is to use a framing that doesn't expect an end block.  This could mean that the framing was set to 'AsciiLF' but it should be set to 'None'.  It could also mean that both a start block and end block were expected, but only the start block was sent.  Ensemble doesn't support having only a start block.

Sample 4:

Here we see another ErrEndBlock error that fully explains the problem.  We got an end block of 'r' (ASCII 13, carriage return) but we expected an end block of 'l' (ASCII 10, new line).  Again, this could mean framing was set to AsciiLF when it should be AsciiCR, or it could mean that the framing is set to something like Ascii11/13 when it should be set to Ascii11/10.

Sample 5:

In this sample, the ErrEndBlock error is misleading.  The real problem is described in the first warning: "Badly formed segment name 'WEIGHT'".  The most probable cause for this error is that the data contains a segment terminator.  In this case, the OBX segment had a CR just before the word WEIGHT and so ensemble thought that that CR was the end of the segment and that the word WEIGHT was the start of the next segment.  Carriage returns are not allowed within HL7 data.  The solution to this problem is to get the upstream system to either properly escape invalid characters (CR is escaped as \X0D\) or Base-64 encode the data.  There is no solution to this problem that can be implemented on the Ensemble side - the upstream system must correct their data.

Discussion (0)0
Log in or sign up to continue