Hi Chin,
If you write to the ORC and OBR segments and then print out the message
you will notice that a new OBC and OBR segment is created, so apparently
you are retrieving the wrong segments. I'm not very familiar with
ORL^022 messages, but it seems the ORC and OBR segments are regarded as
a second order, probably because they are placed below the SAC segment
in the message.
I you can get to the correct segments by adding the number 1, this will
get the next segment instead of the first one (0)
orc =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER(1).getORC(
);
obr =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER(1).getOBSE
RVATION_REQUEST().getOBR();
or alternatively you can change the order of your message and place the
ORC and OBR segments in front of the SAC segment.
Kind regards,
Patrick Ehlert.
-----Original Message-----
Message: 1
Date: Wed, 3 Sep 2008 08:41:58 -0700 (PDT)
From: Chin Hsueh <[EMAIL PROTECTED]>
Subject: [HAPI-devel] Why parse ORC/OBR segments in ORL_O22 message
get null by using Hapi?
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"
I am a new comer and try to use Hapi to parse back and forth the HL7
message between Medical Instrument and Lab Information System. I don't
know why I get null in parse ORC and OBR segment. I tried to search on
web, but didn't find the solusion.?I really appreciate if some body can
help me out.
?
My sample message are as follows:
String msg = "MSH|^~\\&|VIP|Test Bed|LIS|Pathology
Lab|20080829142634427||ORL^O22|VMSG1|P|2.4|\r"
+ "MSA|AA|MSG1|\r"
+ "PID||123-45-6789|||Doe^Jane||19610520|F|\r"
+ "PV1|||||||Dr.^Grogan^Tom|\r"
+ "SAC||S05-2248||||Skin/Biopsy|20070409|\r"
+ "ORC|OK|S05-2248|00026||ID|L~B~E|||20080829||||||||||||University
Medical Center|\r"
+ "OBR||S05-2248-C-4|00026|58^ANTI-
CEA^STAIN||||||||||||||MyTemplate|Custom|Custom|Breast|\r";
I follow?the sample program?on Hapi web site to do the parse.?The MSA,
PID and SAC segments were fine, but ORC and OBR had null.Parser p =
newGenericParser();
Message hapiMsg;
try{
// The parse method performs the actual parsing
hapiMsg = p.parse(msg);
} catch(EncodingNotSupportedException e) {
e.printStackTrace();
return;
} catch(HL7Exception e) {
e.printStackTrace();
return;
}
ORL_O22 orlMsg = (ORL_O22)hapiMsg;
MSH msh = orlMsg.getMSH();
// Retrieve some data from the MSH segment
String msgType = msh.getMessageType().getMessageType().getValue();
String msgTrigger = msh.getMessageType().getTriggerEvent().getValue();
// Prints "ORL O22"
System.out.println(msgType + " " + msgTrigger);
MSA msa = orlMsg.getMSA();
String acknowledgementCode = msa.getAcknowledgementCode().getValue();
System.out.println("In response: acknowledgementCode = " +
acknowledgementCode );
PID pid = orlMsg.getRESPONSE().getPATIENT().getPID();
String patientID = pid.getPatientID().getID().getValue();
System.out.println("In response: patientID = " + patientID);
SAC sac =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER().getOBSER
VATION_REQUEST().getSAC();
String accession =
sac.getAccessionIdentifier().getEntityIdentifier().getValue();
System.out.println("In response: accession = " + accession);
ORC orc =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER().getORC()
;
String orderControl = orc.getOrderControl().getValue();
System.out.println("In response: orderControl = " + orderControl);
String placerOrderNumber =
orc.getPlacerGroupNumber().getEntityIdentifier().getValue();
System.out.println("In response: placerOrderNumber = " +
placerOrderNumber);
OBR obr =
orlMsg.getRESPONSE().getPATIENT().getGENERAL_ORDER().getORDER().getOBSER
VATION_REQUEST().getOBR();
String placerOrderNumber_obr =
obr.getPlacerOrderNumber().getEntityIdentifier().toString();
System.out.println("In response: placerOrderNumber_obr = " +
placerOrderNumber_obr);
String filledOrderNumber_obr =
obr.getFillerOrderNumber().getEntityIdentifier().toString();
System.out.println("In response: filledOrderNumber_obr = " +
filledOrderNumber_obr);
Thanks,
Chin Hsueh
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
Message: 2
Date: Wed, 17 Sep 2008 19:33:04 +0200
From: christophe dufaza <[EMAIL PROTECTED]>
Subject: [HAPI-devel] OBX-2 possible values
To: [email protected]
Cc: Sandrine Roux <[EMAIL PROTECTED]>, Yvan Tardy
<[EMAIL PROTECTED]>, Fabien Munoz <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"
When parsing an HL7 2.3 ORM message, with the OBX-2 field set to ID, the
HAPI (0.5.1) implementation throws the error bellow:
[java] Caused by: ca.uhn.hl7v2.HL7Exception:
java.lang.NoSuchMethodException trying to set data type of OBX-5
[java] at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:148)
[java] at
ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:324)
[java] at
ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:259)
[java] at
ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:205)
[java] at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:151)
[java] at com.ibm.hl7tools.HL7Reader.read(HL7Reader.java:43)
[java] ... 27 more
[java] Caused by: java.lang.NoSuchMethodException:
ca.uhn.hl7v2.model.v23.datatype.ID.<init>(ca.uhn.hl7v2.model.Message)
[java] at java.lang.Class.getConstructor0(Class.java:1937)
[java] at java.lang.Class.getConstructor(Class.java:1027)
[java] at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:137)
[java] ... 32 more
Reading source code, I found that the Varies implementation attempts to
call a default constructor on the class
ca.uhn.hl7v2.model.v23.datatype.ID :
Class c = factory.getTypeClass(obx2.getValue(),
segment.getMessage().getVersion());
v.setData((Type) c.getConstructor(new
Class[]{Message.class}).newInstance(new Object[]{v.getMessage()}));
Unfortunately, this constructor does not exist. All defined constructors
for the Java type ID expect a table identifier parameter (here it should
be 125).
The issue is that ID _is_ an acceptable value for field OBX-2, as
defined by the HL7 table 125, release 2.3.
And the sending application (Millennium) does use this value.
I could easily patch the HAPI 0.5.1 source code, but I would prefer not
to.
Furthermore, as the spec allow this value, I think this issue may be
reported as an HAPI bug. Should I create an entry in the issue tracker ?
Has anyone encounter a similar issue ? what was then the chosen
solution ?
Regards,
christophe.
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
Message: 3
Date: Wed, 15 Oct 2008 17:14:03 +0200
From: "Ehlert, Patrick" <[EMAIL PROTECTED]>
Subject: Re: [HAPI-devel] OBX-2 possible values
To: <[email protected]>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"
Hi,
I'm having a similar problem with encapsulated data ("ED" type).
I'm sending an ORU^R01 message from a client to a server, both using
hapi 0.5.1. I add two observations to the message using the following
code
terser = new Terser(msg);
OBX obx1 = (ca.uhn.hl7v2.model.v22.segment.OBX) terser
.getSegment("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(0)/OBX");
obx1.getObservationIdentifier().getIdentifier().setValue("TEST1");
obx1.getObservationIdentifier().getText().setValue("OBSERVATION1");
obx1.getObservationIdentifier().getNameOfCodingSystem().setValue("L");
obx1.getSetIDObservationalSimple().setValue("1");
obx1.getValueType().setValue("CE");
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(0)/OBX-5",
"TESTVALUE");
OBX obx2 = (ca.uhn.hl7v2.model.v22.segment.OBX) terser
.getSegment("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX");
obx1.getObservationIdentifier().getIdentifier().setValue("TEST2");
obx1.getObservationIdentifier().getText().setValue("OBSERVATION2");
obx1.getObservationIdentifier().getNameOfCodingSystem().setValue("L");
obx2.getSetIDObservationalSimple().setValue("2");
obx2.getValueType().setValue("ED");
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-1",
"TEST");
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-2",
"TEXT");
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-3",
"Base64");
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-4",
xmlDocument);
The first OBX contains only simple value and sending a message with only
this segment is ok, however when I add the second OBX that contains an
xml document sending is ok, but the receiving application reports an
exception, apparently because there is no constructor.
ca.uhn.hl7v2.HL7Exception: java.lang.NullPointerException trying to set
data type of OBX-5
at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:148)
at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:324)
at ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:259)
at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:151)
at ca.uhn.hl7v2.app.Responder.processMessage(Responder.java:139)
at ca.uhn.hl7v2.app.Receiver$Grunt.run(Receiver.java:121)
Caused by: java.lang.NullPointerException
at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:137)
... 5 more
So far, I haven't been able to find a solution, so any help is
appreciated! Who knows what I am doing wrong?
Kind regards,
Patrick Ehlert.
> When parsing an HL7 2.3 ORM message, with the OBX-2 field set to ID,
the
> HAPI (0.5.1) implementation throws the error bellow:
>
> [java] Caused by: ca.uhn.hl7v2.HL7Exception:
> java.lang.NoSuchMethodException trying to set data type of OBX-5
> [java] at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:148)
> [java] at
> ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:324)
> [java] at
> ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:259)
> [java] at
> ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:205)
> [java] at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:151)
> [java] at com.ibm.hl7tools.HL7Reader.read(HL7Reader.java:43)
> [java] ... 27 more
> [java] Caused by: java.lang.NoSuchMethodException:
> ca.uhn.hl7v2.model.v23.datatype.ID.<init>(ca.uhn.hl7v2.model.Message)
> [java] at java.lang.Class.getConstructor0(Class.java:1937)
> [java] at java.lang.Class.getConstructor(Class.java:1027)
> [java] at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:137)
> [java] ... 32 more
>
>
> Reading source code, I found that the Varies implementation attempts
to
> call a default constructor on the class
> ca.uhn.hl7v2.model.v23.datatype.ID :
>
> Class c = factory.getTypeClass(obx2.getValue(),
> segment.getMessage().getVersion());
> v.setData((Type) c.getConstructor(new
> Class[]{Message.class}).newInstance(new Object[]{v.getMessage()}));
>
> Unfortunately, this constructor does not exist. All defined
constructors
> for the Java type ID expect a table identifier parameter (here it
should
> be 125).
>
> The issue is that ID _is_ an acceptable value for field OBX-2, as
> defined by the HL7 table 125, release 2.3.
> And the sending application (Millennium) does use this value.
>
> I could easily patch the HAPI 0.5.1 source code, but I would prefer
not
> to.
> Furthermore, as the spec allow this value, I think this issue may be
> reported as an HAPI bug. Should I create an entry in the issue tracker
?
>
> Has anyone encounter a similar issue ? what was then the chosen
> solution ?
>
> Regards,
> christophe.
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel
End of Hl7api-devel Digest, Vol 28, Issue 1
*******************************************
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel