Schematron files are used to validate the content/values of codes and OIDs within an IG by compiling a series of xml rule assertions. Trifolia produces an exportable Schematron file for each IG based on template constraints defined by the Trifolia user. While Trifolia can generate/export Schematron for basic IG constraints, more complex IG architecture may require that custom prose and/or Schematron rules be created in addition to Trifolia’s automatically generated prose/Schematron. Every primitive requires custom Schematron to be defined by the user because Trifolia does not have the computable information about the constraint to automatically generate the Schematron for it. Computable constraints may also have custom Schematron, but it is not usually necessary.

SHALL primitive within a MAY primitive

An issue within Trifolia to be aware of is for the case where a MAY primitive on a template that contains a SHALL primitive.

Schematron is expected to enforce the SHALL primitive in every instance where the MAY constraint is present. In other words, when MAY primitive is found to be present, the Schematron is expected to subsequently enforce that the SHALL primitive does not break the rule as specified.

The SHALL primitive is enforced (as expected) in cases when the MAY primitive constraint is placed on a template:

1. MAY contain zero or one [0..1] Certifier performer (identifier: urn:hl7ii:XXXX:YYYY)(CONF:XXX-XXXX)such that it

a. SHALL contain exactly one [1..1] @root (CONF:XXX-XXXY).

In this example, Schematron enforces that @root exists when Certifier performer is present; these are both computable constraints that don’t have custom prose or custom Schematron.

1. MAY contain zero or one [0..1] Certifier performer (identifier: urn:hl7ii:XXXX:YYYY)(CONF:XXX-XXXX) when the document type is XXXX, such that it

a. SHALL contain exactly one [1..1] @root (CONF:XXX-XXXY).

In this example, “when the document type is XXXX” must be represented by a primitive constraint. Because the parent constraint (the MAY constraint) is a primitive constraint, the Schematron cannot enforce @root exists when Ceritifier performer is present.

Solution 1

  1. Create custom Schematron rule at the IG level
  2. Suggested: Add a note on the MAY primitive constraint saying that the IG Schematron will check the SHALL primitive is honored when the MAY primitive is present.

Solution 2

Do not nest SHALL primitives within a MAY primitive. Rather, such SHALL primitives should exist as their own constraint at the top level within the template.

Example:

10. The performer containing the Certifier Performer template SHALL be present for a live birth certificate but SHALL NOT be present for a fetal death report (CONF:XXX-XXXXX).