Configure an HL7 DFDL model to validate the
version of HL7 used by
the messages that are received.
Before you start:
- Import one of the HL7 DFDL libraries into your
workspace. You can import the libraries from the Healthcare:
HL7 to HL7 DFDL pattern, see Integrating with HL7 applications for
more information.
There are three versions of the HL7 DFDL model, one for HL7 version 2.7, one for HL7 version 2.6, and one
for HL7 version 2.5.1
and earlier. It is recommended that you use the DFDL model that matches the
version of HL7 used by
the messages that you are processing. However, by default, the models
do not check the HL7 version
that is used by incoming HL7 messages.
If you want to ensure that you are processing messages that are using
the expected version of HL7,
then you can enable version validation in your model by using the
following procedure.
- From the Broker Development perspective, locate the HL7 DFDL library (HL7v251DFDLLibrary, HL7v26DFDLLibrary or HL7v27DFDLLibrary)
- Click the library name and then click .
- Right-click GenericHL7.xsd and click . The DFDL editor window opens.
- In the DFDL editor
window, click and then select MSH.12.VersionID. The Asserts and Discriminators tab
opens.
- Click the Asserts and Discriminators tab
and click the Add assert link. A
new row is added to the Asserts table.
- Ensure that the value in the Test Kind column
is expression.
- Click in the Test Condition column
and add the required expression to validate the HL7 version. For
example:
- If you want to check that the HL7 version used by a message
is equal to a specific HL7 version
then enter the following.
{./VID.1 eq '<value>'}
where <value> is
the version of HL7 you
expect messages to use. For example, 2.7, 2.6 or 2.5.
- If you want to check that the HL7 version used by a message
is less than a specific HL7 version
then enter the following.
{./VID.1 lt '<value>'}
where <value> is
the version of HL7 you
expect messages to use. For example, 2.7, 2.6 or 2.5.
For more information about creating valid assertion
expressions, see DFDL specification.
- Click in the Message column and
add an appropriate message to display in the trace if the condition
is not met. For example, Incompatible HL7
version.
- Then save the DFDL schema,
click and close the DFDL editor.
You updated the
DFDL schema.
If
you receive any messages that do not match your required HL7 version (when you use
the updated DFDL schema
definition) then the DFDL parsing
stops at the MSH.12 field, and the error message that is defined in
the assertion is shown in the toolkit and the trace. For example,
A
DFDL assert with condition '{./VID.1 eq '2.7'}' evaluated to false
with message 'Incompatible HL7 version' during the parsing of 'MSH.12.VersionID'