|Tutorial #7A : Introduction to Validation and the Simple Profile|
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.
Create a new message viewer,
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:
MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A01^ADT_A01|MSG00001|P|2.3.1 EVN|A01|198808181123 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 NK1|1|JONES^BARBARA^K|WI^WIFE||||NK^NEXT OF KIN PV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||||ADM|A0|||||PR
The message window consists of four tabs, the Editor, Tree View, Hex View and Validation tabs.
Thetab displays the message, and provides a button for you to switch between and viewing modes. The button in the view shows you the meaning of the colour codes used.
Thetab 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.
Theallows 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 , so we can see and remove them from the message.
Finally, thetab is where we can run various validation scripts against the message. This is what this tutorial mainly deals with.
Open thetab. You should get a screen similar to the following:
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 onon the left to add the simple profile to the list of validating scripts. If you run 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 item and click in the checkbox next to .
Clickingnow 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 item.
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 () 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 thetab, 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 thetab. This is the ER7 format of the message, clicking on the button will convert it to XML format, and clicking back on the 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:
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.