Hi Fatih,

the Terser syntax very closely follows the structure in the HAPI structure
objects. Therefore one can derive the syntax by navigating to the desired
field beginning in ca.uhn.hl7v2.model.v25.message.ORF_R04

In your case (using the recent HAPI version):

....     
         Terser t = new Terser(mess); 
         
         String field = t.get("/QUERY_RESPONSE/PATIENT/PID-3");
         System.out.println(field);      // 0123456
         field = t.get("/QUERY_RESPONSE/ORDER/OBSERVATION(0)/OBX-3-1");
         System.out.println(field); // 8897-1
         field = t.get("/QUERY_RESPONSE/ORDER/OBSERVATION(1)/OBX-3-1");
         System.out.println(field); // 8894-8
....

works. Beware that QUERY_RESPONSE and ORDER are also repeatable, so,
depending on your message, you need to specify the repetition, too (e.g.
/QUERY_RESPONSE(0)/ORDER(1)/OBSERVATION(1)/OBX-3-1 to look at the second
ORDER group.

Hope this helps
Christian


Fatih Topal wrote:
> 
> Hi all,
> 
> I get a response message of ORF^R04 type and want to extract the 
> contained OBX segments for further processing. This seems to be a common 
> problem, but I didnt find a solution.
> 
> The message looks like:
> 
> MSH|^~\&|EKG||CDB||198905201201||ORF^R04|X981672|P|2.5|
> MSA|AA|CDB22222|P|
> QRD|198904180943|R|I|Q4412|||10^RD|0123456|RES|098765|
> QRF|EKG||198804010000|
> PID|1||0123456||EVERYMAN^ADAM^H||||||||555-2004|
> OBR|1|43215^OE|98765^EKG|93000^EKG REPORT| 
> ||198801111330|||||||||P030||||||198801120930||||||P011^SEVEN^HENRY^L^^^MD|43214^OE|
> OBX|1|ST|8897-1^QRS COMPLEX^LN||91|/MIN|60-100||||F|
> OBX|2|ST|8894-8^P WAVE^LN||92|/MIN|60-100||||F|
> OBX|3|ST|8625-6^P-R INTERVAL^LN||0|/MSEC|1.06-.10||||F|
> OBX|4|ST|8633-0^QRS DURATION^LN||.368|/MSEC|.18-.22||||F|
> OBX|5|CE|8601-7^EKG IMPRESSION^LN|1|^ATRIAL FIBRILATION||||||F|
> OBX|6|CE|8601-7^EKG IMPRESSION^LN|2|^ST DEPRESSION||||||F|
> OBX|7|FT|93000&ADT^EKG COMMENT||\.in+4\\.ti 4\ 1. When compared with 
> EKG of        31 oct 88 ventricular rate has increased by 30 bpm.\.sp\\.ti 4\ 
> 2. Criteria for Lateral infarct are no longer present.|||||F|
> OBR|2|43217^OE|98767^EKG|93000^EKG 
> REPORT|||198810311004|||||||||P030||||||198810311744||||||P011^SEVEN^HENRY^L^^^MD|43213^OE|
> DSC|1896X22;0123456|
> 
> 
> I have tried the following but it does not work:
> 
> Parser p = new GenericParser();
> Message mess = p.parse(message);
> 
> Terser t = new Terser(mess);
> String field = t.get("/DSC-1"); // works!
> System.out.println(field);
> 
> // field = t.get("/PIDNTEORCOBRNTECTDCTI/PIDNTE/PID-3"); // does not 
> work!
> // field = t.get("/PIDNTE/PID-3"); // does not work!
> field = 
> t.get("/ORF_R04_PIDNTEORCOBRNTETQ1TQ2CTDOBXNTECTI/ORCOBRNTETQ1TQ2CTDOBXNTECTI/OBXNTE/OBX-3");
>  
> //does not work!
> 
> System.out.println("field);
> 
> I found the example in the api-description of the Terser-class but was 
> not able to transfer it to my problem.
> Does anyone have a suggestion how to extract the OBX-segments, 
> especially the OBX-3 fields.
> 
> Thanks for any suggestion
> Fatih Topal
> 
> 
> 
> ------------------------------------------------------------------------------
> 
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> 
> 

-- 
View this message in context: 
http://old.nabble.com/extracting-OBX-content-from-a-ORF%5ER04-message-tp28626324p28630601.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------

_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to