hl7hl7-v2nhapi

ORU^R01 - Version 2.2 and 2.3 (can't get repetition 2 from field 5 - maximum repetitions is only 1 reps.: segment: obx (rep 0) field 5)


I am getting this Error While Parsing the message .

pipeparser.Parser(message) ---> It throws exception at this line.

Error : can't get repetition 2 from field 5 - maximum repetitions is only 1 reps.: segment: obx (rep 0) field 5

Message Version

2.2 and 2.3

Sample Message :

MSH|^~&|LAB|SSS|RRRR1||201412080903||ORU^R01|2014342330808001||2.2
PID||000000000^8|000000000^^^SSS^MR|||||F||1||||||||000000000^^^SSS^PN|000000000
PV1|0001|I|^^^SSS|||||||YYY||||||||IP|000000000|1|||||||||||||||||||SSS
ORC|RE|2051855|||CM||1^^^201412051855^^STAT|2051855|201412051855||||EMR||201412080903||SSS^SSS^L
OBR|1|2051855^2051855|339.01149|CULT WD^WOUND CULTURE^L|||201412051858|||Bal|||||WOUND&WOUND&L^WOUND|^CAL^CAR||||3||201412080903|||F||1^^^201412051858^^STAT||4659571
OBX|24|TX|TESTNM^TEST^L||WOUND CULTURE||||||C||260.00.295|201412051858
OBX|25|TX|SOURCE^SOURCE^L||WOUND||||||C||260.00.295|201412051858
OBX|26|TX|COLLDT^COLLECTION DATE/TIME^L||12/05/2014 18:58||||||C||260.00.295|201412051858
OBX|27|TX|PLTDT^PLATE DATE/TIME^L||12/06/2014 14:15||||||C||260.00.295|201412051858
OBX|28|TX|CULTST^CULTURE STATUS^L||Final||||||C||260.00.295|201412051858
OBX|29|TX|SPCMN^SPECIMEN NUMBER^L||339.01149||||||C||260.00.295|201412051858
OBX|30|TX|CLNSIG^CLINICAL SIGNIFICANCE^L||Significance Not Determined||||||C||260.00.295|201412051858
OBX|31|TX|GRAM STAIN^GRAM STAIN^L||MODERATE WHITE BLOOD CELLS~FEW GRAM NEGATIVE BACILLI~FEW GRAM POSITIVE COCCI CLUSTERS~OCCASIONAL GRAM POSITIVE COCCI IN PAIRS|||^N|||F|||201412051858|PM
OBR|2|2051855^2051855|339.01149|CULT WD^WOUND CULTURE^L|||201412051858|||Bal|||||WOUND&WOUND&L^WOUND|^CAL^CAR||||3^1||201412080903|||F|MORMOM^MORMOM|1^^^201412051858^^STAT||4659571
OBX|32|TX|ORG ID^ORGANISM ID^L|1|MODERATE MORGANELLA MORGANII SSP MORGANII|||^N|||C||260.01.285|201412051858|PM
OBR|3|2051855^2051855|339.01149|CULT WD^WOUND CULTURE^L|||201412051858|||Bal|||||WOUND&WOUND&L^WOUND|^CAL^CAR||||3^1||201412080903|||F|MORMOM^MORMOM|1^^^201412051858^^STAT||4659571
OBX|33|NM|AMPICILLIN^AMPICILLIN^L|1|>= 32|||R|||F||260.01.010|201412051858|PM
OBX|34|NM|AMIKACIN^AMIKACIN^L|1|<= 2|||S|||F||260.01.015|201412051858|PM
OBX|35|NM|CEFAZOLIN^CEFAZOLIN^L|1|>= 64|||R|||F||260.01.020|201412051858|PM
OBX|36|NM|CEFTRIAXONE^CEFTRIAXONE^L|1|<= 1|||S|||F||260.01.035|201412051858|PM
OBX|37|NM|CIPROFLOXACIN^CIPROFLOXICIN^L|1|<= 0.25|||S|||F||260.01.040|201412051858|PM
OBX|38|NM|GENTAMICIN^GENTAMICIN^L|1|<= 1|||S|||F||260.01.045|201412051858|PM
OBX|39|NM|NITROFURANTOIN^NITROFURANTOIN^L|1|128|||R|||F||260.01.060|201412051858|PM
OBX|40|NM|PIP/TAZO^PIPERACILLIN/TAZ^L|1|<= 4|||S|||F||260.01.065|201412051858|PM
OBX|41|NM|TOBRAMYCIN^TOBRAMYACIN^L|1|<= 1|||S|||F||260.01.070|201412051858|PM
OBX|42|NM|TRIMETHOPRIM/SULFA^TRIMETH/SULFA^L|1|<= 20|||S|||F||260.01.075|201412051858|PM
OBX|43|NM|AMP SULBACT^AMP/SULBACTAM^L|1|>= 32|||R|||F||260.01.080|201412051858|PM
OBX|44|NM|ERTAPENEM^ERTAPENEM^L^35801-0^Ertapenem Islt MIC^LOINC|1|<= 0.5|||S|||F||260.01.330|201412051858|PM
OBX|45|NM|AZTREONAM^AZTREONAM^L^18868-0^Aztreonam Susc Islt^LOINC|1|<= 1|||S|||F||260.01.335|201412051858|PM
OBX|46|NM|CEFEPIME^CEFEPIME^L^18879-7^Cefepime Susc Islt^LOINC|1|<= 1|||S|||F||260.01.360|201412051858|PM
OBX|47|NM|MEROPENEM^MEROPENEM^L^18943-1^Meropenem Susc Islt^LOINC|1|<= 0.25|||S|||F||260.01.430|201412051858|PM

Solution

  • As the error message states, the specifications only allow for one "Observation Value" field 5 in an OBX. If you look at OBX Set Id 31, it has multiple values (using the repeating char).

    OBX|31|TX|GRAM STAIN^GRAM STAIN^L||MODERATE WHITE BLOOD CELLS~FEW GRAM NEGATIVE BACILLI~FEW GRAM POSITIVE COCCI CLUSTERS~OCCASIONAL GRAM POSITIVE COCCI IN PAIRS|||^N|||F|||201412051858|PM
    

    This is not allowed in HL7 v2.2 - but it is allowed in v2.3.

    Thus you have a couple of options:

    1. edit the message header, so that it is v2.3
    2. force the parser to use the 2.3 specs.

    Forcing the parser is as simple as

    PipeParser parser = new PipeParser();
    IMessage hl7Message = parser.Parse(hl7, "2.3");
    

    Forcing for HL7 v2.4

    PipeParser parser = new PipeParser();
    IMessage hl7Message = parser.Parse(hl7, "2.4");