After an expression template has been processed, it is important to validate the expressions that are generated. This validation process may include checking that:
- Each expression is syntactically valid;
- Each expression conforms to the structure and constraints defined in the template; and
- Each expression is valid according to the SNOMED CT concept model.
Please note that concept model validation may not be required in all use cases.
The SNOMED CT expressions generated when processing an expression template must be syntactically valid according the SNOMED CT compositional grammar syntax. To test for syntactic correctness, an expression parser, based on the ABNF rules defined in the SNOMED CT compositional grammar specification is used. For more information, please refer to 7.2 Parsing.
The SNOMED CT expressions generated when processing an expression template must conform to the structure and constraints defined in the template. This includes:
- Each part of the resulting expression should conform structurally to a correspond part of the template, in the same order that it appears in the template;
- All mandatory parts of the expression template must appear at least once in the resulting expression (i.e. where the minimum cardinality is > 0);
- All non-repeatable parts of the expression template must appear at most once in the resulting expression (ie. where the maximum cardinality is 1); and
- Each token, concept, expression or value in the resulting expression, that was added as a result of replacing a slot, must conform to the type (e.g. id, scg) and value constraint (e.g. expression constraint, value list or range) defined in the corresponding slot;
Concept Model Validation
In most cases, the SNOMED CT expressions generated when processing an expression template should conform to the SNOMED CT concept model. This can be tested automatically by checking for conformance with the rules defined in the SNOMED CT machine readable concept model (MRCM) in conjunction with a specific SNOMED CT substrate (e.g. the active concepts in the current SNOMED CT international edition). This includes determining the domains that the focus concepts belong to, checking that the attributes are valid for the given domains, checking that the attributes appear an appropriate number of times, and ensuring that the value of each attribute is in the correct range. For more information on using the MRCM to validate postcoordinated expressions please refer to 6. Considerations.