Daily using/supporting

Get Firefox browser!
Get Thunderbird!
Get Opera browser!
Get The Gimp!
Get Inkscape!
Get LibreOffice!
Get Videolan!
Get Linux!
Get Mandriva!
Get Joomla!
Hacker Emblem

Archives

Which topics would you like us to cover more?

Latest comments

Home Architecture, security and coding HL7 version 2.3 problem with too many Patient ID's
HL7 version 2.3 problem with too many Patient ID's
Written by Division by Zero   
Friday, 23 April 2010 10:00

Last week we had to implement HL7 version 2.3 for a client. While testing the implementation we got a strange error:

NHapi.Base.HL7Exception: Can't get repetition 2 from field
4 - maximum repetitions is only 1 reps.: Segment: PID (rep 0) Field #4

After looking at the original HL7 message we found that the message contained three different alternate patient id's. According to nHapi the HL7 version 2.3 standard only allows a maximum of two id's. Our client wasn't complaint to the standard or the interpretation of nHapi is wrong. The latter was the case according to our client, but I think that the first case is true.

Anyhow, this problem needed to be solved. Because the error was given by the PipeParser of nHapi we had just two options. Parse the message ourselves en correct the amount of id's or alter the behavior of nHapi. The first one is hard to do and probably will give a lot of maintenance issues in the future. Although this is hard to predict, custom code will have bugs and parsing text messages isn't easy to do if there is such a comprehensive standard for the messages. The second one proved to be a lot easier, but the downside of this solution is that we need to keep track of the changes we make in standard technology. If a new version of nHapi is available, we will need to make these changes again (and hope that the changes are as easy as the first time).

The change that we made on nHapi was in the Hl7Models solution, which can be downloaded here. By opening the NHapi.Model.V23 project and locating the PID class in the Segment directory we had the right segment to change. From there the change was easy. In the constructor the whole message definition is given in arrays. We just needed to change the third line (field 4 in the PID segment of the HL7 message). Originally this was:

 this.add(typeof(CX), false, 1, 12, new System.Object[]{message}, "Alternate Patient ID"); 

This line means the type of the segment, if it's required, amount of maximum repetitions, maximum field length, etc. By changing the maximum amount of repetitions to 2 the problem was solved. According to our client it is possible that more than three alternate id's are send in a message. To be sure we increased the number to 10.

 this.add(typeof(CX), false, 10, 12, new System.Object[]{message}, "Alternate Patient ID"); 

Problem solved.

 

Comments  

 
0 # Periander 2011-12-06 03:21
Thanks alot! I had a similar issue with PID-5s out of a hospital system and nHAPI PipeParser.
Reply | Reply with quote | Quote
 

Add comment


Security code
Refresh

I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams


© 2009 - 2013, Division by Zero

Template based on the empire template by joomlashack 

 Creative Commons License
This work by Division by Zero is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License.