Share via


What to do?

When processing HL7 messages, parsing errors can be difficult to troubleshoot.  Understanding the format and content of a message helps to identify the root cause.  Each schema is built based on 3 base schemas by version:  segments, tables values and data types schemas.  An HL7 message has an out of the box or custom schema.  For a patient admission demographic update, the message type is ADT^A08.  ADT indicates the message is a patient administration message and A08 is the trigger event or demographic update such as address change.  There are many message types and trigger events and beyond the scope of this blog.  The ADT message is composed of an MSH segment, many body segments (PID, NK1, PV1, PV2, OBX, etc) and ZSegments (declared and undeclared).  The segments are defined in the base schema Segments_<version>.  The Segments_<version> schema uses the datatypes_<version> and tablevalues<version> schemas for each field in the segments.   

When a parsing error occurs, the event log entry contains the Segment Id, Sequence Number, Field Number, an Error Number and Description.  Some of the common Error Description:  data type error, table value not found, required field missing, etc. 

Segment Id: PD1_PatientAdditionalDemographicSegment
Sequence Number: 1 - if the same segment occurs more than once then the number corresponds to the occurrence of the segment in error.
Field Number: 4 - This will normally matches the field in the segment. 
Error Number: 103 - This number depends on the description.
Error Description: Table value not found

Example of an MSH segment:

MSH|^~\&|Tutorial_ADTSystem|MCM|InterfaceEngine||199601121005||ADT^A03|000001|P|2.3.1

MSH - is the segment.  For MSH, you will always have a value of 1 for Sequence Number.  For Segments that allow multiples then the segment number could be 1 or higher. 

Field Number - In the case of MSH, "|" is equal MSH1, "^~\&" is equal to encoding characters or MSH2, "Tutorial_ADTSystem" is equal MSH3-1, etc.

Error Number - This value goes with Error Description. 

When a parsing error occurs and tracking is enabled, select "Save to File" on the suspended message.  This will save the message parts:  Guid_MSHSegment.out, Guid_BodySegments.out and Guid_ZSegment.out.  If tracking is not enabled, select "Message Details" and you can cut and paste the "Message Parts" content.  Once you have the parts in separate files, you can use them to validate the parts against the schema using the schema editor.  Set the "Input Instance Filename" to the saved part and "Validate Instance".  This should provide you some ideas on where the error is and what is wrong with the message or schema definition.