Configuring HL7 version validation

Configure an HL7® DFDL model to validate the version of HL7 used by the messages that are received.

Before you begin

About this task

Three versions of the HL7 DFDL model are available, one each for HL7 version 2.7, version 2.6, version 2.5.1 and earlier. Use the DFDL model that matches the version of HL7 that is 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. To ensure that you are processing messages that are using the expected version of HL7, you can enable version validation in your model by using the following procedure.

Procedure

  1. In the Application Development perspective, expand the HL7 DFDL library (HL7v251DFDLLibrary, HL7v26DFDLLibrary, or HL7v27DFDLLibrary), then expand Schema Definitions, then urn:hl7-org:v2xml.
  2. Right-click GenericHL7.xsd and click Open With > DFDL Editor.
  3. In the DFDL editor, click HL7 > sequence > MSH > sequence > sequence, then select MSH.12.VersionID.
    The Asserts and Discriminators tab opens.
  4. On the Asserts and Discriminators tab, click Add assert.
    A new row is added to the Asserts table.
  5. Ensure that the value in the Test Kind column is expression.
  6. Click the Test Condition cell and add the necessary expression to validate the HL7 version.
    • To check that the HL7 version that is used by a message is equal to a specific HL7 version, enter the following expression.
      {./VID.1 eq '<value>'} 
      Where <value> is the version of HL7 that you expect messages to use. For example, 2.7, 2.6, or 2.5.
    • To check that the HL7 version that is used by a message is less than a specific HL7 version, enter the following expression.
      {./VID.1 lt '<value>'} 
      Where <value> is the version of HL7 that you expect messages to use. For example, 2.7, 2.6, or 2.5.
    For more information about creating valid assertion expressions, see the DFDL v1.0 Specification.
  7. Click the Message cell and add an appropriate message to show in the trace if the condition is not met.
    For example, Incompatible HL7 version.
  8. Save the DFDL schema, and close the DFDL editor.

Results

The DFDL schema is updated.
If you receive messages that do not match your HL7 version (when you use the updated DFDL schema definition), the DFDL parsing stops at the MSH.12 field. The error message that is defined in the assertion is shown in the Toolkit and the trace, as shown in the following 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'