Julian Matthews · Jun 18, 2019

Reply Code Actions - how do I handle large HL7 NACKs?

Hi there.

I am dealing with a clinical system that returns a stack trace within the NACK (Specifically, within MSA:3).

Within the stack trace there is an error code I am interested in, and hoped I could use the Reply Code Actions to look for that code within the error by using the "E*<text>" condition to either suspend or accept the response and move on. The problem is, looking at the error within the event log, I can see that the error text is truncated, cutting off the error code I'm looking for within the stack trace.

Has anyone else come across something similar and would be able to advise on how they dealt with the problem? I'm thinking of creating a custom operation, but I'm not 100% on if it's a suitable solution or the best way to approach it if it is.

Thanks in advanced.

0 3 169 2


I haven't had the need to do this yet, but my guess is you're going to have to create a custom operation that modifies the received NAK via the OnReplyDocument() method. If the stack trace is really big, it may be stored as a Stream Object rather than a %String. And if that's the case, you're going to have to scan the Stream for the string you need, and replace the contents of the MSA:3 with that string.

I'd whip up an example for you but I'm headed out the door and will be OoO for the day. I'll check back tonight to see if anyone's beaten me to it :D

 The other thing that just occurred to me is that the vendor is dumping a stack trace that may contain print control characters such as carriage returns, and the operation is simply treating the first \x0d as the end of the segment. That would effectively exclude the rest of the stack trace from the message body for conventional parsing purposes. The data is likely still there, but it can't be parsed out as part of MSA;3 with the parsing rules defined in the ACK's schema.

I took a look at the error and it doesn't seem to be truncating at the linebreaks (which are represented as \.br\). 

I think your suggestion of a custom operation is going to be my best approach. Fingers crossed!