Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HL7 2.1 Fails to parse ORU^R01 ORC segment #84

Closed
jsdratm opened this issue Apr 27, 2017 · 4 comments · Fixed by #136
Closed

HL7 2.1 Fails to parse ORU^R01 ORC segment #84

jsdratm opened this issue Apr 27, 2017 · 4 comments · Fixed by #136

Comments

@jsdratm
Copy link

jsdratm commented Apr 27, 2017

Error: Can't instantiate class NHapi.Model.V21.Datatype.CM
(System.NullReferenceException): Object reference not set to an instance of an object.: Segment: ORC (rep 0) Field #2

Message:

MSH|^~\&|LCS|LCA|LIS|TEST9999|199807311532||ORU^R01|3629|P|2.1
PID|2|2161348462|20809880170|1614614|20809880170^TESTPAT||19760924|M|||^^^^00000-0000|||||||86427531^^^03|SSN# HERE
ORC|NW|8642753100012^LIS|20809880170^LCS||||||19980727000000|||HAVILAND
OBR|1|8642753100012^LIS|20809880170^LCS|008342^UPPER RESPIRATORY CULTURE^L|||19980727175800||||||SS#634748641 CH14885 SRC:THROA SRC:PENI|19980727000000||||||20809880170||19980730041800||BN|F
OBX|1|ST|008342^UPPER RESPIRATORY CULTURE^L||FINALREPORT|||||N|F||| 19980729160500|BN
ORC|NW|8642753100012^LIS|20809880170^LCS||||||19980727000000|||HAVILAND
OBR|2|8642753100012^LIS|20809880170^LCS|997602^.^L|||19980727175800||||G|||19980727000000||||||20809880170||19980730041800|||F|997602|||008342
OBX|2|CE|997231^RESULT 1^L||M415|||||N|F|||19980729160500|BN
NTE|1|L|MORAXELLA (BRANHAMELLA) CATARRHALIS
NTE|2|L| HEAVY GROWTH
NTE|3|L| BETA LACTAMASE POSITIVE
OBX|3|CE|997232^RESULT 2^L||MR105|||||N|F|||19980729160500|BN
NTE|1|L|ROUTINE RESPIRATORY FLORA
@ryankelley
Copy link
Collaborator

@jsdratm Did you ever find a solution to get nHapi to parse your message?

@slartibartfast3000
Copy link

slartibartfast3000 commented Jan 23, 2019

There's a number of validation errors on that message e.g.
Looks like the MSH segment isn't correct e.g. field separator wasn't validating, it was missing a backslash

MSH|^~&|LCS|LCA|LI...

I suspect that's just a copy and paste error in to github comment requires backslash to be escaped.

There are other fields missing, for example mandatory dates in the OBR segment and CE datatype

Ensure that's resolved first

try installing Hapi test panel and ensure hl7 is well formatted

@ryankelley
Copy link
Collaborator

@slartibartfast3000 Thanks for the tip, interestingly enough, the messages works fine in hapi test panel, but errors out with this same error in nHapi

vyfster pushed a commit to vyfster/nHapi that referenced this issue Apr 4, 2019
 - This small patch fixes errors thrown in nHapiNET#63 as well as nHapiNET#84 Applying these fixes as per inbound HIE data found in a real use case.
 - taken from nHapiNET#108
@milkshakeuk
Copy link
Member

This was fixed by #136, and is available in the latest preview v3.0.0-preview.2.

I wrote a quick test just to make sure

[Test]
public void Test()
{
    var input =
        @"MSH|^~\&|LCS|LCA|LIS|TEST9999|199807311532||ORU^R01|3629|P|2.1
PID|2|2161348462|20809880170|1614614|20809880170^TESTPAT||19760924|M|||^^^^00000-0000|||||||86427531^^^03|SSN# HERE
ORC|NW|8642753100012^LIS|20809880170^LCS||||||19980727000000|||HAVILAND
OBR|1|8642753100012^LIS|20809880170^LCS|008342^UPPER RESPIRATORY CULTURE^L|||19980727175800||||||SS#634748641 CH14885 SRC:THROA SRC:PENI|19980727000000||||||20809880170||19980730041800||BN|F
OBX|1|ST|008342^UPPER RESPIRATORY CULTURE^L||FINALREPORT|||||N|F||| 19980729160500|BN
ORC|NW|8642753100012^LIS|20809880170^LCS||||||19980727000000|||HAVILAND
OBR|2|8642753100012^LIS|20809880170^LCS|997602^.^L|||19980727175800||||G|||19980727000000||||||20809880170||19980730041800|||F|997602|||008342
OBX|2|CE|997231^RESULT 1^L||M415|||||N|F|||19980729160500|BN
NTE|1|L|MORAXELLA (BRANHAMELLA) CATARRHALIS
NTE|2|L| HEAVY GROWTH
NTE|3|L| BETA LACTAMASE POSITIVE
OBX|3|CE|997232^RESULT 2^L||MR105|||||N|F|||19980729160500|BN
NTE|1|L|ROUTINE RESPIRATORY FLORA";

    var parser = new PipeParser();
    var message = parser.Parse(input);
    var oru = (ORU_R01)message;

    var placerorder = oru.GetPATIENT_RESULT().GetORDER_OBSERVATION().ORC.PLACERORDER;
    var orc2Rep0 = ((GenericPrimitive)((Varies)placerorder.Components.GetValue(0)).Data).Value;

    Assert.AreEqual("8642753100012", orc2Rep0);
}

@milkshakeuk milkshakeuk linked a pull request Apr 12, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants