Hi Michael,
Unfortunately this is an area where the HL7 specification is ambiguous
about how your message should be correctly parsed. HAPI generally errs on
the side of putting unexpected segments closest in the structure to the
segment immediately before it, which in your case sounds like it's not
optimal.
Probably the easiest way to solve this is to create a custom model class
which extends ADT_A01 but adds your Z-segment. There is an example here:
http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/CustomModelClasses.html
.. which illustrates how to do this starting on line 59. The example
creates a ZDT_A01, but you could just as easily actually create an ADT_A01.
Given the ambiguity in the spec around this, it would certainly be nice if
the parser provided a way of specifying a preferred behaviour for
unexpected segments like this one. I've filed a bug to track the idea:
https://sourceforge.net/tracker/?func=detail&aid=3557955&group_id=38899&atid=423838
Cheers,
James
On Wed, Aug 15, 2012 at 11:07 AM, Michael Conner <
[email protected]> wrote:
> We’ve got a message where we want to have a custom segment at the end of
> an Patient Admit, ADT A01 message. We don’t have anything between IN1 and
> the custom segment. ****
>
> …****
>
> ** **
>
> [{ --- INSURANCE begin ****
>
> * IN1 Insurance*
>
> [ IN2 ] Insurance Additional Info.****
>
> [{ IN3 }] Insurance Additional Info - Cert****
>
> [{ ROL }] Role****
>
> }] --- INSURANCE end ****
>
> [ ACC ] Accident Information****
>
> [ UB1 ] Universal Bill Information****
>
> [ UB2 ] Universal Bill 92 Information****
>
> [ PDA ] Patient Death and Autopsy****
>
> *[ ZFA ] Financial Agreement*
>
> * *
>
> When HAPI parses the message, the ZFA ends up as a segment in the
> INSURANCE group, not the root of the message. Is there some way of changing
> this behavior? I’ve verified this with the HAPI test panel. Two other
> utilities that I’ve tried, MWB and Chameleon HL7 Messaging Toolkit, parse
> it differently, placing the Z segments at the root of the message, as
> desired, and not in an INSURANCE group.****
>
> ** **
>
> * *
>
> Here’s some sample data:****
>
> ** **
>
>
> MSH|^~\&|DATASERVICES|CORPORATE|||20120711120510.2-0500||ADT^A01^ADT_A01|9c906177-dfca-4bbe-9abd-d8eb43df93a0|D|2.6
> ****
>
> EVN||20120701000000-0500****
>
>
> PID|1||397979797^^^SN^SN~4242^^^BKDMDM^PI~1000^^^YARDI^PI||Williams^Rory^H^^^^A||19641028000000-0600|M||||||||||31592^^^YARDI^AN
> ****
>
> NK1|1|Pond^Amelia^Q^^^^A|SPO|1234 Main
> St^^Sussex^WI^53089|^PRS^CP^^^^^^^^^555-1212||N****
>
> NK1|2|Smith^John^^^^^A~^The Doctor^^^^^A|FND|1234 S Water St^^New
> London^WI^54961||^WPN^PH^^^^^^^^^555-9999|C****
>
> PV1|2|I||R****
>
> GT1|1||Doe^John^A^^^^A||5678 Maple
> Ave^^Sussex^WI^53089|^PRS^PH^^^^^^^^^555-9999|||||OTH****
>
> IN1|1|CAP1000|YYDN|ACME
> HealthCare||||GR0000001|||||||HMO|||||||||||||||||||||PCY-0000042****
>
> IN1|2||||||||||||||Medicare|||||||||||||||||||||123-45-6789-A****
>
> IN1|3||||||||||||||Medicaid|||||||||||||||||||||987654321L****
>
> ZFA|6|31592|12345|YARDI|20120201000000-0600****
>
> ** **
>
> ** **
> ----------------------------------------- This email may contain
> confidential protected health information and/or attorney privileged
> information. If received in error, see our Privacy Statement at
> http://www.brookdaleliving.com/privacy-policy.aspx
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel