From: nksharma0624 <nir...@me...> - 2009-07-28 15:11:08
|
Hello Everybody.... I am trying to find an API or code hach to get the repeating segments. For example in the ORU_R01 message OBX segments are repeated..How can I iterate on each available OBX and use terser to get the fields So I would like to have something like this: Foreach repSegment find number of Fields present in this segment Foreach Field Find indices and run terser to get the value. So my clue is around extending the Terser class but this seems to be a pretty vital API so wondering if anybody has done any thing? Any help. -- View this message in context: http://www.nabble.com/How-to-find-Repeating-Segments-tp24700999p24700999.html Sent from the hl7api-devel mailing list archive at Nabble.com. |
From: Johnny2R <gr...@jm...> - 2009-08-04 13:00:59
|
Something like this should work: int obxCount = msg.getORDER().getORDER_DETAIL().getOBSERVATIONReps(); for (int i = 0; i < obxCount; i++) { OBX obx = msg.getORDER().getORDER_DETAIL().getOBSERVATION(i).getOBX(); //use your terser here String id = terser.get(obx, 1, 0, 1, 1); String value = terser.get(obx, 5, 0, 1, 1); } -- View this message in context: http://www.nabble.com/How-to-find-Repeating-Segments-tp24700999p24808110.html Sent from the hl7api-devel mailing list archive at Nabble.com. |
From: Sharma, N. K (GE Healthcare) <nir...@me...> - 2009-08-04 14:23:33
|
Not sure...what type of object msg is .. If it is Message or ORU_R01 in both cases it does not find the methods you have used. Help. Thanks. Regards -Niranjan. -----Original Message----- From: Johnny2R [mailto:gr...@jm...] Sent: Tuesday, August 04, 2009 7:01 AM To: hl7...@li... Subject: Re: [HAPI-devel] How to find Repeating Segments Something like this should work: int obxCount = msg.getORDER().getORDER_DETAIL().getOBSERVATIONReps(); for (int i = 0; i < obxCount; i++) { OBX obx = msg.getORDER().getORDER_DETAIL().getOBSERVATION(i).getOBX(); //use your terser here String id = terser.get(obx, 1, 0, 1, 1); String value = terser.get(obx, 5, 0, 1, 1); } -- View this message in context: http://www.nabble.com/How-to-find-Repeating-Segments-tp24700999p24808110 .html Sent from the hl7api-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------ ------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Hl7api-devel mailing list Hl7...@li... https://lists.sourceforge.net/lists/listinfo/hl7api-devel |
From: Johnny2R <gr...@jm...> - 2009-08-04 14:33:31
|
Sorry, you're right, I was assuming an ORM O01 message (which I've been burying my head in recently). The same principle applies with an ORU_R01 message, though. Try: int obxCount = msg.getPATIENT_RESULT().getORDER_OBSERVATION().getOBSERVATIONReps(); for (int i = 0; i < obxCount; i++) { OBX obx = msg.getPATIENT_RESULT().getORDER_OBSERVATION().getOBSERVATION(i).getOBX(); //use your terser here String id = terser.get(obx, 1, 0, 1, 1); String value = terser.get(obx, 5, 0, 1, 1); } Of course, you may have to take account of any repetitions (I'm assuming one ORDER_OBSERVATION). -- View this message in context: http://www.nabble.com/How-to-find-Repeating-Segments-tp24700999p24809784.html Sent from the hl7api-devel mailing list archive at Nabble.com. |
From: Sharma, N. K (GE Healthcare) <nir...@me...> - 2009-08-04 17:49:00
|
Thanks Johnny..For note here... I was doing the same but I did not realized that I was not passing the values with parameterized strings. It works. Here is the snapshot. ORU_R01 ORU_R01Message = (ORU_R01) theMessage; for (int i = 0; i<ORU_R01Message.getPATIENT_RESULTReps(); i++) { for (int j = 0; j<ORU_R01Message.getPATIENT_RESULT(i).getORDER_OBSERVATIONReps(); j++) { for (int k = 0; k<ORU_R01Message.getPATIENT_RESULT(i).getORDER_OBSERVATION(j).getOBSERVA TIONReps(); k++) { String terserPath = "/PATIENT_RESULT(" + i + ")/ORDER_OBSERVATION(" + j + ")/OBSERVATION(" + k + ")/OBX-3"; String value= t.get(terserPath); logger.debug(value); logger.debug("k=" + k); } } } -----Original Message----- From: Johnny2R [mailto:gr...@jm...] Sent: Tuesday, August 04, 2009 8:33 AM To: hl7...@li... Subject: Re: [HAPI-devel] How to find Repeating Segments Sorry, you're right, I was assuming an ORM O01 message (which I've been burying my head in recently). The same principle applies with an ORU_R01 message, though. Try: int obxCount = msg.getPATIENT_RESULT().getORDER_OBSERVATION().getOBSERVATIONReps(); for (int i = 0; i < obxCount; i++) { OBX obx = msg.getPATIENT_RESULT().getORDER_OBSERVATION().getOBSERVATION(i).getOBX( ); //use your terser here String id = terser.get(obx, 1, 0, 1, 1); String value = terser.get(obx, 5, 0, 1, 1); } Of course, you may have to take account of any repetitions (I'm assuming one ORDER_OBSERVATION). -- View this message in context: http://www.nabble.com/How-to-find-Repeating-Segments-tp24700999p24809784 .html Sent from the hl7api-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------ ------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Hl7api-devel mailing list Hl7...@li... https://lists.sourceforge.net/lists/listinfo/hl7api-devel |
From: Sharma, N. K (GE Healthcare) <nir...@me...> - 2009-08-04 19:49:45
|
To find the repeating OBX segment..Here is the code snippet: To get at the OBX: ORU_R01 ORU_R01Message = (ORU_R01) theMessage; for (int PATIENT_RESULTRep = 0; PATIENT_RESULTRep<ORU_R01Message.getPATIENT_RESULTReps(); PATIENT_RESULTRep++) { for (int ORDER_OBSERVATIONRep = 0; ORDER_OBSERVATIONRep<ORU_R01Message.getPATIENT_RESULT(PATIENT_RESULTRep) .getORDER_OBSERVATIONReps(); ORDER_OBSERVATIONRep++) { for (int OBSERVATIONRep = 0; OBSERVATIONRep<ORU_R01Message.getPATIENT_RESULT(PATIENT_RESULTRep).getOR DER_OBSERVATION(ORDER_OBSERVATIONRep).getOBSERVATIONReps(); OBSERVATIONRep++) { String[] OBX3Value= TerserUtil.getOBX3(localTerser, PATIENT_RESULTRep, ORDER_OBSERVATIONRep, OBSERVATIONRep); } } } To get the Values of OBX: public static String[] getOBX3(Terser localTerser, int PATIENT_RESULTRep, int ORDER_OBSERVATIONRep, int OBSERVATIONRep) throws HL7Exception { String [] OBX3 = new String[6]; String terserPath = "PATIENT_RESULT(" + PATIENT_RESULTRep + ")/ORDER_OBSERVATION(" + ORDER_OBSERVATIONRep + ")/OBSERVATION(" + OBSERVATIONRep + ")/OBX-"; OBX3[0] = localTerser.get(terserPath + "3(0)-1-1"); OBX3[1] = localTerser.get(terserPath + "3(0)-2-1"); OBX3[2] = localTerser.get(terserPath + "3(0)-3-1"); OBX3[3] = localTerser.get(terserPath + "3(0)-4-1"); OBX3[4] = localTerser.get(terserPath + "3(0)-5-1"); OBX3[5] = localTerser.get(terserPath + "3(0)-6-1"); return OBX3; } |
From: tcervantez <tam...@ca...> - 2012-06-21 15:39:01
|
Here is some additional info that might help. I found that with the solutions provided here that I had to have the appropriate message version import (i.e. ca.uhn.hl7v2.model.v22.segment.OBX) which was a problem since I use many versions of HL7 messages. So it works best for me to use the terser to get and set values. To handle multiple OBX segments I used the following. hapiMsg = p.parse(sourceMessage); Terser terser = new Terser(hapiMsg); terser.get("/.OBSERVATION(2)/.OBX-2-1"); terser.set("/.OBSERVATION(2)/.OBX-2-1", "CE"); This is equivelent to: OBX obx = message.getPATIENT_RESULT().getORDER_OBSERVATION().getOBSERVATION(2).getOBX(); obx.getValueType().setValue("CE"); My objective was to take an existing message and update any of the values. With this code I updated the 2nd field in the 3rd OBX segment from "NM" to "CE" as seen in the message below MSH|^~\&|OADD|${FACILITY}|HELIX||201012010910||ORU^R01|20101720000042|T|2.2 PID|||PX65^^^MRENTR||Mayer^Ronny PV1||I||2|||9898^Jackson^Burt^T|||||||||||IP||||||||||||||||||||||||||201012010840 OBX|1|NM|NA^Sodium^0|1.1|140^3|mmol/L|137-146||||F|||201012010905|IM^|8035^COX^CATHERINE(IM) OBX|2|NM|K^Potassium^0|1.1|4.5|mmol/L|3.5-5.0||||F|||201012010905|IM^|8035^COX^CATHERINE (IM) OBX|3|CE|CL^Chloride^0|1.1|100|mmol/L|98-109||||F|||201012010905|IM^|8035^COX^CATHERINE(IM) tcervantez nksharma0624 wrote: > > To find the repeating OBX segment..Here is the code snippet: > > To get at the OBX: > > ORU_R01 ORU_R01Message = (ORU_R01) theMessage; > > for (int PATIENT_RESULTRep = 0; > PATIENT_RESULTRep<ORU_R01Message.getPATIENT_RESULTReps(); > PATIENT_RESULTRep++) { > > for (int ORDER_OBSERVATIONRep = 0; > ORDER_OBSERVATIONRep<ORU_R01Message.getPATIENT_RESULT(PATIENT_RESULTRep) > .getORDER_OBSERVATIONReps(); ORDER_OBSERVATIONRep++) { > > for (int OBSERVATIONRep = 0; > OBSERVATIONRep<ORU_R01Message.getPATIENT_RESULT(PATIENT_RESULTRep).getOR > DER_OBSERVATION(ORDER_OBSERVATIONRep).getOBSERVATIONReps(); > OBSERVATIONRep++) { > > String[] OBX3Value= > TerserUtil.getOBX3(localTerser, PATIENT_RESULTRep, ORDER_OBSERVATIONRep, > OBSERVATIONRep); > > } > } > } > > To get the Values of OBX: > public static String[] getOBX3(Terser localTerser, int > PATIENT_RESULTRep, int ORDER_OBSERVATIONRep, int OBSERVATIONRep) throws > HL7Exception { > > String [] OBX3 = new String[6]; > String terserPath = "PATIENT_RESULT(" + PATIENT_RESULTRep + > ")/ORDER_OBSERVATION(" + ORDER_OBSERVATIONRep + ")/OBSERVATION(" + > OBSERVATIONRep + ")/OBX-"; > OBX3[0] = localTerser.get(terserPath + "3(0)-1-1"); > OBX3[1] = localTerser.get(terserPath + "3(0)-2-1"); > OBX3[2] = localTerser.get(terserPath + "3(0)-3-1"); > OBX3[3] = localTerser.get(terserPath + "3(0)-4-1"); > OBX3[4] = localTerser.get(terserPath + "3(0)-5-1"); > OBX3[5] = localTerser.get(terserPath + "3(0)-6-1"); > return OBX3; > > } > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > -- View this message in context: http://old.nabble.com/How-to-find-Repeating-Segments-tp24700999p34049368.html Sent from the hl7api-devel mailing list archive at Nabble.com. |