Hi Christian
Thanks for giving the solution. It worked nicely. But still I face one
issue that how can we get the number of segment counts (say for example PID
segment count) using Terser or any other class? Is there any property
defined to get the number of counts for segment?
RSP_K21 hapiMsg = null;
PipeParser parser = new PipeParser();
try {
hapiMsg = (RSP_K21) parser.parse(MSG);
Terser t = new Terser(hapiMsg);
System.out.println(t.get("/QUERY_RESPONSE(0)/PID-3-1"));
System.out.println(t.get("/QUERY_RESPONSE(1)/PID-3-1"));
How can we count the number of PID segments returned?
Thanks & regards,
depeche
nksharma0624 wrote:
>
> Christian, James,
>
> There are repetitive queries around getting Segment, Field with multiple
> repetitions.
>
> I think it is high time to have a utility added in Terser to get number
> of repetition for a specified path element.
>
> Thoughts are welcome.
>
>
> Thanks.
>
> Regards
> -Niranjan.
>
> -----Original Message-----
> From: christian ohr [mailto:[email protected]]
> Sent: Friday, June 11, 2010 8:47 AM
> To: [email protected]
> Subject: Re: [HAPI-devel] How to handle multiple PID returned in
> RSP^K22^RSP_K21 messages of version 2.5 messages?
>
>
> Hi,
>
> Executing the piece of code below (e.g. using HAPI 0.6 or better)
> returns
>
> 11.06.2010 16:39:40 ca.uhn.log.HapiLogImpl info
> INFO: Instantiating msg of class ca.uhn.hl7v2.model.v25.message.RSP_K21
> 5ab16eec-4eb0-4f78-ae45-f8759a83ee70
> 5ab16eec-4eb0-4f78-ae45-f8759a83ff10
>
> in my console; so it returns the IDs correctly. Note the Terser
> expressions
> /QUERY_RESPONSE(0)/PID-3-1 and /QUERY_RESPONSE(1)/PID-3-1, respectively.
>
> cheers Christian
>
>
> import ca.uhn.hl7v2.model.v25.message.RSP_K21;
> import ca.uhn.hl7v2.parser.PipeParser;
> import ca.uhn.hl7v2.util.Terser;
>
> public class test {
>
> private static final String MSG =
> "MSH|^~\\&||3f0203ca-7da1-4c92-8dcf-743a5579673f|GENERIC|3f0203ca-7da1-4
> c92-8dcf-743a5579673f|20100610165524||RSP^K22^RSP_K21|201006101655247185
> 43|P|2.5\r"
> + "MSA|AA|11312110\r"
> + "QAK|QRY11312110|OK|IHE PDQ Query\r"
> + "QPD|IHE PDQ
> Query|QRY11312110|@PID.5.2\\S\\Jack [email protected]\\s\\m\r"
> +
> "PID||3|5ab16eec-4eb0-4f78-ae45-f8759a83ee70^^^3f0203ca-7da1-4c92-8dcf-7
> 43a5579673f&&^PI~5ab16eec-4eb0-4f78-ae45-f8759a83ee70^^^EMR_3f0203ca-7da
> 1-4c92-8dcf-743a5579673f&&^PI|5ab16eec-4eb0-4f78-ae45-f8759a83ee70^^^3f0
> 203ca-7da1-4c92-8dcf-743a5579673f|Jack^Straw|Mommmmy|20001111|M||2028-9|
> Brigade
> Street Las vegas^^New
> York^10005^USA||(900)485-5344^PRN^PH^~(900)545-1200^PRN^CP^~^NET^X.400^m
> [email protected]|(900)485-3333^WPN^PH^~(900)545-1234^WPN^CP^~^NET^X.40
> 0^[email protected]|||CHR||123895678|1234^NY\r"
> + "QRI|5\r"
> +
> "PID||2|5ab16eec-4eb0-4f78-ae45-f8759a83ff10^^^3f0203ca-7da1-4c92-8dcf-7
> 43a5579673f&&^PI~5ab16eec-4eb0-4f78-ae45-f8759a83ff10^^^EMR_3f0203ca-7da
> 1-4c92-8dcf-743a5579673f&&^PI|5ab16eec-4eb0-4f78-ae45-f8759a83ff10^^^3f0
> 203ca-7da1-4c92-8dcf-743a5579673f|Jack^Straw^T|Mommmmy|20001111|M||2028-
> 9|Brigade
> Street Las vegas^^New
> York^10005^USA||(900)485-5344^PRN^PH^~(900)545-1200^PRN^CP^~^NET^X.400^m
> [email protected]|(900)485-3333^WPN^PH^~(900)545-1234^WPN^CP^~^NET^X.40
> 0^[email protected]|||CHR||123891234|1234^NY\r"
> + "QRI|4.35708725";
>
> /**
> * @param args
> */
> public static void main(String[] arg) {
> RSP_K21 hapiMsg = null;
> PipeParser parser = new PipeParser();
> try {
> hapiMsg = (RSP_K21) parser.parse(MSG);
> Terser t = new Terser(hapiMsg);
>
> System.out.println(t.get("/QUERY_RESPONSE(0)/PID-3-1"));
>
> System.out.println(t.get("/QUERY_RESPONSE(1)/PID-3-1"));
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> }
>
> }
>
>
> depeche007 wrote:
>>
>> Hi,
>>
>> How to handle multiple PID returned in RSP^K22^RSP_K21 messages of
>> version 2.5 messages?
>>
>> The structure of the message is as follows:
>>
>>
> MSH|^~\&||3f0203ca-7da1-4c92-8dcf-743a5579673f|GENERIC|3f0203ca-7da1-4c9
> 2-8dcf-743a5579673f|20100610165524||RSP^K22^RSP_K21|20100610165524718543
> |P|2.5
>> MSA|AA|11312110
>> QAK|QRY11312110|OK|IHE PDQ Query
>> QPD|IHE PDQ Query|QRY11312110|@PID.5.2\S\Jack [email protected]\s\m
>>
> PID||3|5ab16eec-4eb0-4f78-ae45-f8759a83ee70^^^3f0203ca-7da1-4c92-8dcf-74
> 3a5579673f&&^PI~5ab16eec-4eb0-4f78-ae45-f8759a83ee70^^^EMR_3f0203ca-7da1
> -4c92-8dcf-743a5579673f&&^PI|5ab16eec-4eb0-4f78-ae45-f8759a83ee70^^^3f02
> 03ca-7da1-4c92-8dcf-743a5579673f|Jack^Straw|Mommmmy|20001111|M||2028-9|B
> rigade
>> Street Las vegas^^New
>>
> York^10005^USA||(900)485-5344^PRN^PH^~(900)545-1200^PRN^CP^~^NET^X.400^m
> [email protected]|(900)485-3333^WPN^PH^~(900)545-1234^WPN^CP^~^NET^X.40
> 0^[email protected]|||CHR||123895678|1234^NY
>> QRI|5
>>
> PID||2|5ab16eec-4eb0-4f78-ae45-f8759a83ff10^^^3f0203ca-7da1-4c92-8dcf-74
> 3a5579673f&&^PI~5ab16eec-4eb0-4f78-ae45-f8759a83ff10^^^EMR_3f0203ca-7da1
> -4c92-8dcf-743a5579673f&&^PI|5ab16eec-4eb0-4f78-ae45-f8759a83ff10^^^3f02
> 03ca-7da1-4c92-8dcf-743a5579673f|Jack^Straw^T|Mommmmy|20001111|M||2028-9
> |Brigade
>> Street Las vegas^^New
>>
> York^10005^USA||(900)485-5344^PRN^PH^~(900)545-1200^PRN^CP^~^NET^X.400^m
> [email protected]|(900)485-3333^WPN^PH^~(900)545-1234^WPN^CP^~^NET^X.40
> 0^[email protected]|||CHR||123891234|1234^NY
>> QRI|4.35708725
>>
>>
>> I am using following piece of code:
>>
>> terser.get("/patientidentificationsegment(0)/.PID-3-1");
>> terser.get("/patientidentificationsegment(1)/.PID-3-1");
>>
>> I came to know from this forum [forum topic no
>> http://old.nabble.com/terser---syntax-to13883873.html#a13904316] that
> we
>> can achieve the same. But i am getting exception like:
>>
>> "Exception: java.lang.IllegalArgumentException: The pattern
>> patientidentificationsegment is not valid. Only [\w\*\?]* allowed. "
>>
>> For financial and observation
>>
>> terser.get("/FINANCIAL(0)/FT1-1");
>> terser.get("/FINANCIAL(1)/FT1-1");
>>
>> terser.get("/OBSERVATION(0)/OBX-1");
>> terser.get("/OBSERVATION(1)/OBX-1");
>>
>> What will be used for PID segment?
>>
>> Thanks & regards,
>> depeche
>>
>
> --
> View this message in context:
> http://old.nabble.com/How-to-handle-multiple-PID-returned-in-RSP%5EK22%5
> ERSP_K21-messages-of-version-2.5-messages--tp28854205p28856197.html
> Sent from the hl7api-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------
> ------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
--
View this message in context:
http://old.nabble.com/How-to-handle-multiple-PID-returned-in-RSP%5EK22%5ERSP_K21-messages-of-version-2.5-messages--tp28854205p28876197.html
Sent from the hl7api-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel