S h o r t S t o r i e s

// Tales from software development

NHapi bug: OBX-5 repetitions not handled correctly

with 4 comments

Recently I stumbled across a bug in NHapi in which the second and further repetitions of an OBX-5 field are not correctly processed. It’s surprising that this bug hasn’t been noticed before as it appears to have been there from the start.

The Varies class in NHapi.Base.Model implements a method called fixOBX5() which instantiates an NHapi HL7 data type instance of the type specified in OBX-2 for each repetition in the OBX-5 and stores it in the data property of the Varies instance associated with the repetition.

Unfortunately, fixOBX5() is written in such a way that only the first repetition is processed. This means that the data property of the Varies instance for the first repetition will be correctly set to an instance of the type specified in OBX-2 (e.g. TX, CE, NM, SN, etc) but the subsequent repetitions, if any, won’t.

The problem has been logged on CodePlex, the new home (as of April 2014) for NHapi.

I’ve also forked the NHapi source, fixed the bug, and sent the NHapi team a pull request so that they can incorporate the fix.

 

Advertisements

Written by Sea Monkey

August 19, 2014 at 8:00 pm

Posted in HL7

Tagged with

4 Responses

Subscribe to comments with RSS.

  1. I too, ran into this issue today. I appreciate the work you did on the updated code. Downloaded, compiled, and added the new DLL and it worked beautifully.

    My sincere thanks.
    James

    James Bateman

    November 27, 2014 at 3:18 am

    • James, thanks for letting me know. It seemed odd to me that apparently no one else had encountered this problem and so it made me doubt my diagnosis and solution. So, while I’m sorry to hear that you hit the same problem, it’s good to know that it’s not just me!

      Sea Monkey

      November 27, 2014 at 11:09 am

  2. Is there any way to remove repitition limits on specific fields?

    LeRoi

    December 11, 2015 at 8:08 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: