Hey Christian,

Thanks for the help. I got the validation section licked - thanks for the input.

I'm not really looking to parse and get data from messages. What I'm attempting 
at doing is a pure HL7v3 to HL7v2  and HL7v2 to HL7v3 transformation. At this 
point in time I just need to see if it works as a PoC.

I looked at the CustomModelClasses example you listed, and it makes sense. How 
would one implement something similar so it is automatically used during the 
parsing of a Q21 / Q22 / R21 / R22? Or use some of the logic from James' post 
above to get HAPI parsing the PID fields without unknown and with the proper 
PID.1, PID.2 etc.

Cheers,

Ryan
From: Christian Ohr [mailto:[email protected]]
Sent: April-17-13 12:49 AM
To: Ternier, Ryan
Subject: Re: [HAPI-devel] Weird behavior running a parse on QBP_Q21 HL7v2.4

Well, the parser does about as best as it can - QPD-3 is a repeatable Varies 
field by default (check the spec!). IHE has instead decided assign concrete 
data types to QPD-3, QPD-4 and QPD-8 for the parameters of PDQ queries. Note 
that you can still use the Terser to read data e.g. from QPD-3(0)-1, QPD-3(0)-2 
etc.
You still may want to have a custom HL7 model for this message, see the example 
http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/CustomModelClasses.html
 on how to do this with HAPI.
Luckily, for a number of HL7 models for IHE transactions this has been done 
already, e.g. in the Open eHealth Integration Platform (IPF). The model 
definitions are here: 
https://github.com/oehf/ipf/tree/master/commons/ihe/hl7v2/src/main/java/org/openehealth/ipf/commons/ihe/hl7v2/definitions.
cheers
Christian

2013/4/16 Ternier, Ryan <[email protected]<mailto:[email protected]>>
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^[email protected][email protected][email protected]^[email protected]^[email protected]^[email protected]^F||Exact<mailto:Query|46320|@PID.3.1%[email protected][email protected][email protected]%[email protected]%[email protected]%[email protected]%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
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to