nHapi
nHapi copied to clipboard
PipeParser.Encode produces duplicate values for some fields
private void CreateOBX(ORU_R01_ORDER_OBSERVATION orderObservation) {
var obr = orderObservation.OBR;
obr.SetIDOBR.Value = "1";
obr.PlacerOrderNumber.UniversalID.Value = [SOME VALUE];
obr.UniversalServiceID.Text.Value = "Document";
obr.ObservationEndDateTime.TimeOfAnEvent.SetLongDate(DateTime.Now);
obr.ResultStatus.Value = "F";
obr.PlacerOrderNumber.EntityIdentifier.Value = [SOME VALUE];
for (var i = 0; i < chunks.Count(); i++)
{
var idx = i + 1;
var ob = orderObservation.GetOBSERVATION(i);
var obx = ob.OBX;
obx.SetIDOBX.Value = idx.ToString();
obx.ValueType.Value = "ED"; //this assumes base64 encoding and mime type is read from obx5.2 and obx 5.3
obx.ObservationIdentifier.Identifier.Value = "PDFReport";
obx.ObservationIdentifier.Text.Value = "PDFReport";
obx.ObservationSubID.Value = idx.ToString();
Terser.Set(obx, 5, 0, 1, 1, "");
Terser.Set(obx, 5, 0, 2, 1, "PDF");
Terser.Set(obx, 5, 0, 3, 1, "PDF");
Terser.Set(obx, 5, 0, 4, 1, "Base64");
Terser.Set(obx, 5, 0, 5, 1, [SOME B64 ENCODED STRING VALUE];
}
}
When you look at the data in that field using Terser.Get(obx,5,0,5,1), the value what is what it should be, but when you try to generate an HL7 file, the data in that field is duplicated starting with ^PDF^PDF^Base64 which exists twice as part of the duplication.