From: Steve P. <st...@pr...> - 2006-01-10 22:00:02
|
It looks like the MSH I have does not meet the HL7 2.2 specs? The = message type is in MSH-9, but there's also an int (43) in MSH-9-3... Here's the ADT A04 sample msg I have (header only): =20 MSH:;~\&:HBOC:A:HBOC:A:200512152351::ADT;A04;43:9007713:P:2.2:9007713::AL= :"" : ^ ^ As I understand it, field MSH-9 is a msg type, "Components: <message = type> ^ <trigger event>", but the msg type sent is "ADT;A04;43", which is incorrect according to the standards? In addition, there's an extra = field after the msg type, it's either "43" or "9007713" (depending on how the segment is parsed), before the processing ID (P). But it seems 9007713 = is the sequence #, so why two of them? =20 9 7 CM R 0076 00009 Message type=20 10 20 ST R 00010 Message control ID=20 11 1 ID R 0103 00011 Processing ID=20 12 8 ID R 0104 00012 Version ID Any suggestions on how to deal with this? It seems a good approach to handling messages in my Application class, when a message is sent via = the "processMessage(Message in)" method, is to simply do an "instance of" on = the msg to determine it's type, then process the msg accordingly. But with these msgs I'm being sent "instanceof" fails, due to the MSH-9-3 field = being present. If I remove the MSH-9-3 field it parses properly, as an = ADT_A04. Here's output from parsing the original msg: msg Name: GenericMessage$V22 =20 msg Name: ca.uhn.hl7v2.model.GenericMessage$V22 =20 msg Version: 2.2 =20 msg ?: MSH ** MSH-9-1 is: ADT ** MSH-9-2 is: A04 ** MSH-9-3 is: 43 ** MSH-10 is: 9007713 ** MSH-11 is: P ** MSH-12 is: 2.2 ** MSH-13 is: 9007713 ** MSH-14 is: null ** MSH ** EVN ca.uhn.hl7v2.HL7Exception: Can't XML-encode a GenericMessage. Message = must have a recognized structure. at ca.uhn.hl7v2.parser.XMLParser.doEncode(XMLParser.java:251) at ca.uhn.hl7v2.parser.Parser.encode(Parser.java:221) at ABParse.main(ABParse.java:79) And here's output from parsing the modified msg (MSH:;~\&:HBOC:A:HBOC:A:200512152351::ADT;A04:43:P:2.2:9007713::AL:"":) msg Name: ADT_A04 =20 msg Name: ca.uhn.hl7v2.model.v22.message.ADT_A04 =20 msg Version: 2.2 =20 msg ?: MSH ** MSH-9-1 is: ADT ** MSH-9-2 is: A04 ** MSH-9-3 is: null ** MSH-10 is: 43 ** MSH-11 is: P ** MSH-12 is: 2.2 ** MSH-13 is: 9007713 ** MSH-14 is: null ** MSH ** EVN ** PID ** NK1 ** PV1 ** PV2 ** OBX ** AL1 ** DG1 ** PR1 ** GT1 ** INSURANCE ** ACC ** UB1 ** UB2 message is instanceof ADT_A04 <?xml version=3D"1.0"?> <ADT_A04 xmlns=3D"urn:hl7-org:v2xml"> <MSH> <MSH.1>:</MSH.1> <MSH.2>;~\&</MSH.2> <MSH.3>HBOC</MSH.3> <MSH.4>A</MSH.4> <MSH.5>HBOC</MSH.5> <MSH.6>A</MSH.6> <MSH.7> <TS.1>200512152351</TS.1> </MSH.7> <MSH.9> <CM_MSG.1>ADT</CM_MSG.1> <CM_MSG.2>A04</CM_MSG.2> </MSH.9> <MSH.10>43</MSH.10> <MSH.11>P</MSH.11> <MSH.12>2.2</MSH.12> <MSH.13>9007713</MSH.13> <MSH.15>AL</MSH.15> <MSH.16>""</MSH.16> </MSH> <EVN> <EVN.1>A04</EVN.1> <EVN.2> <TS.1>200512152351</TS.1> </EVN.2> </EVN> </ADT_A04> =20 > -----Original Message----- > From: hl7...@li...=20 > [mailto:hl7...@li...] On Behalf=20 > Of Bryan Tripp > Sent: Tuesday, January 10, 2006 1:27 PM > To: spr...@po... > Cc: hl7...@li... > Subject: Re: [HAPI-devel] Detemining the Message type in=20 > Application.processMessage(...) >=20 >=20 > Hi Steve, >=20 > The message type, event, and possibly structure should be in=20 > field MSH-9. Actually if they are there, HAPI should not use=20 > the GenericMessage class, and you should be able to tell what=20 > kind of message it is from the class. Maybe these data are=20 > missing from the message? >=20 > Bryan >=20 > On 1/9/06, Steve Pringle <st...@pr...> wrote: > > Could someone please tell me how one goes about determining=20 > what type=20 > > of message has been received in the=20 > Application.processMessage(Message=20 > > in) method? > > > > Here's a code snippet, which is being sent an ADT_A01 msg,=20 > but I have=20 > > no idea how to determine that it is an ADT_A01. All I want=20 > to do is=20 > > determine which message type was sent, get the data I need,=20 > then send=20 > > an ACK. > > > > public class ABApplication implements Application > > { > > ... > > public Message processMessage(Message in) throws=20 > ApplicationException > > { > > Message out =3D null; > > PipeParser parser =3D new PipeParser(); > > > > try > > { > > System.out.println("\nmsg Name: " +=20 > in.getName()); > > System.out.println("\nmsg Name: " +=20 > > in.getClass().getName()); > > System.out.println("\nmsg Version: " +=20 > > in.getVersion()); > > System.out.println("\nmsg ?: " +=20 > > in.get("MSH").getName()); > > > > String[] names =3D in.getNames(); > > > > for (int i =3D 0; i < names.length; i++) > > System.out.println("** " +=20 > names[i]);=20 > > ... > > > > Here's the output: > > > > msg Name: GenericMessage$V22 > > > > msg Name: ca.uhn.hl7v2.model.GenericMessage$V22 > > > > msg Version: 2.2 > > > > msg ?: MSH > > ** MSH > > ** EVN > > ** PID > > ** NK1 > > ** PV1 > > > > Thanks, > > Steve PRingle > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep=20 > through log=20 > > files for problems? Stop! Download the new AJAX search=20 > engine that=20 > > makes searching your log files as easy as surfing the web.=20 > DOWNLOAD=20 > > SPLUNK! = http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > > _______________________________________________ > > Hl7api-devel mailing list > > Hl7...@li... > > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep=20 > through log files for problems? Stop! Download the new AJAX=20 > search engine that makes searching your log files as easy as=20 > surfing the web. DOWNLOAD SPLUNK!=20 > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=CCk > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel >=20 >=20 |