Hi Hugh,

The issue here is the line endings.

You have \n instead of \r so it thinks that everything in the message is a
part of your MSH segment.

Cheers,
James


On Tue, Apr 16, 2013 at 12:18 PM, <hscu...@verizon.net> wrote:

>   Thanks so much for getting back to me. Here’s the class being run from
> a Junit test. I’ve included the output below. The message is faithfully
> cast for structure but the values are not there. Perhaps the factory is
> creating an empty one. I know this is really rudimentary stuff so I
> appreciate your looking at it. As I said, the examples for V2.2 work fine
> and in fact this code worked with an ORU_01 message I found in the ether.
>
> This message parses nicely in the Hapi Test panel
>
>
> import ca.uhn.hl7v2.DefaultHapiContext;
> import ca.uhn.hl7v2.HL7Exception;
> import ca.uhn.hl7v2.HapiContext;
> import ca.uhn.hl7v2.model.Message;
> import ca.uhn.hl7v2.*;
> import ca.uhn.hl7v2.model.v25.message.ORU_R01;
> import ca.uhn.hl7v2.model.v25.datatype.XPN;
> import ca.uhn.hl7v2.model.v25.message.ADT_A02;
> import ca.uhn.hl7v2.model.v23.message.ADT_A08;
> import ca.uhn.hl7v2.model.v25.message.ADT_A01;
> import ca.uhn.hl7v2.model.v25.segment.MSH;
> import ca.uhn.hl7v2.model.v25.segment.PID;
> import ca.uhn.hl7v2.parser.CanonicalModelClassFactory;
> import ca.uhn.hl7v2.parser.EncodingNotSupportedException;
> import ca.uhn.hl7v2.parser.Parser;
> import ca.uhn.hl7v2.parser.PipeParser;
>
> /**
> * Created with IntelliJ IDEA.
> * User: Hugh
> * Date: 4/15/13
> * Time: 11:36 AM
> * To change this template use File | Settings | File Templates.
> */
> public class HL725Parser {
>
>     public HL725Parser(){
>
>
>     }
>
>     public void parseMessage () {
>          String msg1 =
> "MSH|^~\\&|SOARF|HMC|||201304110916||ADT^A02|4c73eeb1-85ee-439f-91d9-747cb20d82ed|P|2.5||2|||||||\n"
> +
>
> "EVN|A02|201304110916||XFR|B0QZ_LGILLE|201304110914|939\n" +
>
> "PID|1||4125315^^^900000^PN^^20130411~401768^^^14^MR^^20130411||Smith^Boy
> Gloria^^^^^L^^^20130411~Smith^Baby 
> Gloria^^^^^L^^^20130411@20130411||201304110706|M||H|500
> MARY SUE
> DR^^ATLANTA^GA^30721^USA^M^^White^^^20130411||^PRN^PH^^1^706^2295221||EN|S|NRL|1000038688^^^14^VCD^^20130411|||1000038533^^^14^VCD^^20130410~100039469^^^14^VN^^20130410~227922^^^900000^PN^^20021011~169813^^^14^MR^^20021011~255892163^^^900001^SS^^20130410|HIS||N|1|||||N|N||2013|||||\n"
> +
>                  "PD1||||||||N||||||^L|||||||\n" +
>                  "PV1|1|I|NCN^NCN IN53^IN5301^939|Newborn||NCN^NCN
> BEDS^NURS03^939|600458^Whitman^Jeffeory^H^^^^^11^L^^^PRN^^^^19560901~421805573^^^^^^^^900001^^^^HPSS~100^^^^^^^^900000^^^^DN~D41371^^^^^^^^900002^^^^UPIN~010588^^^^^^^^1788^^^^PRN~1720074198^^^^^^^^900004^^^^NPI~022667^^^^^^^^13^^^^LN~AW1082697^^^^^^^^900001^^^^DEA|||NUR|||N|Born
> in
> hospital||||IP|100039638^^^14^VN^^20130411|Mcaid|||||||||||||||||||939|||||201304110706|||||||V|\n"
> +
>                  "PV2|||^Newborn
> (Vaginal)||||~~~~false||||||||N||||||Y||Inpatient^L^17^^^900000^XX^^
> ~^^1528056066^^^900004^NPI^^ |Checked in|Newborn||||||N|||||Y||||Nursery
> Newborn|||||||\n" +
>
> "ROL||UC|AT|600458^Whitman^Jeffeory^H^^^^^11
> ^L^^^PRN^^^^19560901~421805573^^^^^^^^900001
> ^^^^HPSS~100^^^^^^^^900000
> ^^^^DN~D41371^^^^^^^^900002
> ^^^^UPIN~010588^^^^^^^^1788
> ^^^^PRN~1720074198^^^^^^^^900004
> ^^^^NPI~022667^^^^^^^^13
> ^^^^LN~AW1082697^^^^^^^^900001
> ^^^^DEA|201304110706||||Phys|||^WPN^PH^^0^706^8762130^0~^ORN^FX^^0^706^8762168\n"
> +
>                  "OBX|1|NM|9272-6^Apgar 1^LN||0||||||||||||\n" +
>                  "OBX|2|NM|9274-2^Apgar 5^LN||0||||||||||||\n" +
>                  "PDA||||||N|||N\n" +
>
> "ZPV|||||||||||||||||||||||||||||||||||||||||||||||||\"\"||||||||||||^^mostCurrEncTypeCd^mostCurrEncTypeCd^IP||||||||100039638^^No
> SCD^14^ZAVN^^20130411||201304110706|\n";
>
>
>
>          HapiContext context = new DefaultHapiContext();
>          Parser p = context.getGenericParser();
>          Message hl7msg;
>
>          try {
>
>              hl7msg = p.parse(msg1);
>          } catch (EncodingNotSupportedException e) {
>              e.printStackTrace();
>              return;
>          } catch (HL7Exception e) {
>              e.printStackTrace();
>              return;
>          }
>
>         //ORU_R01 adtMsg = (ORU_R01)hl7msg;
>         ADT_A02 adtMsg = (ADT_A02)hl7msg;
>         PID pid  = adtMsg.getPID();
>         XPN [] names = adtMsg.getPID().getPatientName();
>
>         ca.uhn.hl7v2.model.v25.segment.MSH msh = adtMsg.getMSH();
>         System.out.println("patientName length: " +
> pid.getPatientName().length);
>
>         String msgTrigger =
> msh.getMessageType().getTriggerEvent().getValue();
>         System.out.println("messageTrigger: " + msgTrigger);
>
>
>
>     }
>
> }
>
>
> And here’s the output
>
> "C:\Program Files\Java\jdk1.6.0_23\bin\java"
> -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:4263,suspend=y,server=n
> -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ
> IDEA 12.1\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA
> 12.1\plugins\junit\lib\junit-rt.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\alt-rt.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\alt-string.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\charsets.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\deploy.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\javaws.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\jce.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\jsse.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\management-agent.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\plugin.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\resources.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\rt.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\ext\dnsns.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\ext\localedata.jar;C:\Program
> Files\Java\jdk1.6.0_23\jre\lib\ext\sunjce_provider.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\out\production\ZipiParser;C:\Program
> Files (x86)\JetBrains\IntelliJ IDEA
> 12.1\lib\junit-4.10.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-base-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-examples-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-hl7overhttp-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v21-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v22-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v23-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v24-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v25-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v26-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v231-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\hapi-structures-v251-2.1.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\log4j-1.2.17.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\slf4j-api-1.6.6.jar;C:\Users\Hugh\Documents\dev\Roku\ZipiParser\lib\slf4j-log4j12-1.6.6.jar"
> com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit3
> mediavision.com.test.HL7MessageShuttleTest,testHL725Parser
> Connected to the target VM, address: '127.0.0.1:4263', transport: 'socket'
> log4j:WARN No appenders could be found for logger
> (ca.uhn.hl7v2.parser.DefaultModelClassFactory).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> patientName length: 0
> messageTrigger: A02
> Disconnected from the target VM, address: '127.0.0.1:4263', transport:
> 'socket'
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to