Hey James,

Thanks for the reply - sorry it's taken me a bit to get back to you.

What part of the HAPI code are you talking about with that snippet there?

I've written a quick custom parser for this because I wasn't able to figure out 
how to get HAPI "Happy" with it.

The way Cerner has documented some of this HL7v2 messaging helps me understand 
it, but not sure where to go from there.

|@PID.5.1^JOHNSON|<mailto:|@PID.5.1%5eJOHNSON|>

The first component of this data type is a string (ST) and contains the segment 
field name. I believe this is what you were referencing with your post, but I'm 
not sure where to implement it.
The second component contains the field values.

The QPD segment is where my troubles come in when working with HAPI, where 
should I explore putting that bit of code you pasted?

Please also consider the following;

MSH|^~\&|Bar|Foo|CERNER|Foo|20130320095727||RSP^K22|49550||D|2.4
MSA|AA|49550||
QAK|49550||OK
QPD|Q22^Find 
Candidates|49550|@PID.5.1^Audi~@PID.5.2^baby~@PID.7^20110815000000||Exact
PID|1|||123123123123^^^Id Number^NHN|AUDI^CAPTAINKIRK^||19770209|F
QRI|200|EXACT
PID|2||123123123^^^PAMRN^MRN|123123123^^^Id 
Number^NHN|AUDI^UNICORN^||19871128|F|||4231 PINE ST^^REGINA^SK^V6Y3E9^~1896 
MANTON RD^^REGINA^SK^V5T7Y3^||5559991234^
QRI|31|EXACT
PID|3|||123123123^^^Id Number^NHN|AUDI^GODZILLA^||19890214|F|||1871 BALFOUR 
BLVD^^QUESNEL^BC^V6J2W9^CA^MAIL||604112-1111^HOME|778334-3333^BUS^^^^^^8888
QRI|6|EXACT


A second parsing issue:

It also blows up when parsing the last bits of the PID's (Phone numbers, etc.) 
Error I'm getting:

Failed validation rule for value "6049993586": Matches the regular expression 
(\d{1,2} )?(\(\d{3}\))?\d{3}-\d{4}(X\d{1,5})?(B\d{1,5})?(C.*)?: Segment: PID 
Field #13

PID Field #13 is a HOME phone number - 40,XTN,O,r - PH.

Is there a place to modify the RegEx used for this PID Field, or ignore it?


Cheers,

Ryan

From: jamesag...@gmail.com [mailto:jamesag...@gmail.com] On Behalf Of James 
Agnew
Sent: April-17-13 7:07 AM
To: Ternier, Ryan
Cc: hl7api-devel@lists.sourceforge.net
Subject: Re: [HAPI-devel] Weird behavior running a parse on QBP_Q21 HL7v2.4

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<mailto: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<mailto:Query|46320|@PID.3.1%5e2162973~@PID.3.4~@PID.3.5~@PID.5.1%5ephsaempifive~@PID.5.2%5eHelium~@PID.7%5e19780930000000~@PID.8%5eF||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>^~\&amp;</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<mailto:Hl7api-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to