You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know if an IMessage contains an optional segment or not. In my case I have en ORU_R01 type that may or may not include a PV1 segment, but I cannot find a "proper" way to determine that.
I have tried using an ADT_A01 message. In this case I can use the IGroup.GetAll() method which seems to do the trick, but I fail to see that work for the ORU_R01 message. Maybe it has to do with me not knowing the right HL7 path expressions.
As a workaround I have tried using Terser.Finder.FindSegment("PV1",0) and then checking some of the properties of the segment. It can work, but I consider it to be a poor option as it could lead to other issues.
The below code shows an ORU_R01 message without a PV1 segment. In the bottom of the snippet I have added my attempts to identify the PV1 segment using various methods and HL7 path expressions.
ORU_R01oruMessage=new ORU_R01();// Populate the MSH segmentMSHmshSegment= oruMessage.MSH;
mshSegment.FieldSeparator.Value ="|";
mshSegment.EncodingCharacters.Value ="^~\\&";
mshSegment.SendingApplication.NamespaceID.Value ="SendingApp";
mshSegment.SendingFacility.NamespaceID.Value ="SendingFacility";
mshSegment.ReceivingApplication.NamespaceID.Value ="ReceivingApp";
mshSegment.ReceivingFacility.NamespaceID.Value ="ReceivingFacility";
mshSegment.DateTimeOfMessage.Time.Value = DateTime.Now.ToString("yyyyMMddHHmmss");
mshSegment.MessageType.MessageCode.Value ="ORU";
mshSegment.MessageType.TriggerEvent.Value ="R01";
mshSegment.MessageControlID.Value ="12345";
mshSegment.ProcessingID.ProcessingID.Value ="P";
mshSegment.VersionID.VersionID.Value ="2.5.1";// Populate the PID segmentPIDpidSegment= oruMessage.GetPATIENT_RESULT().PATIENT.PID;
pidSegment.SetIDPID.Value ="1";
pidSegment.PatientID.IDNumber.Value ="123456";
pidSegment.GetPatientName(0).FamilyName.Surname.Value ="Doe";
pidSegment.GetPatientName(0).GivenName.Value ="John";
pidSegment.DateTimeOfBirth.Time.Value ="19800101";
pidSegment.AdministrativeSex.Value ="M";// Populate the OBR segmentORU_R01_ORDER_OBSERVATIONorderObservation= oruMessage.GetPATIENT_RESULT().GetORDER_OBSERVATION();OBRobrSegment= orderObservation.OBR;
obrSegment.SetIDOBR.Value ="1";
obrSegment.PlacerOrderNumber.EntityIdentifier.Value ="123456";
obrSegment.FillerOrderNumber.EntityIdentifier.Value ="654321";
obrSegment.UniversalServiceIdentifier.Identifier.Value ="TestCode";
obrSegment.ObservationDateTime.Time.Value = DateTime.Now.ToString("yyyyMMddHHmmss");// Populate the OBX segmentOBXobxSegment= orderObservation.GetOBSERVATION().OBX;
obxSegment.SetIDOBX.Value ="1";
obxSegment.ValueType.Value ="TX";
obxSegment.ObservationIdentifier.Identifier.Value ="TestObservation";
obxSegment.Units.Identifier.Value ="mg/dL";
obxSegment.ReferencesRange.Value ="70-100";
obxSegment.ObservationResultStatus.Value ="F";// Populate the PV1 segment//PV1 pv1Segment = oruMessage.GetPATIENT_RESULT().PATIENT.VISIT.PV1;varpv1= oruMessage.GetPATIENT_RESULT().PATIENT.VISIT.PV1;//returns a PV1 object - I hoped for nullvarpv1UsingGetAll1= oruMessage.GetAll("PV1");//throws exception no matter if I added the PV1 segment or not - I hoped for null if it does not existsvarpv1UsingGetAll2= oruMessage.GetAll("PATIENT_RESULT/PATIENT/VISIT/PV1");//throws exception no matter if I added the PV1 segment or not - I hoped for null if it does not exists
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using v251.
I would like to know if an IMessage contains an optional segment or not. In my case I have en ORU_R01 type that may or may not include a PV1 segment, but I cannot find a "proper" way to determine that.
I have tried using an ADT_A01 message. In this case I can use the IGroup.GetAll() method which seems to do the trick, but I fail to see that work for the ORU_R01 message. Maybe it has to do with me not knowing the right HL7 path expressions.
As a workaround I have tried using Terser.Finder.FindSegment("PV1",0) and then checking some of the properties of the segment. It can work, but I consider it to be a poor option as it could lead to other issues.
The below code shows an ORU_R01 message without a PV1 segment. In the bottom of the snippet I have added my attempts to identify the PV1 segment using various methods and HL7 path expressions.
Beta Was this translation helpful? Give feedback.
All reactions