The value that can be used to replace a slot in an expression template may be constrained by an expression constraint, value list constraint or range constraint (depending on the type of replacement slot). The following types of slot constraint may be used:
- Expression constraints may be used to constrain replacement slots of type id and scg,
- Value list constraints may be used to constrain replacement slots of type tok, str, int and dec,
- Range constraints may be used to constrain replacement slots of type int and dec.
The following sections provide examples of each of these types of replacement constraints.
Expression constraints may be used to constrain the values permitted to replace a slot of type id or scg in an expression template.
For example, the slot in the following expression template can only be replaced by a concept reference that is a descendant or self of |Anatomical or acquired body structure|.Because the concept |Shoulder region structure| is a descendant or self of |Anatomical or acquired body structure|, it may be used to replace the slot in the above expression template, resulting in the following expression. However, the concept |Nonspecific site| may not be used as a replacement (because it is not a descendant or self of |Anatomical or acquired body structure|).
Similarly, in the following expression template, the slot can be replaced by any expression that is a descendant of |Anatomical or acquired body structure|.
Value List Constraints
Value list constraints can be used to constrain the possible values that may replace slots of type tok, str, int and dec.
For example, the following expression template uses a value list constraint to specify the possible definitionStatus tokens that may be used. The slot in this expression template may be replaced with either the token "<<<" or the token "===".If the causative agent is assigned the value |Amoxicillin| then the following two expressions can be generated (depending on the token selected to replace the first slot). The expression template below uses a value list constraint to constrain the value of the slot to the string "PANADOL", the string "TYLENOL", or the string “HERRON”.1 Depending on the value used to replace the slot, any of the following three expressions may be generated. In the next example, a value constraint is used to constrain a replacement slot of type int. In this case, the slot may be replaced by the integer values 10, 20 or 30. The possible expressions that may be generated by filling the slot are:
Range constraints can be used by slots of type int or dec to constrain the permitted replacement values. Range constraints may specify the minimum permitted value, the maximum permitted value or both. By default, ranges are inclusive (that is, the range includes the stated minimum and maximum values). However exclusive ranges (in which the stated minimum or maximum is not itself allows as a value) may be specified.
For example, the following expression template allows any pack size to be used that is between 20 and 30 capsules (inclusive).1To specify exclusive minimum values, a greater than sign (‘>’) is placed before the minimum value, and to specify exclusive maximum values, a less than sign (‘<’) is placed before the maximum value. For example, the following expression template allows any pack size that is between 20 and 30 capsules (exclusive). This range constraint is equivalent to an inclusive range of 21..29. Multiple ranges may be specified in a single range constraint. When multiple ranges are specified, these should be interpreted as alternative ranges. For example, the expression template below permits any pack size between 10 and 20 capsules (inclusive), or between 30 and 40 capsules (inclusive). This template does not, for example, permit a pack size between 21 and 29 capsules. When a minimum value is required with no maximum, it is possible to omit the maximum value in a range constraint. For example, the expression template below permits any pack size greater than or equal to 20 capsules. Similarly, it is also possible to state a maximum without a minimum constraint. For example, the expression template below permits any pack size less than or equal to 20 capsules. It should be noted that without a concept model rule to ensure that all pack sizes are greater than zero, this template will, by default, allow a pack size of zero or a negative pack size to be defined.
|1||Please note that these example expression templates are based on a hypothetical drug concept model, and are not intended to reflect any specific drug model. In these expressions, the SNOMED CT identifiers created with the '9999999' namespace are for example only, and should not be used in a production environment. [ a b ]|