Thanks for your reply James.

I ran the test you provided, and it passed as you expected.

Couple of things.

The OBX-5 provided in the example has 9 repeats.  You only had code to test 8. 
If you add the line:

       assertEquals("", obx.getOBX().getObx5_ObservationValue()[8].encode());

Then the test fails.

Alternatively the assertions could be reduced to:

       assertEquals("Count of OBX-5 repeat is 9", 9, 
obx.getOBX().getObx5_ObservationValueReps());

Which also fails.

To check if this might be something particular to OBX-5 entries, given their 
variable nature I extended the test to include a check on another repeating 
field by adding 3 repeat characters to the end of the PID-3 list (making 4 
repeats)

               + "PID|1||10011682^^^CL_MRN 
Pool^^CD:237968946~~~|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605
 W 12 MILE RD^^FARM 
MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN
 NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r"

and added another assertion:

       assertEquals("Count of PID-3 repeat is 4", 4, ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getPATIENT().getPID().getPid3_PatientIdentifierListReps());

This also fails.

Any thoughts on what is going on?

Thanks
Ian

From: James Agnew [mailto:jamesag...@gmail.com]
Sent: Monday, 7 December 2015 11:13 PM
To: Ian Vowles
Cc: hl7api-devel@lists.sourceforge.net
Subject: Re: [HAPI-devel] Parser dropping 1 empty repeat on an OBX-5 each time 
you parse

Hi Ian,
I turned this into a unit test, and it seems to give me the expected results:

       String msg = 
"MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r"
               + "PID|1||10011682^^^CL_MRN 
Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605
 W 12 MILE RD^^FARM 
MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN
 NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r"
               + 
"PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r"
               + 
"ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY
 DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary 
Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External 
Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY
 DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary 
Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External 
Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r"
               + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o 
Contrast|||||||||||Rad Type&Rad 
Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic
 Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r"
               + "OBX|1|TX|20725^ROUTINE 
HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r"
               + "NTE|1|P|Special Instructions-\r";

       Parser p = new GenericParser();

       Message hapiMsg;

       // The parse method performs the actual parsing

       hapiMsg = p.parse(msg);

       ORU_R01_OBSERVATION obx = ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0);
       assertEquals("This", 
obx.getOBX().getObx5_ObservationValue()[0].encode());
       assertEquals("Is", obx.getOBX().getObx5_ObservationValue()[1].encode());
       assertEquals("A", obx.getOBX().getObx5_ObservationValue()[2].encode());
       assertEquals("Report", 
obx.getOBX().getObx5_ObservationValue()[3].encode());
       assertEquals("", obx.getOBX().getObx5_ObservationValue()[4].encode());
       assertEquals("", obx.getOBX().getObx5_ObservationValue()[5].encode());
       assertEquals("", obx.getOBX().getObx5_ObservationValue()[6].encode());
       assertEquals("", obx.getOBX().getObx5_ObservationValue()[7].encode());
Cheers,
James

On Mon, Nov 30, 2015 at 10:59 PM, Ian Vowles 
<ian.vow...@health.qld.gov.au<mailto:ian.vow...@health.qld.gov.au>> wrote:
We have been having some trouble with textual OBX-5’s which have repeats used 
to indicate each line of a report when some empty repeats exist to denote empty 
lines for formatting.
Is there a way to overcome this?
The following example demonstrates the problem

Thanks
Ian

package hapiexamples;

import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.app.ApplicationException;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.model.v24.message.ORU_R01;
import ca.uhn.hl7v2.parser.GenericParser;
import ca.uhn.hl7v2.parser.Parser;
import java.io.IOException;

/**
*
* @author VowlesI
*/
public class OruR01RepeatsInObx5 {

    public static void main(String[] args) throws HL7Exception, 
ApplicationException, IOException {
        String msg = 
"MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r"
                + "PID|1||10011682^^^CL_MRN 
Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605
 W 12 MILE RD^^FARM 
MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN
 NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r"
                + 
"PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r"
                + 
"ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY
 DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary 
Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External 
Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY
 DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary 
Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External 
Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r"
                + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o 
Contrast|||||||||||Rad Type&Rad 
Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic
 Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r"
                + "OBX|1|TX|20725^ROUTINE 
HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r"
                + "NTE|1|P|Special Instructions-\r";

        Parser p = new GenericParser();

        Message hapiMsg;
        // The parse method performs the actual parsing
        hapiMsg = p.parse(msg);
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
        hapiMsg.parse(hapiMsg.encode());
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
        hapiMsg.parse(hapiMsg.encode());
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
        hapiMsg.parse(hapiMsg.encode());
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
        hapiMsg.parse(hapiMsg.encode());
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
        hapiMsg.parse(hapiMsg.encode());
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
        hapiMsg.parse(hapiMsg.encode());
        System.out.println("OBX-5 has " + ((ORU_R01) 
hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps());
    }
}

********************************************************************************

This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited. The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender by telephone collect on 
Australia +61 1800 198 175<tel:%2B61%201800%20198%20175> or by return email. 
You should also delete this email, and any copies, from your computer system 
network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.

Although Queensland Health takes all reasonable steps to ensure this email does 
not contain malicious software, Queensland Health does not accept 
responsibility for the consequences if any person's computer inadvertently 
suffers any disruption to services, loss of information, harm or is infected 
with a virus, other malicious computer programme or code that may occur as a 
consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and 
not the views of the Queensland Government.

**********************************************************************************

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net<mailto:Hl7api-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to