If you look at the MSH-8 (ADT^A08), there is no message structure component 
(3rd component of field). Therefore PipeParser looks up into 
ca.uhn.hl7v2.parser.eventmap.2.3.1.properties for appropriate message structure 
for  ADT A08 event. There is mapping ADT_A08 => ADT_A01. That's why you get 
instance of ADT_A01 message. It's OK, you'll get all fields from your message.

If you like to get instance of ADT_A08 class, then your MSH should be like this:
MSH|^~\\&|RAMSOFT|SENDING FACILITY|RAMSOFT|RECEIVING 
FACILITY|20101223202939-0400||ADT^A08^ADT_A08|101|P|2.3.1

Regards,
Jure


From: James Agnew [mailto:[email protected]]
Sent: Wednesday, November 16, 2011 10:50 PM
To: Garrett McTear
Cc: [email protected]
Subject: Re: [HAPI-devel] This Parser and Library are Great! Quick (hopefully) 
Question Though!

To that would suggest that your code may be reading a different message. The 
one you provided looked like a valid A08 to me, so presumably it would parse as 
such.

Perhaps try:

Message msg = .... (however you are parsing)
System.out.println(msg.encode().replace('\r', '\n');

Just to see if the message actually matches the one you are expecting.

Cheers,
James

On Wed, Nov 16, 2011 at 2:01 PM, Garrett McTear 
<[email protected]<mailto:[email protected]>> wrote:
Specifically, when I do this:
ADT_A08 msg = (ADT_A08)msg;

I get this error:
java.lang.ClassCastException: ca.uhn.hl7v2.model.v231.message.ADT_A01 cannot be 
cast to ca.uhn.hl7v2.model.v231.message.ADT_A08



On Wed, Nov 16, 2011 at 9:35 AM, Garrett McTear 
<[email protected]<mailto:[email protected]>> wrote:
James,
Switching operating systems and rebuilding took up a lot more time than I had 
expected.  I am up and running now.

I am still getting the issue with that particular message being identified as 
an ADT_A01 message.

I will be working on this all day (and for a good while now that I have my work 
station up and running again).

Any ideas would be appreciated.

Thanks,
Garrett

On Fri, Nov 11, 2011 at 8:46 AM, Garrett McTear 
<[email protected]<mailto:[email protected]>> wrote:
James,

I think what you said at the end might be the problem.  I do have the latest 
version of HAPI, but I was using a test txt file to throw messages in.

I am switching my operating system today, and may be out of commission most of 
the day if things do not go smoothly.  As soon as I get up and running I will 
try and confirm what the issue is.

At the end of the day yesterday, I did almost exactly what you have above 
there, minus the:

parser.setValidationContext(new NoValidation());

But when I used the getVersion() method, it was saying that the message was an 
ADT_A01 message.

Thanks and I will update ASAP!

Garrett

On Fri, Nov 11, 2011 at 6:04 AM, James Agnew 
<[email protected]<mailto:[email protected]>> wrote:
Hi Garrett,

Hi Garrett,

Strange, I put your message into your code and it seems to work for me. The 
following:

String msgString = "MSH|^~\\&|RAMSOFT|SENDING FACILITY|RAMSOFT|RECEIVING 
FACILITY|20101223202939-0400||ADT^A08|101|P|2.3.1||||||||\r" +
                "EVN|A08|20101223202939-0400||||\r" +
                
"PID||P12345^^^ISSUER|P12345^^^ISSUER||PATIENT^TEST^M^^^^||19741018|M|||10808 
FOOTHILL BLVD^^RANCHO 
CUCAMONGA^CA^91730^US||(909)481-5872<tel:%28909%29481-5872>^^^[email protected]<mailto:[email protected]>|(909)481-5800x1<tel:%28909%29481-5800x1>||M||12345|286-50-9510|||\r"
 +
                "PV1||O||||||||||||||||||||||||||||||||||||||||||||||||||\r" +
                "AL1|1||^PORK^|\r" +
                "AL1|2||^PENICILLIN^|";

        GenericParser parser = new GenericParser();
        parser.setValidationContext(new NoValidation());
        Message msg = parser.parse(msgString);
        System.out.println(msg.getClass().getName());

..parses correctly. Are you using the latest version of HAPI? Is it possible 
you are reading from a file and getting the wrong line endings or charset or 
something?

James

On Thu, Nov 10, 2011 at 6:00 PM, Garrett McTear 
<[email protected]<mailto:[email protected]>> wrote:
Code Section:

Parser p = new GenericParser();
Message hapiMsg;
try {
hapiMsg = p.parse(out.toString());
logger.info<http://logger.info>( "doPost() : HL7 successfully parsed" );
}
catch (EncodingNotSupportedException e) {
logger.info<http://logger.info>(e.getMessage());
}
catch (HL7Exception e) {
logger.info<http://logger.info>(e.getMessage());
}

HL7 v2.3.1 ADT_A08 message that is not working:

MSH|^~\&|RAMSOFT|SENDING FACILITY|RAMSOFT|RECEIVING 
FACILITY|20101223202939-0400||ADT^A08|101|P|2.3.1||||||||
EVN|A08|20101223202939-0400||||
PID||P12345^^^ISSUER|P12345^^^ISSUER||PATIENT^TEST^M^^^^||19741018|M|||10808 
FOOTHILL BLVD^^RANCHO
CUCAMONGA^CA^91730^US||(909)481-5872<tel:%28909%29481-5872>^^^[email protected]<mailto:[email protected]>|(909)481-5800x1<tel:%28909%29481-5800x1>||M||12345|286-50-9510|||
PV1||O||||||||||||||||||||||||||||||||||||||||||||||||||
AL1|1||^PORK^|
AL1|2||^PENICILLIN^|

Error received:

"Can't parse message beginning MSH|^~\&|RAMSOFT|SENDING 
FACILITY|RAMSOFT|RECEIVIN"

Let me know if there is anything else I can provide.

Thanks,
Garrett

On Thu, Nov 10, 2011 at 3:50 PM, James Agnew 
<[email protected]<mailto:[email protected]>> wrote:
Hi Garrett,

Can you post a code snippet showing the issue you are facing?

James

On Thu, Nov 10, 2011 at 5:20 PM, Garrett McTear 
<[email protected]<mailto:[email protected]>> wrote:
I started taking on an HL7 project about two weeks ago.  The project was left 
by the original programmer with very little documentation.  Most of my time has 
been spent doing research.  I have successfully used HAPI to parse messages 
from all of the version 2.x variants.

The problem I ran into, however, is what happens when someone has taken the 
liberty to append a "custom extension" to a message.  In particular, I am 
having issues with a modified v2.3.1 ADT_A08 message that cannot be processed 
by the same HAPI program that can process any other v2.3.1 message I throw at 
it.

I downloaded the HAPI source code and have been digging, but I figured I would 
shoot an email to the mailing list and see if any of you had any tips on this 
type of issue.

Specifics about my issue:
I do get an error:
EncodingNotSupportedException
When using the GenericParser
This same program handles other HL7 v2.3.1 files smoothly.  But this modified 
ADT_A08 is the troublesome file.

Thanks!
Garrett

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Hl7api-devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/hl7api-devel







------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to