Introduction to Validation

Validation of messages is an extremely important concept. Validation allows HL7Connect to make sure the messages being sent/received conform to an applicable set of rule that can be altered depending on the situation. Validation scripts can be created to impose additional constraints, and can be used as needed. This tutorial deals with an introduction to validation in the HL7 Development Environment.

The Message Window

Create a new message viewer, File | New | HL7 Message

Default Message Window

You will see a screen similar to the above appear. Paste the following message over the existing message string (this is the message produced in the translation tutorial 5) and save as validate7.hl7:

PID|1|123456|||JONES^WILLIAM^A^III||19610615|M||C|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(91-9)379-1212|(919)271-3434||S||PATID12345001^2^M10^ADT1^AN^A|123456789|987654^NC

The message window consists of four tabs, the Editor, Tree View, Hex View and Validation tabs.

The Editor tab displays the message, and provides a button for you to switch between XML and ER7 viewing modes. The Legend button in the ER7 view shows you the meaning of the colour codes used.

The Tree View tab presents you with the segments that exist in the message, and every possible acceptable field, together with their type and length, that can exist in each segment.

The Hex View allows you to Hex edit the message. This is useful for debugging messages by looking for non-printable ASCII characters. These characters, when used incorrectly, will ofter bring down interfaces if a system sends a message with one mid-segment. They are not visible in the other views, but are in the Hex View, so we can see and remove them from the message.

Finally, the Validation tab is where we can run various validation scripts against the message. This is what this tutorial mainly deals with.

Simple Profile Validation

Open the Validation tab. You should get a screen similar to the following:

Validation Tab -- No Scripts

Short of creating any custom validation scripts, we are able to compare the message with the 'Simple Profile'. This simple validation profile will assess the message's conformance to the HL7 standard.

Click on Add Simple Profile on the left to add the simple profile to the list of validating scripts. If you run Validate now, nothing will happen. This is because although the profile has been added to the list of scripts, it has not been selected. Expand the Scripts item and click in the checkbox next to Simple Validation Profile.

Clicking Validate now will result in the indicator box going red, and a beep being emmitted. This indicates that the message has failed the validation. To see what errors occured, click on the Simple Validation Profile item.

Validation Tab -- Error

We can see that in this case, there is only one error with the message:

Similar to Tutorial 6, we can look up this segment in the dictionary (HL7Connect | HL7 Dictionary) to work out a correct value for the field. In this case however, we will simply insert a dummy variable, '123456'.

To change the message and insert this value we have three options. We can hex-edit the message in the Hex View tab, or edit the ER7 or XML formatted message. In this case the HEX format is unsuitable, the ER7 formatted message will be the easiest to edit in, and the XML format will be slightly harder.

Go back to the Editor tab. This is the ER7 format of the message, clicking on the To XML button will convert it to XML format, and clicking back on the To ER7 button will convert it back into ER7 form.

The place with the parsing error is marked by the Development Environment with an orange highlight. PID-3 is the segment bounded to the right by the orange highlight. Simply insert our dummy value in there:

Message Window

Now, going back and validating the message again, the indicator box will turn green, and a different pitched beep will be emmitted. This means the message meets the requirements of the Simple Validation Profile.

© Kestral Computing P/L 2000-2010.