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

NK1 segments are not parsed for A01 or A03 messages #72

Closed
mcclown opened this issue Feb 2, 2017 · 1 comment · Fixed by #200
Closed

NK1 segments are not parsed for A01 or A03 messages #72

mcclown opened this issue Feb 2, 2017 · 1 comment · Fixed by #200

Comments

@mcclown
Copy link

mcclown commented Feb 2, 2017

For the messages below, the following code gets back an empty NK1 segment. It works fine if the message is an A02, A08 or A28 (I haven't tested further than that). The only data returned by the code below is the data that would be returned by issue #16

I came across this issue with v2.4.0.0 but I've just tested the latest code (v2.5.0.6) and this issue is still present.

IStructure[] nextOfKinCollection = ((NHapi.Model.V25.Message.ADT_A01)msg).GetAll("NK1"); //Returns no useful data

MSH|^~&|V500|01010|TEST|TEST|20170130125848||ADT^A01|12345||2.3||||||8859/1
EVN|A01|20170130125600|||12345|20170130125600
PID|1|12345^^^PATIENT MASTER^MRN^""""|12345^^^PATIENT MASTER^MRN^""""||TEST||20101114|F||4|16 Bothar Na Tra^^Ireland^^^1101^home^^""""||||2303|1|""""|12345^^^EPISODE NUMBER^FIN NBR^""""|12312312310|||""""|||0|Not Known / Not Stated|""""|1101||""""
PV1|1|I|TEST^08^011^A207^^Bed(s)^A207|01||""""^""""^""""^""""^^^""""|0121212J^Stephen^Peter^J^^Dr^^^Doctor Provider Number^Personnel^^^DOCUPIN^""""|||ONC|""""|""""|1|01|""""|""""|0121212J^Stephen^Peter^J^^Dr^^^Doctor Provider Number^Personnel^^^DOCUPIN^""""|8|12345^0^""""^^Visit Id|5M^20170130125600||""""||||||||||||||""""|""""|""""|B2021||Active|||20170130125600
NK1|1||||0404111111^^^[email protected]||Proxy
NK1|2||||0404111112^^^[email protected]||Proxy 2

IStructure[] nextOfKinCollection = ((NHapi.Model.V25.Message.ADT_A03)msg).GetAll("NK1"); //Returns no useful data

MSH|^~&|V500|01010|TEST|TEST|20170130125848||ADT^A03|12345||2.3||||||8859/1
EVN|A01|20170130125600|||12345|20170130125600
PID|1|12345^^^PATIENT MASTER^MRN^""""|12345^^^PATIENT MASTER^MRN^""""||TEST||20101114|F||4|16 Bothar Na Tra^^Ireland^^^1101^home^^""""||||2303|1|""""|12345^^^EPISODE NUMBER^FIN NBR^""""|12312312310|||""""|||0|Not Known / Not Stated|""""|1101||""""
PV1|1|I|TEST^08^011^A207^^Bed(s)^A207|01||""""^""""^""""^""""^^^""""|0121212J^Stephen^Peter^J^^Dr^^^Doctor Provider Number^Personnel^^^DOCUPIN^""""|||ONC|""""|""""|1|01|""""|""""|0121212J^Stephen^Peter^J^^Dr^^^Doctor Provider Number^Personnel^^^DOCUPIN^""""|8|12345^0^""""^^Visit Id|5M^20170130125600||""""||||||||||||||""""|""""|""""|B2021||Active|||20170130125600
NK1|1||||0404111111^^^[email protected]||Proxy
NK1|2||||0404111112^^^[email protected]||Proxy 2

@milkshakeuk
Copy link
Member

milkshakeuk commented Apr 15, 2021

@mcclown The changes in PR #200 should allow you to access the NK1 data.

I have added a test for this.

[Test]
public void Parse_V23_ADT_A01()
{
    var message =
        "MSH|^~\\&|V500|01010|TEST|TEST|20170130125848||ADT^A01|12345||2.3||||||8859/1\r"
        + "EVN|A01|20170130125600|||12345|20170130125600\r"
        + "PID|1|12345^^^PATIENT MASTER^MRN^|12345^^^PATIENT MASTER^MRN^||TEST||20101114|F||4|16 Bothar Na Tra^^Ireland^^^1101^home^^||||2303|1||12345^^^EPISODE NUMBER^FIN NBR^|12312312310||||||0|Not Known / Not Stated||1101||\r"
        + "PV1|1|I|TEST^08^011^A207^^Bed(s)^A207|01||^^^^^^|0121212J^Stephen^Peter^J^^Dr^^^Doctor Provider Number^Personnel^^^DOCUPIN^|||ONC|||1|01|||0121212J^Stephen^Peter^J^^Dr^^^Doctor Provider Number^Personnel^^^DOCUPIN^|8|12345^0^^^Visit Id|5M^20170130125600|||||||||||||||||||B2021||Active|||20170130125600\r"
        + "NK1|1||||0404111111^^^[email protected]||Proxy\r"
        + "NK1|2||||0404111112^^^[email protected]||Proxy 2";

    var parser = new PipeParser();

    var adtA01 = (NHapi.Model.V23.Message.ADT_A01)parser.Parse(message);
    var allNextOfKin = adtA01.GetAll("NK12");

    Assert.IsNotNull(allNextOfKin);
    Assert.IsNotEmpty(allNextOfKin);
    Assert.AreEqual(
        "[email protected]",
        ((Model.V23.Segment.NK1)allNextOfKin[0]).GetPhoneNumber(0).EmailAddress.Value);
    Assert.AreEqual(
        "[email protected]",
        ((Model.V23.Segment.NK1)allNextOfKin[1]).GetPhoneNumber(0).EmailAddress.Value);
}

The reason you have to use NK12 in the GetAll Method like so adtA01.GetAll("NK12") is because the parser was not expecting NK1 segments after the PV1.

In the message type ADT_A01 and ADT_A03 the NK1 segments should come after the PID segment and before the PV1 segment in the V2.3 HL7 specification.

So instead of inserting the existing group NK1 (since the parser has already moved passed that group and not found any NK1 segments, it creates a new group and appends a version to the end, and adds the NK1 segments to that group instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants