Hi Ryan,
This is basically a weakness in the HL7 standard rearing its head. The
issue here is that QPD-3 is defined only as a "varies" datatype, and the
XML ITS is silent on how it should be encoded.
Varies are used in OBX segments (OBX-5), but there you have another field
(OBX-2) which defines the datatype to use so you have have deterministic
round-trip encoding. On QPD there is no datatype field, so HAPI has no way
of knowing what datatype it had found when it parsed the ER7
(pipes-and-hats) encoded message.
There is a workaround, but you'll need to know what datatype your receiving
application wants to see in QPD-2. If you say:
for (int i = 0; i < getQpd3_UserParameters().length; i++){
((QBP_Q21)m).getQPD().getQpd3_UserParameters(i).setValue(new ST(m));
}
this will fix the datatype to be ST (or whatever datatype you choose).
Disclaimer: The above code is typed from memory and not tested. It may
contain typos.
Cheers,
James
On Tue, Apr 16, 2013 at 4:41 PM, Ternier, Ryan <ryan.tern...@cgi.com> wrote:
> I’m not sure what’s going on with the parser. It’s not parsing out the
> PID information correctly. When I’ve ran the parser to convert from a
> format that does look correct to HL7v2, it works, but it seems it hates
> this format which is used by one of the largest health systems:****
>
> ** **
>
> I have the following HL7v2 message:****
>
> ** **
>
>
> MSH|^~\\&|SOME_SOURCE|SOME_ORGANIZATION|BCSYSTEM|BCSYSTEM|20130213094112||QBP^Q22^QBP_Q21|46320||2.4
> ****
>
> QPD|Q22^IHE PDQ
> Query|46320|@PID.3.1^2162973~@PID.3.4~@PID.3.5~@PID.5.1^phsaempifive~@PID.5.2^Helium~@PID.7^19780930000000~@PID.8^F||Exact
> ****
>
> RCP|D|25^RD****
>
> ** **
>
> Running the following code:****
>
> ** **
>
> PipeParser p = new PipeParser();****
>
> Message m = p.parse(hl7Message); //pasted above****
>
> XMLParser xmlParser = new DefaultXMLParser();****
>
> ****
>
> String ackMessageInXML = xmlParser.encode(m);****
>
> ** **
>
> System.out.println(ackMessageInXML);****
>
> ** **
>
> ====****
>
> I get the XML output which seems incorrect, why are the PID’s not ****
>
> ** **
>
> <?xml version="1.0"?>****
>
> <QBP_Q21 xmlns="urn:hl7-org:v2xml">****
>
> <MSH>****
>
> <MSH.1>|</MSH.1>****
>
> <MSH.2>^~\&</MSH.2>****
>
> <MSH.3>****
>
> <HD.1>SOME_SOURCE</HD.1>****
>
> </MSH.3>****
>
> <MSH.4>****
>
> <HD.1>SOME_ORGANIZATION</HD.1>****
>
> </MSH.4>****
>
> <MSH.5>****
>
> <HD.1>BCSYSTEM</HD.1>****
>
> </MSH.5>****
>
> <MSH.6>****
>
> <HD.1>BCSYSTEM</HD.1>****
>
> </MSH.6>****
>
> <MSH.7>****
>
> <TS.1>20130213094112</TS.1>****
>
> </MSH.7>****
>
> <MSH.9>****
>
> <MSG.1>QBP</MSG.1>****
>
> <MSG.2>Q22</MSG.2>****
>
> <MSG.3>QBP_Q21</MSG.3>****
>
> </MSH.9>****
>
> <MSH.10>46320</MSH.10>****
>
> <MSH.12>****
>
> <VID.1>2.4</VID.1>****
>
> </MSH.12>****
>
> </MSH>****
>
> <QPD>****
>
> <QPD.1>****
>
> <CE.1>Q22</CE.1>****
>
> <CE.2>IHE PDQ Query</CE.2>****
>
> </QPD.1>****
>
> <QPD.2>46320</QPD.2>****
>
> <QPD.3>****
>
> <UNKNOWN.1>@PID.3.1</UNKNOWN.1>****
>
> <UNKNOWN.2>2162973</UNKNOWN.2>****
>
> </QPD.3>****
>
> <QPD.3>@PID.3.4</QPD.3>****
>
> <QPD.3>@PID.3.5</QPD.3>****
>
> <QPD.3>****
>
> <UNKNOWN.1>@PID.5.1</UNKNOWN.1>****
>
> <UNKNOWN.2>phsaempifive</UNKNOWN.2>****
>
> </QPD.3>****
>
> <QPD.3>****
>
> <UNKNOWN.1>@PID.5.2</UNKNOWN.1>****
>
> <UNKNOWN.2>Helium</UNKNOWN.2>****
>
> </QPD.3>****
>
> <QPD.3>****
>
> <UNKNOWN.1>@PID.7</UNKNOWN.1>****
>
> <UNKNOWN.2>19780930000000</UNKNOWN.2>****
>
> </QPD.3>****
>
> <QPD.3>****
>
> <UNKNOWN.1>@PID.8</UNKNOWN.1>****
>
> <UNKNOWN.2>F</UNKNOWN.2>****
>
> </QPD.3>****
>
> <QPD.5>Exact</QPD.5>****
>
> </QPD>****
>
> <RCP>****
>
> <RCP.1>D</RCP.1>****
>
> <RCP.2>****
>
> <CQ.1>25</CQ.1>****
>
> <CQ.2>****
>
> <CE.1>RD</CE.1>****
>
> </CQ.2>****
>
> </RCP.2>****
>
> </RCP>****
>
> </QBP_Q21>****
>
> ** **
>
> Any thoughts?****
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel