From: Dilworth, B. <Bob...@ut...> - 2007-05-08 18:35:43
|
Hi Jeff! Thanks!!!! I previously tried using the ("/.PID-5-1") syntax which did work. I also wanted to try the other way of extracting the data using the (pid,5,0,1,1) syntax but couldn't get it to work. Thanks Again!!!!!!!!!!!!!! Bob D. -----Original Message----- From: Jeff Gunther [mailto:jef...@in...]=20 Sent: Tuesday, May 08, 2007 2:29 PM To: Dilworth, Bob Cc: hl7...@li... Subject: Re: [HAPI-devel] Having Difficulty Extracting Data from a Segment using Terser Hi Bob, Try using the code snippet below. Jeff Gunther Intalgent 100 10th Street NE, Suite 303 Charlottesville, VA 22902 T: (434) 977-5152 ext. 100 F: (866) 812-5291 jef...@in... String [] theHL7; FileInputStream is =3D new FileInputStream("t:/ci/hl7testdata/pwlraworu- = testside.dat"); theHL7 =3D ca.uhn.hl7v2.util.Hl7InputStreamReader.read((FileInputStream) = is); Parser p =3D new PipeParser(); Message msg =3D p.parse(theHL7[0]); Terser terser =3D new Terser(msg); String x =3D terser.get(terser.get("/.PID-5-1")); System.out.println(x + "\n"); On May 8, 2007, at 1:53 PM, Dilworth, Bob wrote: > Hi All! > > > > I'm trying to extract data from field 5 in the PID segment of an =20 > ORU R01 message using Terser. I receive the error: Exception in =20 > thread "main" ca.uhn.hl7v2.HL7Exception: PID does not exist in the =20 > group ca.uhn.hl7v2.model.v22.message.ORU_R01 when I run my code. =20 > It's a really simple little program and I'm stumped as to what's =20 > wrong. Here's the code: > > > > String [] theHL7; > > FileInputStream is =3D new FileInputStream("t:/ci/hl7testdata/ = > pwlraworu-testside.dat"); > > theHL7 =3D ca.uhn.hl7v2.util.Hl7InputStreamReader.read=20 > ((FileInputStream)is); > > Parser p =3D new PipeParser(); > > Message msg =3D p.parse(theHL7[0]); > > Segment pid =3D (Segment) msg.get("PID"); > > Terser terser =3D new Terser((Message)msg); > > String x =3D terser.get(pid,5,0,1,1); > > System.out.println(x + "\n"); > > > > The above mentioned error occurs when trying to execute the =20 > following line: Segment pid =3D (Segment) msg.get("PID"); > > > > Here's the test data I'm using: > > > > MSH|^~\&|LA01|A||A|200705041010|RESULTR01OUT|ORU^R01|129080|P|2.2|||=20 > AL|NE||||||2.2b > > PID|1|00664921|00727521^^^A^MR||TEST^BARB||199507260000|F||||||||||=20 > 0709500001|999000303 > > ORC|RE|0712400001^LA01|0712400001^LA01|R505040003^LA01|CM||=20 > 1^^^200705041009^^R||200705041009|CHOOD||61999^FEDERMAN^DOUGLAS|=20 > MCO||200705041010||4CD^^SF > > OBR|1|0712400001^LA01|0712400001^LA01|=20 > 26438^DIGOXIN^LA01^26438^^LA01|R||200705041009|||CHOOD||||=20 > 200705041009|1&BLOOD^^^^^GRN C&Vacutainer green top; lithium =20 > heparin 7 ml, Chem|61999^FEDERMAN^DOUGLAS||||||200705041010||CHEM|=20 > FINAL RSLT||1^^^200705041009^^R||||^^I9||||||||LABO^LAB DRAW^^^0 > > OBX|1|NM|DIG^DIGOXIN^LA01|1|2.7|ng/mL^ng/mL|.7-2.0|HH|||F|||=20 > 200705041010|MCO^MEDICAL COLLEGE OF OHIO|CHOOD|AXS^^^M~N > > NTE|1|L|Pharmacy system indicates active order for digoxin, please =20 > consider|Y|200705041009|CHOOD|Pharmacy system indicates active =20 > order for digoxin, please consider adjusting d > > NTE|2|L|adjusting dose.|Y|200705041009|CHOOD|Pharmacy system =20 > indicates active order for digoxin, please consider adjusting d > > ZOM|1||||12450037||||||CHEM||||||12450037|1|H|||200705041009|=20 > 659||||||||||||||||S||||||0712400001^LA01|||||F||A||||AXS|A|D|||=20 > DIGOXIN > > ZCA|||4CD|||||||||||||||||||||||||||||||||||||00664921|||TEST|=20 > $ReleaseId: rel10.0.1.2.20060929.1.hot$|$Id: pwic.pad,v =20 > 1.162.1.9.1.0, 2006-07-26 19:41:30Z$;$ReleaseId: rel10.0.1.2.20|=20 > $Date: 7/26/06 12:41:30 PM$||||199507260500+0000|system||||4CD^\R=20 > \4CD NURSING STATION|||||415301^4153-01 > > > > Any thoughts and/or pointers in the right direction would be =20 > greatly appreciated! > > > > Thanks in Advance!!!! > > > > Bob Dilworth > > Toleod, Ohio > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/=20 > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel |