Search code examples
c#hl7nhapi

OBR Repitions on HL7 ORM_o01 nHapi


Hi I am trying to parse HL7 ORM_o01 Messages but I get an error stating that I cannot get OBR repititions. I'm parsing using HL7 2.3 and this format according to the standard does allow OBR repitions. Below is the HL7 message I'm trying to parse using nHapi. Is there any way to remove the repitition limit?

    MSH|^~\&|TEST|LAB|FFLEX|TEST|20030723120318||ORM^O01|163|T|2.3||||NE|NE
    PID||36996-13|36996-13||WHITE^TEST^W^^|SMITH|19441215|F|NONE||1540 ECONSTITUTION^^LONG BEACH^CA^90001^^^||(480)795-3023|(480)795-3333||||00012350583|015348184||||
    NTE|1||Patient Level Comment Only
    PV1|1|I|ER||||10830^ATTEND^ING|20830^REF^ALICE^|30830^LEE^CONSULT^||||||||40830^LEE^ADMIT^||3501319|
    DG1|1||001.9^CHOLERA NOS|
    GT1|1|000614848|WHITE^TEST^W^^||1540 E CONSTITUTION^^LONGBEACH^CA^90001^^^|(505)791-1023||19441215|F||1|015348184|
    IN1|1|PLAN001|210012|BANNER CHOICE PLUS|445 W 5TH PLACE #108^^LOSANGELES^CA^90002||(800)333-4444|BHA001|VALLEY MC||||||PI|WHITE^TEST^W^^|1|19441215|155 E2nd^^LONG BEACH^CA^90001^^^||||||||||||N|||||123456|
    ORC|NW|000000064|||||||20030723114728|||20830^REF^ALICE^
    OBR|2|000000064||ALT^ALT^L|R|20030723114734|20030723115904||4~CC|Tech|N|||20030723115904|BLDV-BLOOD VENOUS^^^LA~LEFT ARM|40830^LEE^ADMIT^|||||||||||||||285.29^ANEMIA OF OTHERCHRONIC ILLNESS (285.29)^I9||||||||||||||
    NTE|1||N FASTING
    DG1|1||285.29^ANEMIA OF OTHER CHRONIC ILLNESS|
    OBR|2|000000064||ALB^ALBUMIN^L|R|20030723114734|20030723115904||4~CC|Tech|N|||20030723115904|BLDV-BLOOD VENOUS^^^LA~LEFT ARM|40830^LEE^ADMIT^|||||||||||||||285.29^ANEMIA OFOTHER CHRONIC ILLNESS (285.29)^I9||||||||||||||

Solution

  • Ok so with a bit of tinkering I found a method that works...

    With the NHapi 2 core .dll files are required; NHapi.Base.dll and NHapi.Model.V23.dll

    What you need to do is download the source files which you can do from sourceForge. Open the NHapi.Model.V23 project. In the solution the explorer expand Group then go to the ORM_O01_OBSERVATION.cs file.

    inside the class constructor, refer below code:

    public ORM_O01_OBSERVATION(IGroup parent, IModelClassFactory factory) : base(parent, factory){
       try {
          this.add(typeof(OBX), true, false);
          this.add(typeof(NTE), false, true);
       } catch(HL7Exception e) {
          HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating ORM_O01_OBSERVATION - this is probably a bug in the source code generator.", e);
       }
    }
    

    you need to change this.add(typeof(OBX), true, false); to read this.add(typeof(OBX), true, true);

    This will allow OBX to be repeated. You should be able to apply this concept on to any field you are experiencing a problem on.