Question

We are creating a HL7 XML structure and are using the HAPI Library to output it as a HL7 V2 file. But unfortunately, HAPI is reordering (sorts) the segments.

Because I have MFE and ZBP always repeating:

MSH|...
MFI|...
MFE|...
ZBP|...
MFE|...
ZBP|...
MFE|...
ZBP|...

But HAPI re-orders them to

MSH|...
MFI|...
MFE|...
MFE|...
MFE|...
ZBP|...
ZBP|...
ZBP|...

It hapens also with the HAPI TestPanel. Example:

MSH|^~\&|||||20121011140541.133+0200||MFN^M01|1|T|2.6
MFI|Partners|^Sap|UIZ|||NE
MFE|MUP|||0000040001
ZBP|0000040001|100|Something||||3000|Bern||||
MFE|MUP|||0000040002
ZBP|0000040002|100|Otherthing||||8000|Zurich||||

How can I disable the re-ordering with HAPI?

Was it helpful?

Solution 2

Changed ADT^01 to the correct MFN^M01 and using the version 2.3 it works (in the tester also):

MSH|^~\&|||||20121011140541.133+0200||MFN^M01|1|T|2.3
MFI|Partners|^Sap|UIZ|||NE
MFE|MUP|||0000040001
ZBP|0000040001|100|Something||||3000|Bern||||
MFE|MUP|||0000040002
ZBP|0000040002|100|Otherthing||||8000|Zurich||||

Strange, but any other version does not work.

OTHER TIPS

Well, you have a few things going on here...

First, the way that you have your segments structured is non-compliant with the HL7 standard. Once Z-Segments are introduced to a message, all following segments need to be Z-Segments. So, the fact that you have alternating MFE and ZBP segments is not a valid structure. At a minimum, I would suggest changing the MFE segment to a custom segment, such as ZMF or similar.

Second, the message structure that you have is not that of an ADT^A01 message. You are missing a few required segments, such as PID, which need to be in the message. Not following the message structure is going to cause headaches for your trading partners and, eventually, for you. If you are not sure what the message structure is, you will want to go to the HL7 site and buy an implementation guide.

So, if you have decided that you don't care about standards or your trading partner doesn't care, you can disable validation in the hapi tool. While it is pretty much common place to the modify the HL7 message standard, please do not just ignore it. Making custom messages and boldly ignoring standards creates such a massive pain for integrators across the field and often leads to frail integration. Remember these are healthcare messages being used by healthcare providers, not twitter API calls. What we do here can have an impact on a patient's outcome.

There is a message validation page on the HAPI site.

Here is essentially the code that you are looking for:

NoValidation noValidation = new NoValidation();
parser.setValidationContext(noValidation);

In the HAPI TestPanel, you can see the same functionality by disabling validation from the dropdown. enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top