简体   繁体   中英

HL7 Hapi get non-standard segment, segment's name present in standard segment

I am unable to parse a non standard message segment using terser or happi API. The segment "PV2" is present in structure mulitple times, one stated as non-standard segment, which is my segment for parsing message.

After using message.printStructure(), the following structure (Sample) is shown.

ADT_A08 (start)
MSH - MSH|^~\&|||||||ADT^A08||P|2.3||||
EVN - Not populated
PID - PID|1||^^^&ISO~^^&~^^^     &ISO~^^^&||^||19230324|F||-1|  ^^ BOXES^CA^81125||||||||
[ PD1 ] - PD1||||^^
[ { NK1 } ] - NK1|1|^|CH||
             NK1|2|^|||
PV1 - PV1|1|I|^MC3706^1|C|||^^^|^^^|^^^|||||1|||^^^|IN||||||||||||||||||||||||||202308211705
[ PV2 ] - Not populated
[ { DB1 } ] - Not populated
PROCEDURE (start)
[{
   PR1 - Not populated
  [ { ROL } ] - Not populated
}]
PROCEDURE (end)
[ { GT1 } ] - GT1|1||^||  ^^^^|(408)-283-1928|||||SLF|828-46-4375||||INFORMATION UNAVAILABLE
[ { PV22 } ] (non-standard) - PV2||ABC|^XYZ
.
.
.
ADT_A08 (end) 

I need to get field any of PV2 non-standard segment. I am able to get the values of the segment "PV22" by using terser or HAPI API.(But not as intended use)

terser.get("/.PV22-3-2");  // outputs XYZ

How do i get "PV2" non-standard value knowing the only "PV2" as a segment name ???

terser.get("/.PV2-3-2"); // outputs null

But i expect the output as of use of "PV22". ie. output should be "XYZ". How do I achieve it ?? Thanks in advance.!!!!!!

The reason for this is that your PV2 segment is in the wrong position in the source message. It should come immediately after the PV1 segment, in which case it will be parsed normally.

Because it is at the end of your message, it is being parsed as a non-standard segment and HAPI adds a "2" to the end to distinguish it from the standard PV1 segment.

James Agnew is the Master, so his reply was pretty definitive. I don't know nearly as much about HL7 or HAPI as he does. The point may be: if your message is non-standard (as it is with the PV2 tacked onto the end) you may not be able to get everything you want from HAPI. It's not magic. The AbstractGroup.getNonStandardNames() does seem to provider you enough access to detect the PV22 at runtime, if you write some custom code for that situation. The terser seems to me like a convenience framework that is available to work with messages that stick closely to the standard; for less conformant messages, you have to do more work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM