In the group ORU_R01_ORDER_OBSERVATION, the cardinality of ORU_R01_OBSERVATION needs to be set to repeating.
The HL7 specs for V2.5 and V2.5.1 (Chapter 7) indicate that there can be multiple OBX segments underneath each OBR segment.
This is implemented properly in the models for V2.3.1 and 2.4, but incorrectly for the NHAPI models V2.5 and V2.5.1.
Required changes in ORU_R01_ORDER_OBSERVATION.cs:
this.add(typeof(ORU_R01_OBSERVATION), true, true);
///<summary>
/// Returns first repetition of ORU_R01_OBSERVATION (a Group object) - creates it if necessary
///</summary>
public ORU_R01_OBSERVATION GetOBSERVATION()
{
ORU_R01_OBSERVATION ret = null;
try
{
ret = (ORU_R01_OBSERVATION)this.GetStructure("OBSERVATION");
}
catch (HL7Exception e)
{
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred", e);
}
return ret;
}
///<summary>
///Returns a specific repetition of ORU_R01_OBSERVATION
/// * (a Group object) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public ORU_R01_OBSERVATION GetOBSERVATION(int rep)
{
return (ORU_R01_OBSERVATION)this.GetStructure("OBSERVATION", rep);
}
/**
* Returns the number of existing repetitions of ORU_R01_OBSERVATION
*/
public int OBSERVATIONRepetitionsUsed
{
get
{
int reps = -1;
try
{
reps = this.GetAll("OBSERVATION").Length;
}
catch (HL7Exception e)
{
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
Works perfectly! Do you know if there are any other issues with V2.5? Specifically I am using ORU_R01.
Thanks,