Template Syntax Specification
Template Syntax Specification
Template Syntax
Specification
Version 1.1.1
This PDF document was generated from the web version on the publication date shown
above. Any changes made to the web pages since that date will not appear in the PDF.
i
The SNOMED template syntax specification defines the formal rules for representing slots in SNOMED CT
expressions, expression constraints or queries. A slot either provides information as to how the template
should be processed, or represents a placeholder for a value that is not known at the time of authoring. These
placeholders can be completed at a later time using data recorded elsewhere (such as in an information model
or entered into a data entry form).
The template syntax may be used in conjunction with any of the computable SNOMED CT languages to
represent templates of various kinds. For example, using the template syntax with compositional grammar
enables the representation of expression templates, while using the template syntax with the expression
constraint language enables the representation of expression constraint templates.
SNOMED templates can be used for a number of purposes, including to define reusable patterns for authoring
and validating precoordinated concept definitions and postcoordinated expressions.
[Link]
SNOMED CT Document Library: [Link]
© Copyright 2020 International Health Terminology Standards Development Organisation, all rights reserved.
Any modification of this document (including without limitation the removal or modification of this notice) is prohibited without the express
written permission of SNOMED International. This document may be subject to updates. Always use the latest version of this document
published by SNOMED International. This can be viewed online and downloaded by following the links on the front page or cover of this
document.
SNOMED®, SNOMED CT® and IHTSDO® are registered trademarks of International Health Terminology Standards Development Organisation.
[Link] For more information about SNOMED International and
[Link] info@[Link].
1
1. Introduction
Background
SNOMED CT is a clinical terminology with global scope covering a wide range of clinical specialties and
requirements. The use of SNOMED CT expressions in electronic health records (EHRs) provides a standardized way
to represent clinical meanings captured by clinicians and enables the automatic interpretation of these meanings.
SNOMED CT expression constraints provide a computable rule that can be used to define a bounded set of clinical
meanings for the purpose of constraining the contents of a data element in an electronic health record (EHR),
intensionally defining a concept-based reference set, querying SNOMED CT content in a machine processable way,
or restricting the range of an attribute defined in the SNOMED CT concept model.
In some situations, however, the specific concepts or values are not known at the time of authoring. In these cases,
one or more slots may be used within an expression or expression constraint to create an expression template or
expression constraint template (respectively). Slots provide a placeholder in the expression or expression constraint,
whose specific value can be completed at a subsequent time using a concept recorded within an information
model, entered into a data entry form, or sourced by some other means. When each slot in the template has been
replaced with a specific value, the result should be a syntactically correct expression or expression constraint.
SNOMED CT templates can be used for a number of purposes, including to define reusable patterns for authoring
and validating precoordinated concept definitions and postcoordinated expressions.
History
The SNOMED CT Template Syntax (v1.0) was first published in July 2017. In 2020, the syntax was updated (v1.1) to
support boolean attribute values.
Purpose
The purpose of this document is to define and describe a consistent mechanism for SNOMED CT templates, which
can be used to convert any computable SNOMED CT language into a SNOMED CT template language. For example,
by using the syntax provided in this document, SNOMED CT compositional grammar can be used as an expression
template language, and the SNOMED CT expression constraint Language can be used as an expression constraint
template language. This guide also provides examples and guidance to assist in the processing of templates.
Scope
This document presents the specification of a SNOMED CT template syntax, which can be used together with other
formal SNOMED CT languages to develop SNOMED CT Templates. The SNOMED CT Template Syntax is part of a
consistent set of computer processable language syntaxes designed to support a variety of use cases involving the
use of SNOMED CT. Other computable SNOMED CT languages that are either complete or under development
include:
Compositional Grammar: designed to represent SNOMED CT expressions;
Expression Constraint Language: designed to represent a bounded set of clinical meanings represented
using SNOMED CT; and
This document provides a specification, examples and general guidance to assist in the representation and
processing of SNOMED CT templates.
However, this document does not include a full description of how to implement a template parser or interpreter. It
does not describe how to transform a template into other languages (such as OWL, SPARQL or SQL), or how to
determine whether two templates are equivalent. It also does not describe how to implement a terminology server
2
Audience
The target audiences of this document include:
SNOMED International National Release Centres;
SNOMED CT designers and developers, including designers and developers of EHR systems, information
models, data entry interfaces, storage systems, decision support systems, retrieval and analysis systems,
communication standards and terminology services;
SNOMED CT terminology developers, including concept model designers, content authors, map developers,
subset and constraint developers and release process managers.
It should be noted that this document contains both technical and non-technical content. In particular, the detailed
logical model and formal syntax is specifically focussed at more technical readers. Less technical readers are
Document Overview
This document defines the SNOMED CT template syntax and describes how and where it may be implemented.
Chapter 2 begins by describing some key use cases in which SNOMED CT templates can be used. Chapter 3 then
describes the requirements used to guide the definition of this syntax. In Chapter 4, the logical model of the
template syntax is presented, while Chapter 5 defines the ABNF serialisation of the logical model. Chapter 6
explains how to apply the SNOMED CT template syntax to other computable languages, and provides the syntax for
the expression template language (ETL). In chapter 7, we explain the steps involved in processing an expression
template to create a set of populated expressions. And finally, in chapter 8, we present some examples of SNOMED
CT expression templates that conform to the syntaxes defined in Chapters 5 and 6.
3
2. Use Cases
When values within a SNOMED CT expression, expression constraint or query are unknown at the time of authoring,
a SNOMED CT template may be used. The SNOMED CT template syntax can be used in conjunction with the
SNOMED CT computable languages to create SNOMED CT template languages for this purpose. For example:
Using the template syntax with SNOMED CT compositional grammar enables the representation of
expression templates
SNOMED CT expression constraint language enables the representation
of expression constraint templates
1 query
templates.
This version of the SNOMED CT template syntax specifically focuses on supporting two important use cases in which
the SNOMED CT template syntax is needed. In particular to support:
Authoring of precoordinated concepts
Defining consistent postcoordinated expressions
SNOMED CT Compositional Grammar. Therefore, this
E
xpression Template Language. Future versions of this specification will explore other use cases, and additional
template languages (e.g. the Expression Constraint Template Language).
1 Please note that the SNOMED CT query language is not yet available.
71388002 |Procedure| :
363704007 |Procedure site|
260686004 |Method| 312251004 |Computed tomography imaging action| }
4
Table 2.1-1: An example expression template
Table 2.1-2: Expressions that result from populating the example expression template
5
Expression Template
List of Substances
256259004 |Pollen|
89811004 |Gluten|
47703008 |Lactose|
13577000 |Nut|
33396006 |Nickel|
Resulting Expressions
6
7
3. Requirements
In this chapter, we state the requirements of the SNOMED CT Template Syntax. These requirements are grouped
into general SNOMED CT language requirements (which are shared by all SNOMED CT computable languages),
template design requirements and template processing requirements.
8
Requirement D.5: Repeatability of template components
Templates should support a way of indicating how many times each focus concept, relationship group and
attribute value pair can be repeated when the template is populated
9
4. Logical Model
A SNOMED CT template is a SNOMED CT expression, expression constraint, or query that contains one or more slots.
Each template slot either provides information as to how the template should be processed (i.e. an information
slot), or serves as a placeholder for a specific value that may be completed at a subsequent time. Each replacement
slot may have a replacement type (e.g. concept, expression, token, string, integer, decimal or boolean), a slot name,
and a replacement constraint. Depending on the replacement type, the replacement constraint may either be an
expression constraint, a value list constraint or a range constraint. Each information slot may have a cardinality and
a slot name.
The SNOMED CT template syntax defines the syntax used for these slots, irrespective of the computable language in
Figure 4-1
Please note that no specific semantics should be attributed to each arrow in this diagram.
10
11
4.1 UML Class Diagram
The figure below provides a non-normative representation of the logical model of the SNOMED CT Template Syntax
using a UML class diagram.
Please note that each of the classes in this diagram corresponds to a rule in the syntax specification defined in 5.
Syntax Specification. For a short description of each of these, please refer to 5.2. Informative Comments.
12
Figure 4.1-1: UML class diagram of template syntax
13
5. Syntax Specification
The following sections describe the rules used by the Template Syntax. This syntax is a serialised representation of
the logical model presented in the previous chapter, and is considered to be the normative syntax for
interoperability purposes.
14
slotDecimalMinimum = [ exclusiveMinimum ] slotDecimalValue
slotDecimalMaximum = [ exclusiveMaximum ] slotDecimalValue
slotDecimalValue = "#" ["-"/"+"] decimalValue
exclusiveMinimum = ">"
exclusiveMaximum = "<"
slotName = "@" (slotStringValue / nonQuoteStringValue)
slotToken = definitionStatus / memberOf / constraintOperator / conjunction / disjunction / exclusion / reverseFlag /
expressionComparisonOperator / numericComparisonOperator / stringComparisonOperator /
booleanComparisonOperator
nonQuoteStringValue = *(%x21 / %x23-26 / %x2A-3F / %x41-5A / %x5C / %x5E-7E) ; string with no ws, quotes, at,
square brackets or round brackets
templateInformationSlot = "[[" ws slotInformation ws "]]"
slotInformation = [cardinality ws] [slotName ws]
; Expression Constraint Language v1.4
slotExpressionConstraint = ws ( slotRefinedExpressionConstraint / slotCompoundExpressionConstraint /
slotDottedExpressionConstraint / slotSubExpressionConstraint ) ws
slotRefinedExpressionConstraint = slotSubExpressionConstraint ws ":" ws slotEclRefinement
slotCompoundExpressionConstraint = slotConjunctionExpressionConstraint /
slotDisjunctionExpressionConstraint / slotExclusionExpressionConstraint
slotConjunctionExpressionConstraint = slotSubExpressionConstraint 1*(ws conjunction ws
slotSubExpressionConstraint)
slotDisjunctionExpressionConstraint = slotSubExpressionConstraint 1*(ws disjunction ws
slotSubExpressionConstraint)
slotExclusionExpressionConstraint = slotSubExpressionConstraint ws exclusion ws slotSubExpressionConstraint
slotDottedExpressionConstraint = slotSubExpressionConstraint 1*(ws slotDottedExpressionAttribute)
slotDottedExpressionAttribute = dot ws slotEclAttributeName
slotSubExpressionConstraint = [constraintOperator ws] [memberOf ws] (slotEclFocusConcept / "(" ws
slotExpressionConstraint ws ")")
slotEclFocusConcept = slotEclConceptReference / wildCard
dot = "."
memberOf = "^"
slotEclConceptReference = conceptId [ws "|" ws term ws "|"]
conceptId = sctId
term = 1*nonwsNonPipe *( 1*SP 1*nonwsNonPipe )
wildcard = "*"
constraintOperator = childOf / descendantOrSelfOf / descendantOf / parentOf / ancestorOrSelfOf / ancestorOf
descendantOf = "<"
descendantOrSelfOf = "<<"
childOf = "<!"
15
ancestorOf = ">"
ancestorOrSelfOf = ">>"
parentOf = ">!"
conjunction = (("a"/"A") ("n"/"N") ("d"/"D") mws) / ","
disjunction = ("o"/"O") ("r"/"R") mws
exclusion = ("m"/"M") ("i"/"I") ("n"/"N") ("u"/"U") ("s"/"S") mws
slotEclRefinement = slotSubRefinement ws [slotConjunctionRefinementSet / slotDisjunctionRefinementSet]
slotConjunctionRefinementSet = 1*(ws conjunction ws slotSubRefinement)
slotDisjunctionRefinementSet = 1*(ws disjunction ws slotSubRefinement)
slotSubRefinement = slotEclAttributeSet / slotEclAttributeGroup / "(" ws slotEclRefinement ws ")"
slotEclAttributeSet = slotSubAttributeSet ws [slotConjunctionAttributeSet / slotDisjunctionAttributeSet]
slotConjunctionAttributeSet = 1*(ws conjunction ws slotSubAttributeSet)
slotDisjunctionAttributeSet = 1*(ws disjunction ws slotSubAttributeSet)
slotSubAttributeSet = slotEclAttribute / "(" ws slotEclAttributeSet ws ")"
slotEclAttributeGroup = ["[" cardinality "]" ws] "{" ws slotEclAttributeSet ws "}"
slotEclAttribute = ["[" cardinality "]" ws] [reverseFlag ws] slotEclAttributeName ws
(expressionComparisonOperator ws slotSubExpressionConstraint / numericComparisonOperator ws
(slotIntegerValue /slotDecimalValue) / stringComparisonOperator ws slotStringValue /
booleanComparisonOperator ws slotBooleanValue)
cardinality = minValue to maxValue
minValue = nonNegativeIntegerValue
to = ".."
maxValue = nonNegativeIntegerValue / many
many = "*"
reverseFlag = "R"
slotEclAttributeName = slotSubExpressionConstraint
expressionComparisonOperator = "=" / "!="
numericComparisonOperator = "=" / "!=" / "<=" / "<" / ">=" / ">"
stringComparisonOperator = "=" / "!="
booleanComparisonOperator = "=" / "!="
stringValue = 1*(anyNonEscapedChar / escapedChar)
integerValue = digitNonZero *digit / zero
decimalValue = integerValue "." 1*digit
booleanValue = true / false
true = ("t"/"T") ("r"/"R") ("u"/"U") ("e"/"E")
false = ("f"/"F") ("a"/"A") ("l"/"L") ("s"/"S") ("e"/"E")
nonNegativeIntegerValue = (digitNonZero *digit ) / zero
sctId = digitNonZero 5*17( digit )
16
ws = *( SP / HTAB / CR / LF / comment ) ; optional white space
mws = 1*( SP / HTAB / CR / LF / comment ) ; mandatory white space
comment = "/*" *(nonStarChar / starWithNonFSlash) "*/"
nonStarChar = SP / HTAB / CR / LF / %x21-29 / %x2B-7E /UTF8-2 / UTF8-3 / UTF8-4
starWithNonFSlash = %x2A nonFSlash
nonFSlash = SP / HTAB / CR / LF / %x21-2E / %x30-7E /UTF8-2 / UTF8-3 / UTF8-4
SP = %x20 ; space
HTAB = %x09 ; tab
CR = %x0D ; carriage return
LF = %x0A ; line feed
QM = %x22 ; quotation mark
BS = %x5C ; back slash
digit = %x30-39
zero = %x30
digitNonZero = %x31-39
nonwsNonPipe = %x21-7B / %x7D-7E / UTF8-2 / UTF8-3 / UTF8-4
anyNonEscapedChar = SP / HTAB / CR / LF / %x20-21 / %x23-5B / %x5D-7E / UTF8-2 / UTF8-3 / UTF8-4
escapedChar = BS QM / BS BS
UTF8-2 = %xC2-DF UTF8-tail
UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / %xF4 %x80-8F 2( UTF8-tail )
UTF8-tail = %x80-BF
; Additional rules from Compositional Grammar v2.4
definitionStatus = equivalentTo / subtypeOf
equivalentTo = "==="
subtypeOf = "<<<"
templateSlot
A template slot is part of a template that is either replaced with a value (i.e. a templateRelacementSlot), or removed after the
information it contains is interpreted (i.e. a templateInformationSlot).
templateReplacementSlot
concreteValueReplacementSlot
be either a concept replacement slot, an expression replacement slot, a token replacement slot or a concrete value replacement slot.
c
17
A concept replacement slot starts and ends with double square brackets (i.e. "[[ ... ]]"). The first non-whitespace character inside the
brackets must always be a plus sign (i.e. "+"), followed by the concept replacement rule and an optional slot name.
expressionReplacementSlot
An expression replacement slot starts and ends with double square brackets (i.e. "[[ ... ]]"). The first non-whitespace character inside
the brackets must always be a plus sign (i.e. "+"), followed by the expression replacement rule and an optional slot name.
tokenReplacementSlot
A token replacement slot starts and ends with double square brackets (i.e. "[[ ... ]]"). The first non-whitespace character inside the
brackets must always be a plus sign (i.e. "+"), followed by the token replacement rule and an optional slot name.
concreteValueReplacementSlot
A concrete value replacement slot starts and ends with double square brackets (i.e. "[[ ... ]]"). The first non-whitespace character inside
the brackets must always be a plus sign (i.e. "+"), followed by the concept replacement rule and an optional slot name.
conceptReplacement
expressionReplacement
brackets) to restrict the valid values that may replace the slot. Note that "scg" is the default type of replacement slot.
tokenReplacement
A token replacement starts with the text "tok", and then optionally includes a token set (in round brackets) to restrict the valid values
that may replace the slot.
concreteValueReplacement
A concrete value replacement may either be a string replacement, an integer replacement, a decimal replacement, or a boolean
replacement.
stringReplacement
integerReplacement
An integer replacement starts with the text "int", and then optionally includes a integer set (in round brackets) to restrict the valid
values that may replace the slot.
decimalReplacement
A decimal replacement starts with the text "dec", and then optionally includes a decimal set (in round brackets) to restrict the valid
values that may replace the slot.
A boolean replacement starts with the text "bool", and then optionally includes a boolean set (in round brackets) to list the valid values
that may replace the slot.
slotTokenSet
A slotTokenSet consists of one or more slotTokens separated by mandatory white space (i.e. mws).
slotStringSet
A slotStringSet consists of one or more slotStringValues separated by mandatory white space (i.e. mws).
slotStringValue = QM stringValue QM
A slotStringValue is a stringValue surrounded with double quotation marks.
slotIntegerSet
slotDecimalSet
A slotDecimalSet consists of one or more slotDecimals separated by mandatory white space (i.e. mws).
slotBooleanSet
A slotBooleanSet consists of one or more slotBooleanValues separated by mandatory white space (i.e. mws).
18
slotBooleanValue = booleanValue
A slotBooleanValue is simply a boolean value (i.e. true or false).
slotIntegerRange
A slotIntegerRange includes either a slotIntegerMinimum, a slotIntegerMaximum, or both. The slotIntegerMinimum and
slotIntegerMaximum are separated by a 'to' token.
slotIntegerMinimum
A slotIntegerMinimum consists of a minimum slotIntegerValue. By default the minimum is inclusive (i.e. the minimum value is a valid
value in the range). However, the minimum value may be declared to be exclusive (i.e. not a valid value in the range) by preceding it
with the exclusiveMinimum symbol (i.e. ">").
slotIntegerMaximum
A slotIntegerMaximum consists of a maximum slotIntegerValue. By default the maximum is inclusive (i.e. the maximum value is a valid
value in the range). However, the maximum value may be declared to be exclusive (i.e. not a valid value in the range) by preceding it
with the exclusiveMaximum symbol (i.e. "<").
A slotIntegerValue consists of a hash symbol followed by an integer value, with an optional "+" or "-" just before the value.
slotDecimalRange
A slotDecimalRange includes either a slotDecimalMinimum, a slotDecimalMaximum, or both. The slotDecimalMinimum and
slotDecimalMaximum are separated by a 'to' token.
slotDecimalMinimum
A slotDecimalMinimum consists of a minimum slotDecimalValue. By default the minimum is inclusive (i.e. the minimum value is a valid
value in the range). However, the minimum value may be declared to be exclusive (i.e. not a valid value in the range) by preceding it
with the exclusiveMinimum symbol (i.e. ">").
slotDecimalMaximum
A slotDecimalMaximum consists of a maximum slotDecimalValue. By default the maximum is inclusive (i.e. the maximum value is a
valid value in the range). However, the maximum value may be declared to be exclusive (i.e. not a valid value in the range) by preceding
it with the exclusiveMaximum symbol (i.e. "<").
A slotDecimalValue consists of a hash symbol followed by a decimal value, with an optional "+" or "=" just before the value.
exclusiveMinimum
The exclusiveMinimum symbol is ">". When used before the minimum value, it declares that this value is not a valid part of the range.
exclusiveMaximum
The exclusiveMaximum symbol is "<". When used before the maximum value, it declares that this value is not a valid part of the range.
slotName
A slotName starts with an at symbol (i.e. "@"), followed by either a quoted or unquoted string.
nonQuoteStringValue
brackets
A nonQuoteStringValue includes any character that is not whitespace, quotes, or the @ symbol.
slotInformation
A slotInformation consists of either a cardinality, a slotName or both.
19
6. SNOMED CT Language Templates
In this section, we explain how the SNOMED CT template syntax can be applied to the computable languages to
Template Syntax Compositional Grammar
Expression Template Language Template Syntax
Expression Constraint Language to create an Expression Constraint Template Language.
1. Combining the base language (to which the slots are added) with the SNOMED CT template syntax;
2. Adding any additional rules referenced by the SNOMED CT template syntax (e.g. the Expression Constraint
Language to represent slot value constraints);
3. Removing any duplicate rules (e.g. rules that are repeated in both the base language and the expression
constraint language;
4. Adding references to the template syntax in the appropriate rules of the base language to support the
inclusion of slots. This involves:
a. Renaming the first rule in the base language to add the word "Template" (e.g. from "expression" to
"expressionTemplate");
b. tokenReplacementSlot as an alternative wherever a token is referenced (e.g.
"definitionStatus / tokenReplacementSlot");
c. Adding the rules conceptReplacementSlot expressionReplacementSlot as alternatives within
conceptReference rule;
d. concreteValueReplacementSlot as an alternative attributeValue; and
e. templateInformationSlot before each focus concept, each attribute group and each
attribute name value pair.
For an example of how this process is applied to SNOMED CT compositional grammar to create expression
templates, please refer to the Expression Template Language syntax in the next section.
20
attributeName
attributeValue "#" /
concreteValueReplacementSlot
expressionValue "(" ")"
stringValue
numericValue
integerValue
decimalValue "."
booleanValue
true
false
sctId
ws
SP
HTAB
CR
LF
QM
BS
digit
zero
digitNonZero
nonwsNonPipe
anyNonEscapedChar
escapedChar
UTF8-2
UTF8-3
UTF8-4
UTF8-tail
; Template Syntax v1.1
templateSlot = templateReplacementSlot / templateInformationSlot
templateReplacementSlot = conceptReplacementSlot / expressionReplacementSlot / tokenReplacementSlot /
concreteValueReplacementSlot
conceptReplacementSlot = "[[" ws "+" ws conceptReplacement [slotName ws] "]]"
expressionReplacementSlot = "[[" ws "+" ws expressionReplacement [slotName ws] "]]"
tokenReplacementSlot = "[[" ws "+" ws tokenReplacement [slotName ws] "]]"
concreteValueReplacementSlot = "[[" ws "+" ws concreteValueReplacement [slotName ws] "]]"
conceptReplacement = "id" ws [ "(" ws slotExpressionConstraint ws ")" ws]
expressionReplacement = ["scg" ws] ["(" ws slotExpressionConstraint ws ")" ws]
tokenReplacement = "tok" ws [ "(" ws slotTokenSet ws ")" ws]
concreteValueReplacement = stringReplacement / integerReplacement / decimalReplacement /
booleanReplacement
stringReplacement = "str" ws [ "(" ws slotStringSet ws ")" ws]
integerReplacement = "int" ws [ "(" ws slotIntegerSet ws ")" ws]
decimalReplacement = "dec" ws [ "(" ws slotDecimalSet ws ")" ws]
booleanReplacement = "bool" ws [ "(" ws slotBooleanSet ws ")" ws]
slotTokenSet = slotToken *(mws slotToken)
slotStringSet = slotStringValue *(mws slotStringValue)
slotStringValue = QM stringValue QM
slotIntegerSet = ( slotIntegerValue / slotIntegerRange) *(mws (slotIntegerValue / slotIntegerRange))
slotDecimalSet = ( slotDecimalValue / slotDecimalRange) *(mws (slotDecimalValue / slotDecimalRange))
slotBooleanSet = slotBooleanValue *(mws slotBooleanValue)
slotBooleanValue = booleanValue
slotIntegerRange = ( slotIntegerMinimum to [ slotIntegerMaximum ] ) / ( to slotIntegerMaximum )
slotIntegerMinimum = [ exclusiveMinimum ] slotIntegerValue
21
slotIntegerMaximum = [ exclusiveMaximum ] slotIntegerValue
slotIntegerValue = "#" ["-"/"+"] integerValue
slotDecimalRange = ( slotDecimalMinimum to [ slotDecimalMaximum ] ) / ( to slotDecimalMaximum )
slotDecimalMinimum = [ exclusiveMinimum ] slotDecimalValue
slotDecimalMaximum = [ exclusiveMaximum ] slotDecimalValue
slotDecimalValue = "#" ["-"/"+"] decimalValue
exclusiveMinimum = ">"
exclusiveMaximum = "<"
slotName = "@" (slotStringValue / nonQuoteStringValue)
slotToken = definitionStatus / memberOf / constraintOperator / conjunction / disjunction / exclusion / reverseFlag /
expressionComparisonOperator / numericComparisonOperator / stringComparisonOperator /
booleanComparisonOperator
nonQuoteStringValue = *(%x21 / %x23-26 / %x2A-3F / %x41-5A / %x5C / %x5E-7E) ; string with no ws, quotes, at,
square brackets or round brackets
templateInformationSlot = "[[" ws slotInformation ws "]]"
slotInformation = [cardinality ws] [slotName ws]
; Expression Constraint Language v1.4
slotExpressionConstraint = ws ( slotRefinedExpressionConstraint / slotCompoundExpressionConstraint /
slotDottedExpressionConstraint / slotSubExpressionConstraint ) ws
slotRefinedExpressionConstraint = slotSubExpressionConstraint ws ":" ws slotEclRefinement
slotCompoundExpressionConstraint = slotConjunctionExpressionConstraint /
slotDisjunctionExpressionConstraint / slotExclusionExpressionConstraint
slotConjunctionExpressionConstraint = slotSubExpressionConstraint 1*(ws conjunction ws
slotSubExpressionConstraint)
slotDisjunctionExpressionConstraint = slotSubExpressionConstraint 1*(ws disjunction ws
slotSubExpressionConstraint)
slotExclusionExpressionConstraint = slotSubExpressionConstraint ws exclusion ws slotSubExpressionConstraint
slotDottedExpressionConstraint = slotSubExpressionConstraint 1*(ws slotDottedExpressionAttribute)
slotDottedExpressionAttribute = dot ws slotEclAttributeName
slotSubExpressionConstraint = [constraintOperator ws] [memberOf ws] (slotEclFocusConcept / "(" ws
slotExpressionConstraint ws ")")
slotEclFocusConcept = slotEclConceptReference / wildCard
dot = "."
memberOf = "^"
slotEclConceptReference = conceptId [ws "|" ws term ws "|"]
; conceptId = sctId
; term = 1*nonwsNonPipe *( 1*SP 1*nonwsNonPipe )
wildcard = "*"
constraintOperator = childOf / descendantOrSelfOf / descendantOf / parentOf / ancestorOrSelfOf / ancestorOf
descendantOf = "<"
descendantOrSelfOf = "<<"
childOf = "<!"
ancestorOf = ">"
ancestorOrSelfOf = ">>"
parentOf = ">!"
conjunction = (("a"/"A") ("n"/"N") ("d"/"D") mws) / ","
disjunction = ("o"/"O") ("r"/"R") mws
exclusion = ("m"/"M") ("i"/"I") ("n"/"N") ("u"/"U") ("s"/"S") mws
slotEclRefinement = slotSubRefinement ws [slotConjunctionRefinementSet / slotDisjunctionRefinementSet]
slotConjunctionRefinementSet = 1*(ws conjunction ws slotSubRefinement)
slotDisjunctionRefinementSet = 1*(ws disjunction ws slotSubRefinement)
slotSubRefinement = slotEclAttributeSet / slotEclAttributeGroup / "(" ws slotEclRefinement ws ")"
slotEclAttributeSet = slotSubAttributeSet ws [slotConjunctionAttributeSet / slotDisjunctionAttributeSet]
slotConjunctionAttributeSet = 1*(ws conjunction ws slotSubAttributeSet)
slotDisjunctionAttributeSet = 1*(ws disjunction ws slotSubAttributeSet)
22
slotSubAttributeSet = slotEclAttribute / "(" ws slotEclAttributeSet ws ")"
slotEclAttributeGroup = ["[" cardinality "]" ws] "{" ws slotEclAttributeSet ws "}"
slotEclAttribute = ["[" cardinality "]" ws] [reverseFlag ws] slotEclAttributeName ws (expressionComparisonOperator
ws slotSubExpressionConstraint / numericComparisonOperator ws (slotIntegerValue /slotDecimalValue) /
stringComparisonOperator ws slotStringValue / booleanComparisonOperator ws slotBooleanValue)
cardinality = minValue to maxValue
minValue = nonNegativeIntegerValue
to = ".."
maxValue = nonNegativeIntegerValue / many
many = "*"
reverseFlag = "R"
slotEclAttributeName = slotSubExpressionConstraint
expressionComparisonOperator = "=" / "!="
numericComparisonOperator = "=" / "!=" / "<=" / "<" / ">=" / ">"
stringComparisonOperator = "=" / "!="
booleanComparisonOperator = "=" / "!="
; stringValue = 1*(anyNonEscapedChar / escapedChar)
; integerValue = digitNonZero *digit / zero
; decimalValue = integerValue "." 1*digit
; booleanValue = true / false
; true = ("t"/"T") ("r"/"R") ("u"/"U") ("e"/"E")
; false = ("f"/"F") ("a"/"A") ("l"/"L") ("s"/"S") ("e"/"E")
nonNegativeIntegerValue = (digitNonZero *digit ) / zero
; sctId = digitNonZero 5*17( digit )
; ws = *( SP / HTAB / CR / LF / comment ) ; optional white space
mws = 1*( SP / HTAB / CR / LF / comment ) ; mandatory white space
comment = "/*" *(nonStarChar / starWithNonFSlash) "*/"
nonStarChar = SP / HTAB / CR / LF / %x21-29 / %x2B-7E /UTF8-2 / UTF8-3 / UTF8-4
starWithNonFSlash = %x2A nonFSlash
nonFSlash = SP / HTAB / CR / LF / %x21-2E / %x30-7E /UTF8-2 / UTF8-3 / UTF8-4
; SP = %x20 ; space
; HTAB = %x09 ; tab
; CR = %x0D ; carriage return
; LF = %x0A ; line feed
; QM = %x22 ; quotation mark
; BS = %x5C ; back slash
; digit = %x30-39
; zero = %x30
; digitNonZero = %x31-39
; nonwsNonPipe = %x21-7B / %x7D-7E / UTF8-2 / UTF8-3 / UTF8-4
; anyNonEscapedChar = SP / HTAB / CR / LF / %x20-21 / %x23-5B / %x5D-7E / UTF8-2 / UTF8-3 / UTF8-4
; escapedChar = BS QM / BS BS
; UTF8-2 = %xC2-DF UTF8-tail
; UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
; UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / %xF4 %x80-8F 2( UTF8-tail )
; UTF8-tail = %x80-BF
23
7. Processing Expression Templates
When an expression template is used, a number of steps must be performed to create a valid SNOMED CT
In this section, we explain the steps involved in processing an expression template. We also explain the pre-
processing and post-processing tasks involved.
The figure below illustrates this process. Please note that these steps do not necessarily need to be performed in
this order.
24
Focus Concept Slots (each with a slotName and zero or more values), zero or more Relationship Group Slots
Attribute Name-Value Pair Slots (each with a name).
Relationship Group Data
Relationship Group Data Attribute Name-Value
Pair Slots Attribute Name-Value Pair Slot Relationship Group Data instance, there are zero to
Attribute Name-Value Pair Attribute Name
Slot Attribute Value Slot (with name and either a simple data value, or an
Expression Data instance of its own).
Example 1
The expression template below is used to create expressions that represent a |Disease| |Finding
site| |Associated morphology|. When using expression templates, such as this one, in which attribute name-
which data values are
used to populate each slot, and how these values are grouped into relationship groups.
25
64572001 |Disease|
363698007 |Finding site| 272673000 |Bone structure|
116676008 |Associated morphology| 72704001 |Fracture|
To support the creation of input data for this expression template, the logical model in
Group Slot' and 'Attribute Value Slot') with the name of the respective slots in the template, and simplifying where
Please note that this model has been simplified by removing unnamed logical classes, which have a cardinality of
attribute name-value slots are not required in this example. In general,
attribute name-value slots are only required where both the attribute name and the attribute value are represented
using a slot.
, the
Please note that the first column in the
table below is used to group together the input data intended to populate each expression. Subsequent columns
are named according to the associated slot in the expression template. Relationship group slots are used to group
the data that is intended to populate a single relationship group. Attribute name-value slots are not required in this
example. They are are only required where both the attribute name and attribute value use a slot.
26
Expression Data DefStatus Disease Group Site Morphology
92038006 |Benign neoplasm of bronchus| 955009 |Bronchial structure| 3898006 |Neoplasm, benign|
Expression
1
46866001 |Fracture of lower limb| :
363698007 |Finding site| 12611008 |Bone structure of tibia| ,
116676008 |Associated morphology| 72704001 |Fracture|
2
92196005 |Benign neoplasm of lung| 92038006 |Benign neoplasm of bronchus| :
363698007 |Finding site| 39607008 |Lung structure| ,
116676008 |Associated morphology| 3898006 |Neoplasm, benign|
363698007 |Finding site| 955009 |Bronchial structure| ,
116676008 |Associated morphology| 3898006 |Neoplasm, benign|
3
60667009 |Closed fracture of rib|
36991002 |Closed fracture of upper limb|
363698007 |Finding site| 113197003 |Bone structure of rib| ,
363698007 |Finding site| 371195002 |Bone structure of upper limb| ,
116676008 |Associated morphology| 34305007 |Fracture, multiple, closed| }
4
16119006 |Abscess of jaw|
109327001 |Abscess of facial bone|
128234004 |Disorder of maxilla| :
363698007 |Finding site| 70925003 |Bone structure of maxilla|
116676008 |Associated morphology| 44132006 |Abscess| }
Example 2
The expression template below is used as a pattern for family history expressions. It contains a nested relationship
group (i.e. SSgroup) inside the outer relationship group (i.e. AFgroup). To populate this expression template, the
input data must be clear as to where each value should be used, and how these values should be grouped into
relationship groups and expressions.
28
Please note that this model has been simplified by removing unnamed
29
Expression Condition AFgrou Finding SSgrou Severity Site Relationship Time Context
Data p p
1 266898002 |Family 1 195967001 |Asthma| 1 24484000 |Severe| 444301002 |Mother of 410589000 |All times 410515003 |Known
history: Respiratory subject| past| present|
disease|
2 161077003 |Father 1 77176002 |Smoker| 1 255604002 |Mild| 444295003 |Father of 15240007 |Current| 410515003 |Known
smokes| subject| present|
161078008 |Mother 2 77176002 |Smoker| 1 24484000 |Severe| 444301002 |Mother of 15240007 |Current| 410515003 |Known
smokes| subject| present|
3 160288009 |Family 1 372130007 |Malignant 1 6736007 |Moderate| 113179006 |Skin 444304005 |Sister of 410511007 |Current or 410515003 |Known
history: neoplasm of neoplasm of skin| structure of nose| subject| past (actual)| present|
skin|
275937001 |Family 2 255604002 |Mild| 88089004 |Skin
history of cancer| structure of lip|
expressions.
Expression
1
266898002 |Family history: Respiratory disease| :
246090004 |Associated finding| 195967001 |Asthma| 246112005 |Severity| 24484000
|Severe|
408732007 |Subject relationship context| 444301002 |Mother of subject| ,
408731000 |Temporal context| 410511007 |Current or past (actual)| ,
408729009 |Finding context| 410515003 |Known present|
2
161077003 |Father smokes| 161078008 |Mother smokes| :
246090004 |Associated finding| 77176002 |Smoker| 246112005 |Severity| 24484000 |
Severe|
408732007 |Subject relationship context| 444295003 |Father of subject| ,
408731000 |Temporal context| 15240007 |Current| ,
408729009 |Finding context| 410515003 |Known present| },
246090004 |Associated finding| 77176002 |Smoker| 246112005 |Severity| 255604002
|Mild|
408732007 |Subject relationship context| 444301002 |Mother of subject| ,
408731000 |Temporal context| 15240007 |Current| ,
408729009 |Finding context| 410515003 |Known present|
3
160288009 |Family history: neoplasm of skin| 275937001 |Family history of cancer| :
246090004 |Associated finding| 372130007 |Malignant neoplasm of skin| :
246112005 |Severity| 6736007 |Moderate| 363698007 |Finding site| 113179006 |
Skin structure of nose|
246112005 |Severity| 255604002 |Mild| 363698007 |Finding site| 88089004 |Skin
structure of lip|
408732007 |Subject relationship context| 444304005 |Sister of subject| ,
408731000 |Temporal context| 410511007 |Current or past (actual)| ,
408729009 |Finding context| 410515003 |Known present|
Example 3
The expression template below represents a procedure with a single method and one or more procedure devices.
Please note that in the first attribute name-value pair, both the attribute name and the attribute value use a slot.
Because this name-value pair is repeatable, the input data needs to include an attribute name-value pair slot to
ensure that the corresponding attribute name and attribute value stays connected.
71388002 |Procedure|
31
.
uses a replacement slot for both the
attribute name and attribute value, the input data needs to include the attribute name-value pair slot to ensure
that the corresponding attribute name and attribute value stays connected.
32
Expression Data Procedure Group PD_ANVpair DeviceType Device Method
1 1 1
387713003 |Surgical procedure| 363699004 |Direct device| 2282003 |Breast prosthesis, device| 257867005 |Insertion - action|
2 1 1
71388002 |Procedure| 363699004 |Direct device| 313025003 |Hearing aid battery| 282089006 |Replacement - action|
2
363710007 |Indirect device| 6012004 |Hearing aid, device|
Using the input data shown in
will result in the following two expressions.
Expression
1
387713003 |Surgical procedure| :
363699004 |Direct device| 2282003 |Breast prosthesis, device| ,
260686004 |Method| 257867005 |Insertion - action| }
2
384728007 |Replacement of device| :
363699004 |Direct device| 313025003 |Hearing aid battery| ,
363710007 |Indirect device| 6012004 |Hearing aid, device| ,
260686004 |Method| 282089006 |Replacement - action| }
Example 4
|Disease| |Finding site| |Associated
morphology|, grouped into one or more relationship groups.
64572001 |Disease|
363698007 |Finding site| 272673000 |Bone structure|
116676008 |Associated morphology| 72704001 |Fracture|
34
represented using the tabular format used in the previous examples.
Expression Data Group Site Morphology
In addition to this tabular representation, there are a wide variety of other possible formats for representing
template input data, including json, xml, tsv, csv etc. The exact format used will depend on the format required by
For example, the above input data can be represented in JSON as shown below.
35
Example JSON Representation of Input Data
{"Expression Data": [
36
For example, let's consider the following expression template and input data.
64572001 |Disease|
246075003 |Causative agent| 410607006 |Organism|
2 1 49872002 |Virus| 1
The input data above includes 2 focus concepts, 2 relationship groups, and 2 CausedBy attribute-name value pairs
in the first relationship group. To support this input data, the expression template must duplicate the focus
concept, relationship group, and the attribute name-value pair (in the first relationship group).
When parts of an expression template are repeated, it is important to ensure that the correct connector is added
between repeated parts. For example, a "+" is added between repeated focus concepts, a "," is added between
repeated relationship groups (although this is optional), and a "," is added between repeated name-value pairs.
The result of adding repetition and connectors to the above expression template (for the given input data) is shown
below:
Please note that when an expression is used to populate an attribute value, it may be required to add brackets
around the attribute value to ensure syntactic correctness of the resulting expression
37
40733004 |Disorder due to infection| 19342008 |Subacute disease| :
246075003 |Causative agent| 80166006 |Streptococcus pyogenes| ,
246075003 |Causative agent| 113985000 |Streptococcus gallolyticus| ,
255234002 |After| 58718002 |Rheumatic fever|
246075003 |Causative agent| 49872002 |Virus| ,
255234002 |After|
Clean Up
Clean up is an activity that can occur at any or all stages of template processing. However, any clean up that has not
In particular, this step involves removing any extra brackets (i.e. "( ... )"), braces (i.e. "{ ... }"), colons (i.e. ":"), equals
(i.e. "="), attribute names or connectors (i.e. "+" or ",") that would cause the resulting expression to be syntactically
invalid. Extraneous characters are most likely to occur when optional parts of an expression template have no
characters.
In our example expression above, this step would involve removing the second instance of the attribute name
255234002 |After|, the comma before it, and the equals signs after. The resulting expression would look like:
38
Please note that concept model validation may not be required in all use cases.
Syntactic Validation
The SNOMED CT expressions generated when processing an expression template must be syntactically valid
according the SNOMED CT compositional grammar
based on the ABNF rules defined in the SNOMED CT compositional grammar specification is used. For more
7.2 Parsing.
Template Validation
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;
39
8. Expression Template Examples
5. Syntax
Specification can be used to represent expression templates
5. Syntax Specification, all template slots are
1. Replacement Slots, which are replaced by a concept, expression or string during template processing, and
2. Information Slots, which are purely there to provide metadata about how the template is to be processed.
The following pages present a range of examples of how these two types of slots are used within expression
templates:
Focus concept
For example, the
expression template below uses a slot to indicate that the focus concept in the expression can be replaced with any
appropriate SNOMED CT expression. This expression template represents any expression with a single refinement in
which the |Laterality| equals |Right|.
then the expressions that result from processing the template would be:
Attribute Value
A replacement slot may also be used to replace an attribute value in an expression. For example, the expression
|Clinical finding|
40
the attribute |Finding site| .The value of the |Finding site|
time.
then the expression that results from processing the template would be:
404684003 |Clinical finding| 363698007 |Finding site| 53120007 |Upper limb structure|
If, however, the value provided to complete the slot was the expression:
404684003 |Clinical finding| 363698007 |Finding site| 53120007 |Upper limb structure| 272741003 |
Laterality| 7771000 |Left| )
Please note that the template processor must add round brackets around the subexpression to ensure that the
Attribute Name
For example, the expression
|Clinical finding|
equals |Rheumatic fever|The attribute name in the expression may be replaced by any valid attribute concept at a
future time.
then the expressions that result from processing the template would be:
41
404684003 |Clinical finding| 42752001 |Due to| 80166006 |Streptococcus pyogenes|
404684003 |Clinical finding| 255234002 |After| 80166006 |Streptococcus pyogenes|
However, it is not possible to generate a nested expression using this expression template, as the slot may not be
replaced by a postcoordinated expression.
42
82271004 |Injury of head|
417163006 |Injury| 363698007 |Finding site| 69536005 |Head structure|
417163006 |Injury| 118934005 |Disorder of head|
Please note that for the second and third replacements, the template processor must add round brackets around
the subexpression to ensure that the resulting expression is syntactically valid.
If the definitionStatus |'<<<'|is used to complete the slot then the resulting expression would be:
Please note that the template processor must add quotation marks around the string to ensure that the resulting
expression is syntactically valid.
The slot in the following expression template:
43
323510009 |Amoxycillin 500mg capsule|
749999999108 |Has pack size magnitude|
759999999106 |Has pack size units| 428641000 |Capsule|
Please note that the template processor must add a hash symbol ("#") before the integer value to ensure that the
resulting expression is syntactically valid.
The slot in the following expression template:
Please note that the template processor must add a hash symbol ("#") before the decimal value to ensure that the
resulting expression is syntactically valid.
And lastly, the slot in the following expression template:
318969005 |Irbesartan 150 mg oral tablet| 859999999102 |Is in national benefit scheme|
TRUE
318969005 |Irbesartan 150 mg oral tablet| 859999999102 |Is in national benefit scheme|
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.
44
8.3. Constrained Replacement Slots
Overview
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:
id scg,
tok str int, dec and bool.
int dec.
The following sections provide examples of each of these types of replacement constraints.
Expression Constraints
id scg in an
expression template.
71388002 |Procedure| :
260686004 |Method| 312251004 |Computed tomography imaging action|
405813007 |Procedure site - Direct|
442083009 |Anatomical or acquired body structure|
71388002 |Procedure| :
260686004 |Method| 312251004 |Computed tomography imaging action|
405813007 |Procedure site - Direct| 16982005 |Shoulder region structure|
|Nonspecific site|
|Anatomical or acquired body structure|).
|
Anatomical or acquired body structure|.
71388002 |Procedure| :
260686004 |Method| 312251004 |Computed tomography imaging action|
405813007 |Procedure site - Direct|
442083009 |Anatomical or acquired body structure|
45
For example, the following expression template uses a value list constraint to specify the possible definitionStatus
The expression template below uses a value list constraint to constrain the value of the slot to the string
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
The possible expressions that may be generated by filling the slot are:
46
323510009 |Amoxycillin 500mg capsule| :
749999999108 |Has pack size magnitude|
759999999106 |Has pack size units| 428641000 |Capsule|
Range Constraints
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). 1
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
47
323510009 |Amoxycillin 500mg capsule| :
749999999108 |Has pack size magnitude|
759999999106 |Has pack size units| 428641000 |Capsule|
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 ]
Slot Names
Replacement slots may be given a slot name, to allow them to be referenced from outside the slot. There are a
variety of reasons to do this, including assigning a value to each slot and creating a co-dependency constraint
between slots. The most common use of slot names is to refer to the slot to which a value is assigned, during the
process of populating the template.
Slot names are defined within the slot using an '@' prefix. For example, the following expression template includes
|Associated with|. This slot has been given the slot name "finding".
48
243796009 |Situation with explicit context| :
246090004 |Associated finding| 56265001 |Heart disease| ,
40873100 |Temporal context| 410511007 |Current or past (actual)| ,
408729009 |Finding context| 410515003 |Known present| ,
408732007 |Subject relationship context| 444148008 |Person in family of subject|
404684003 |Finding| :
363698007 |Finding site|
363714003 |Interprets| 363787002 |Observable entity| 704319004 |Inheres in|
404684003 |Finding| :
363698007 |Finding site| 10200004 |Liver structure| ,
363714003 |Interprets| 363787002 |Observable entity| 704319004 |Inheres in| 10200004 |Liver
structure|
the information slots is used and then the information slot itself is removed.
Information slots may be added to an expression template in one of three places:
1. Before a focus concept slot to indicate information about the focus concept that follows,
2. Before a relationship group to indicate information about the relationship group that follows, and
3. Before an attribute to indicate information about the attribute name-value pair that follows.
Information slots may include either a cardinality constraint or a slot name (or both). In the following sections, we
describe how each of these may be used in an information slot.
Cardinality
One of the important roles of an information slot is to specify the cardinality of the expression part that follows. A
cardinality constraint states the minimum and maximum number of times that the focus concept, relationship
group or attribute name-value pair that follows may be repeated in an expression that is generated from the given
template.
49
For example, the expression template below allows between one and three concepts to be used to populate the
finding slot, and exactly one |Finding site|
Based on the cardinality specified in the information slots, the finding slot could be replaced by the two concepts |
Infectious disease| and |Congenital disease| site slot could be replaced by the concept |Lung structure|
generate the following expression:
40733004 |Infectious disease| 66091009 |Congenital disease| 363698007 |Finding site| 39607008 |
Lung structure|
Please note that when two or more concepts are used to replace a focus concept slot in an expression template, a
plus sign (+) must be added between them to ensure the resulting expression is syntactically valid.
Default Cardinality
When a cardinality constraint is not provided in an information slot preceding a focus concept, relationship group
. This means that by default focus
concepts, relationship groups and attribute name-value pairs must appear at least once in the resulting expression,
but may also be repeated many times. The SNOMED CT concept model, if enforced, may also impose some
additional cardinality constraints on the number of times an attribute may be repeated. However, these additional
concept model rules are not directly implied by the expression template itself.
As an example, the following expression template allows one or more procedures to be collectively refined by one
|Method| |Procedure site - Direct|.
71388002 |Procedure|
260686004 |Method| 129264002 |Action (qualifier value)| )]],
405813007 |Procedure site - Direct| 442083009 |Anatomical or acquired body structure
(body structure)|
explicitly stated on the focus concept, the relationship group, and each attribute name-value pair.
71388002 |Procedure|
260686004 |Method| 129264002 |Action (qualifier value)| )]],
405813007 |Procedure site - Direct| 442083009 |Anatomical or acquired body
structure (body structure)|
The replacement slots in this expression template could, for example, be replaced to generate the following
expression:
50
76193006 |Routinely scheduled operation| 387713003 |Surgical procedure|
260686004 |Method| 281615006 |Exploration| ,
260686004 |Method| 312250003 |Magnetic resonance imaging - action| ,
405813007 |Procedure site - Direct| 28273000 |Bile duct structure|
260686004 |Method| 129304002 |Excision| ,
405813007 |Procedure site - Direct| 28231008 |Gallbladder structure|
Please note that if the international SNOMED CT concept model was enforced, the above expression would not be
valid due to the 260686004 |Method|
Slot Name
Information slots can also be given a slot name, to allow the expression part that follows the slot (i.e. focus
concept, relationship group, or attribute name-value pair) to be referenced. The most common use of information
slot names is to support the process of populating the template (e.g. as part of a programmatic value replacement
process).
mpGroup to name the relationship group that
|Method| |Procedure site - Direct|
71388002 |Procedure|
260686004 |Method| 312251004 |Computed tomography imaging action| ,
405813007 |Procedure site - Direct| 442083009 |Anatomical or acquired body structure|
Example 1
The following expression template uses three replacement slots to generate an expression that represents a type of
procedure. The first slot (named "Procedure") is a placeholder for the focus concept, while the second slot (named
"BodySite") is a placeholder for the |Procedure site - Direct|, and the third slot (named "Method") is a placeholder
for the |Method|
71388002 |Procedure|
405813007 |Procedure site - direct| 91723000 |Anatomical structure|
260686004 |Method| 129264002 |Action (qualifier value)|
51
If the slots are populated with the values:
387713003 |Surgical procedure|
66754008 |Appendix structure|
129304002 |Excision - action|
then the following expression would be generated.
Another example of an expression template with multiple slots is shown below. This expression template is used to
generate expressions that represent the family history of a patient. The template contains two slots - the first slot
|Clinical finding|
|Subject relationship context| |Clinical finding|.
If the following input data is provided (in which each row represents a separate expression):
Finding Relationship
93870000 |Liver cancer| 444244000 |Maternal grandmother of subject|
52
408729009 |Finding context| 410515003 |Known present| ,
408732007 |Subject relationship context| 444292000 |Paternal grandfather of subject|
Example 1
The following expression template uses three replacement slots to generate an expression that represents a type of
procedure. The first slot (named "Procedure") is a placeholder for the focus concept, while the second slot (named
|Procedure site - Direct|, and the third slot (named "Method") is a placeholder
|Method|
71388002 |Procedure|
405813007 |Procedure site - direct| 91723000 |Anatomical structure|
The first cardinality constraint (i.e. 1..1 ) indicates that exactly one value should be populated in the Procedure slot.
The second cardinality constraint (i.e. 1..2 ) indicates that it is valid to include either 1 or 2 relationship groups in the
resulting expression. The last two cardinality constraints, that appear inside the relationship group, (i.e. 1..1 )
indicate that in each instance of a relationship group, exactly one |Procedure site - direct| |
Method|
The following input data satisfies these cardinality constraints.
If the slots are populated with the values above, then the following expressions would be generated.
53
405813007 |Procedure site - direct| 28231008 |Gallbladder structure| 260686004 |Method|
129304002 |Excision - action|
54
Example 2
Another example of an expression template with multiple cardinality constraints is shown below. This expression
template is used to generate expressions that represent a clinical finding with explicit context.
Condition
The second cardinality constraint (i.e. 1..2 ) indicates that it is valid to include either 1 or 2 relationship groups
AFgroup relationship group must have exactly one |Associated
finding|, exactly one |Subject relationship context|, exactly one |Temporal context| |Finding context|
|Associated finding| AFgroup is an expression, may optionally be refined using a single
SSgroup optionally has one |Severity| |Finding
site|. Based on these cardinality constraints, the input data shown in Table 8.6-1
55
Table 8.6-1: Valid Input Data for Example 2
Condition AF Finding Severity Site Relationship Time Context
group
243796009 1 56265001 24484000 444292000 410512000 410515003
|Situation with explicit |Heart disease| |Severe| |Paternal grandfather of |Current or specified |Known present|
context| subject| time|
Please note that when part of an expression is repeated, connectors (e.g. a comma) must be added between the
parts during processing. Similarly, when part of an expression is absent then clean up is required (e.g. to remove
commas and brackets). For more information on these processing steps, please refer to 7.2. Template Processing.
57