To avoid any confusion and misinterpretation Before a template can be processed, it is important that the input data is represented in a clear and unambiguous way that ease the interpretation of the input data and ensure correct processing of the expression template. Poorly represented input data may result in expressions that express a different meaning than intended, which can be critical if the resulting expressions are used for safety critical purposes (storage, communication, trigger decision support rules etc.)
Templates with Repeatability of Groups and Attributes
. This is required to ensure that the template is processed in the expected manner, and the intended results are produced. In this section, we explain some of the considerations in representing and preparing the input data for processing.
Input Data Representation
Template input data may be represented in a variety of forms, ranging from flat tabular structures to nested serializations. Irrespective of the format, however, it is important that there is no ambiguity as to how each piece of input data should be used to create the resulting expressions. This can be particularly challenging where repetition of relationship groups or attribute name-value pairs is required.
The UML diagram below illustrates the logical structure of expression template input data. Each set of Expression Template Input Data includes the data intended to be used to create one or more expressions. The data used to populate a single expression is referred to in this model as Expression Data. Each Expression Data (i.e. the data for a single expression), may include at most one Definition Status Slot (with a slot name and a definitionStatus value), zero or more Focus Concept Slots (each with a slotName and zero or more values), zero or more Relationship Group Slots (each with a group name), and zero or more ungrouped Attribute Name-Value Pair Slots (each with a name). Each Relationship Group Slot has zero or more Relationship Group Data instances in the input data. Each of these Relationship Group Data instances has input data for one to many Attribute Name-Value Pair Slots. And for each Attribute Name-Value Pair Slot within a Relationship Group Data instance, there are zero to many Attribute Name-Value Pair Data instances, each with at most one Attribute Name Slot (with name and value), and at most one Attribute Value Slot (with name and either a simple data value, or an Expression Data instance of its own).
Image Added
Input Data Examples
In this section, we provide some examples of unambiguous expression template input data, and discuss how this input data can be used to populate each expression.
Example 1
The expression template below is used to create expressions that represent a
Concept |
---|
ShowParts | term |
---|
t | 363698007 |Disease| |
---|
|
with one or more Concept |
---|
ShowParts | term |
---|
t | 363698007 |Finding site| |
---|
|
and Concept |
---|
ShowParts | term |
---|
t | 116676008 |Associated morphology| |
---|
|
.When using expression templates, such as this one, in which attribute name-value pairs and relationship groups may In situations where the template allow for attribute-value pairs or relationships groups to be repeated, the input data should be explicit about about which attribute name-value pairs should be grouped together and which groups should be included in a single expression.
Scg expression |
---|
|
[[@Expression +tok ("===", "<<<") @DefStatus)]] [[+scg (<< 64572001 |Disease (disorder)||) @Disease]] :
[[@Group]] { 363698007 |Finding site (attribute)| = [[+ (<< 272673000 |Bone structure (body structure)| ) @Site]],
116676008 |Associated morphology (attribute)| = [[+ (<< 72704001 |Fracture (morphologic abnormality)| ) @Morphology]] } |
To populate this template, the input data should be explicit about which data values are used to populate each slot, and how these values are grouped into relationship groups. The table below shows an abstract representation of some input data that may be used to process the expression template above. The relationship to the logical model above has bee noted in brackets under each column name. Please note that the first column is used to group together the data intended to populate each expression, and subsequent columns are named after the associated slot. Relationship group slots are used to group the data that is intended to populate this could be represented explicit like this: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.
Expression Data | DefStatus (Definition Status Slot) | Disease (Focus Concept Slot) | Group (Relationship Group Slot) | Site (Attribute Value Slot) | Morphology (Attribute Value Slot) |
---|
1 | === |
Scg expression |
---|
46866001 |Fracture of lower limb| |
| 1 |
Scg expression |
---|
12611008 |Bone structure of tibia| |
|
Scg expression |
---|
72704001 |Fracture| |
|
2
| <<< |
Scg expression |
---|
92196005 |Benign neoplasm of lung| |
| 1 |
Scg expression |
---|
39607008 |Lung structure| |
|
Scg expression |
---|
3898006 |Neoplasm, benign| |
|
Scg expression |
---|
92038006 |Benign neoplasm of bronchus| |
| 2 |
Scg expression |
---|
955009 |Bronchial structure| |
|
Scg expression |
---|
3898006 |Neoplasm, benign| |
|
3 | <<< |
Scg expression |
---|
60667009 |Closed fracture of rib| |
| 1 |
Scg expression |
---|
113197003 |Bone structure of rib| |
|
Scg expression |
---|
34305007 |Fracture, multiple, closed| |
|
Scg expression |
---|
36991002 |Closed fracture of upper limb| |
|
Scg expression |
---|
371195002 |Bone structure of upper limb| |
|
4 | === |
Scg expression |
---|
16119006 |Abscess of jaw| |
| 1 |
Scg expression |
---|
70925003 |Bone structure of maxilla| |
|
Scg expression |
---|
44132006 |Abscess| |
|
Scg expression |
---|
109327001 |Abscess of facial bone| |
|
Scg expression |
---|
128234004 |Disorder of maxilla| |
|
Using the above input data to populate the given expression template will result in following four expressions.
@Expression | @Group | @Site | @Morphology |
1 | 1 | Concept |
---|
t | 312763008 |Bone structure of trunk| |
---|
|
| 2 | Concept |
---|
t | 84667006 |Bone structure of cervical vertebra| |
---|
|
| |
2 | 1 | Concept |
---|
t | 62413002 |Bone structure of radius| |
---|
|
| |
Concept |
---|
t | 23416004 |Bone structure of ulna| |
---|
|
| |
3 | 1 | Concept |
---|
t | 71341001 |Bone structure of femur| |
---|
|
| |
4 | 1 | Concept |
---|
t | 12611008 | Bone structure of tibia| |
---|
|
| |
The above input data would result in following four expressions to be generated when processing the template:
Expression |
---|
1 |
Scg expression |
---|
64572001 === 46866001 |Disease|Fracture :of {lower
limb|:
{ 363698007 |Finding site| = 31276300812611008 |Bone structure of trunktibia|,
116676008 |Associated morphology |= 72704001 |Fracture| } |
|
2 |
Scg expression |
---|
<<< 92196005 |Benign neoplasm of lung| + 92038006 |Benign neoplasm of bronchus|:
,
{ 363698007 |Finding site| = 8466700639607008 |BoneLung structure of cervical vertebra|,
116676008 |Associated morphology| = 727040013898006 |FractureNeoplasm, benign| } |
| 2 | Scg expression |
---|
64572001 |Disease| : {
,
{ 363698007 |Finding site| = (62413002955009 |BoneBronchial structure of radius| + 23416004 |Bone structure of ulna|),
116676008 |Associated morphology| = 727040013898006 |FractureNeoplasm, benign| } |
|
3 |
Scg expression |
---|
64572001 |Disease| : {
<<< 60667009 |Closed fracture of rib| +
36991002 |Closed fracture of upper limb| :
{ 363698007 |Finding site| = 113197003 |Bone structure of rib|,
363698007 |Finding site| = 71341001371195002 |Bone structure of upper femurlimb|,
116676008 |Associated morphology| = 7270400134305007 |Fracture, multiple, closed| } |
|
4 | | 64572001 |Disease| : {
=== 16119006 |Abscess of jaw| +
109327001 |Abscess of facial bone| +
128234004 |Disorder of maxilla|:
{ 363698007 |Finding site| |
| | 12611008 | | tibiamaxilla|,
116676008 |Associated morphology| |
| | 72704001 | Fracture | |
Templates with Cardinality ConstraintsSpecifying the expression and group when representing input data is particularly important when the template includes cardinality constraints, to be able to determine the repeatability of groups and attributes. Expression templates which specifies a [1..1] cardinality of slots or expression parts can omit the group column, as shown in the following example.
Cardinality Constraints on Groups
...
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.
...
...
+id (<< 413350009 |Finding with explicit context| ) @Condition]]:
[[ 1..2 @AFgroup ]] { [[1.. |
...
1]] 246090004 |Associated finding| = ([[+id (<< 404684003 |Clinical finding| ) @Finding]]:
[[0..1 @SSgroup]] { [[0..1 |
...
]] 246112005 |Severity| = [[+id (< 272141005 |Severities| ) @Severity]],
[[0..1]] 363698007 |Finding site| = |
...
...
...
...
Anatomical structure| ) @Site]] }),
[[1..1]] 408732007 |Subject relationship context| = [[+id (< 444148008 |
...
|Person in family of subject| ) @Relationship]],
[[1..1]] 408731000 |Temporal context| = [[+id (< 410510008 |Temporal context value| ) @Time]],
[[1..1]] 408729009 |Finding context| = [[+id ( |
...
...
...
...
In this situation, processing the template against the input data would result in a processing error, because the first expression would not be valid. the expression template allow for only one @Group within each expression, whereas the input data specify an expression with more that one @Group.
To populate the above template, the following example input data has been defined. Once again, the relationship to the logical model above has been noted in brackets under each column name.
The relationship to the logical model above has bee noted in brackets under each column name. Please note that the first column is used to group together the data intended to populate each expression, and subsequent columns are named after the associated slot. 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.
Expression Data | Condition (Focus Concept Slot) | AFgroup (Relationship Group Slot) | Finding (Attribute Value Slot / Focus Concept Slot) | SSgroup (Attribute Value Slot / Relationship Group Slot) | Severity (Attribute Value Slot / Attribute Value Slot) | Site (Attribute Value Slot / Attribute Value Slot) | Relationship (Attribute Value Slot) | Time (Attribute Value Slot) | Context (Attribute Value Slot) |
---|
1 |
Scg expression |
---|
266898002 |Family history: Respiratory disease| |
| 1 |
Scg expression |
---|
195967001 |Asthma| |
| 1 |
Scg expression |
---|
24484000 |Severe| |
|
|
Scg expression |
---|
444301002 |Mother of subject| |
|
Scg expression |
---|
410589000|All times past| |
|
Scg expression |
---|
410515003 |Known present| |
|
2 |
Scg expression |
---|
161077003 |Father smokes| |
| 1 |
Scg expression |
---|
77176002 |Smoker| |
| 1 |
Scg expression |
---|
255604002 | Mild| |
|
|
Scg expression |
---|
444295003 |Father of subject| |
|
Scg expression |
---|
15240007 |Current| |
|
Scg expression |
---|
410515003 |Known present| |
|
Scg expression |
---|
161078008 |Mother smokes| |
| 2 |
Scg expression |
---|
77176002 |Smoker| |
| 1 |
Scg expression |
---|
24484000 |Severe| |
|
|
Scg expression |
---|
444301002 |Mother of subject| |
|
Scg expression |
---|
15240007 |Current| |
|
Scg expression |
---|
410515003 |Known present| |
|
3
|
Scg expression |
---|
160288009 |Family history: neoplasm of skin| |
| 1 |
Scg expression |
---|
372130007 |Malignant neoplasm of skin| |
| 1 |
Scg expression |
---|
6736007 |Moderate| |
|
Scg expression |
---|
113179006 |Skin structure of nose| |
|
Scg expression |
---|
444304005 |Sister of subject| |
|
Scg expression |
---|
410511007 |Current or past (actual)| |
|
Scg expression |
---|
410515003 |Known present| |
|
Scg expression |
---|
275937001 |Family history of cancer (situation)| |
| 2 |
Scg expression |
---|
255604002 |Mild| |
|
Scg expression |
---|
88089004 |Skin structure of lip| |
|
Expression |
---|
1 |
Scg expression |
---|
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 |
Scg expression |
---|
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 |
Scg expression |
---|
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| } |
|
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.
Scg expression |
---|
Border | ridge |
---|
ShowFormat | block |
---|
|
[[+id (<< 71388002 |Procedure|) @Procedure]]:
|
@Expression | @Group | @Site | @Morphology | Processing Result |
1 | 1 | Concept |
---|
t | 312763008 |Bone structure of trunk| |
---|
|
| INVALID Only one group is allowed due to cardinality constraints | 2 | Concept |
---|
t | 84667006 |Bone structure of cervical vertebra| |
---|
|
| |
2 | 1 | Concept |
---|
t | 62413002 |Bone structure of radius| |
---|
|
| | VALID |
| Concept |
---|
t | 23416004 |Bone structure of ulna | |
---|
|
| |
3 | 1 | Concept |
---|
t | 71341001 |Bone structure of femur| |
---|
|
| | VALID |
4 | 1 | Concept |
---|
t | 12611008 | Bone structure of tibia| |
---|
|
| | VALID |
So in this case, there would be no need to include the second column in the input data to differentiate between different groups in the same expression. Hence, the input data could be simplified as:
@Expression | @Site | @Morphology |
2 | Concept |
---|
t | 62413002 |Bone structure of radius| |
---|
|
| |
Concept |
---|
t | 23416004 |Bone structure of ulna | |
---|
|
| |
3 | Concept |
---|
t | 71341001 |Bone structure of femur| |
---|
|
| |
4 | Concept |
---|
t | 12611008 | Bone structure of tibia| |
---|
|
| |
Consider the following template, where the template includes a cardinality constraint on each attribute like this:
Scg expression |
---|
|
[[@Expression ]] 64572001 |Disease| : [[1..*]]
[[1..1 @Group]]
{ [[1..1] 363698007 |Finding site| * @PD_ANVpair]] [[+id (< 405815000 |Procedure device|) @DeviceType]] = [[+ (<< 272673000<260787004 |BonePhysical structureobject| ) @Site@Device]],
[[1..1]] 116676008260686004 |Associated morphologyMethod| = [[+ (<< 72704001 |Fracture| ) @Morphology<129264002 |Action (qualifier value)|) @Method]] } |
In this case, the second expression would not be valid … so there would be no need to include the expression column, as each row would signify a separate expression. That is, we could just define the data as:
...
@Site
...
@Morphology
...
...
Concept |
---|
t | 62413002 |Bone structure of radius| |
---|
|
...
...
INVALID
Only one @Site is allowed due to cardinality constraints
...
Concept |
---|
t | 23416004 |Bone structure of ulna | |
---|
|
...
...
Concept |
---|
t | 71341001 |Bone structure of femur| |
---|
|
...
...
Concept |
---|
t | 12611008 | Bone structure of tibia| |
---|
|
...
...
Similarly, if only precoordinated concepts were allowed in the slots, like this:
...
...
The following input data has been created to populate the above template. Because, in the above template, the first attribute name-value pair is repeatable and 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.
Expression Data | Procedure (Focus Concept Slot) | Group (Relationship Group Slot) | PD_ANVpair (Attribute NV Pair) | DeviceType (Attribute Name Slot) | Device (Attribute Value Slot) | Method (Attribute Value Slot) |
---|
1 |
Scg expression |
---|
387713003 |Surgical procedure| |
| 1 | 1 |
Scg expression |
---|
363699004 |Direct device| |
|
Scg expression |
---|
2282003 |Breast prosthesis, device| |
|
Scg expression |
---|
257867005 |Insertion - action| |
|
2
|
Scg expression |
---|
71388002 |Procedure| |
| 1
| 1 |
Scg expression |
---|
363699004 |Direct device| |
|
Scg expression |
---|
313025003 |Hearing aid battery| |
|
Scg expression |
---|
282089006 |Replacement - action| |
|
2 |
Scg expression |
---|
363710007 |Indirect device| |
|
Scg expression |
---|
6012004 |Hearing aid, device| |
|
Using the above input data to populate the given expression template will result in the following two expressions.
Expression |
---|
1 |
Scg expression |
---|
387713003 |Surgical procedure|:
{ 363699004 |Direct device| = 2282003 |Breast prosthesis, device|,
260686004 |Method| = 257867005 |Insertion - action|} |
|
2 |
Scg expression |
---|
384728007 |Replacement of device|:
{ 363699004 |Direct device| = 313025003 |Hearing aid battery|,
363710007 |Indirect device| = 6012004 |Hearing aid, device|,
260686004 |Method| = 282089006 |Replacement - action|} |
|
The expression template below represents a
Concept |
---|
ShowParts | term |
---|
t | 64572001 |Disease| |
---|
|
with one or more values for Concept |
---|
ShowParts | term |
---|
t | 363698007 |Finding site| |
---|
|
and Concept |
---|
ShowParts | term |
---|
t | 116676008 |Associated morphology| |
---|
|
, grouped into one or more relationship groups. Scg expression |
---|
Border | ridge |
---|
ShowFormat | block |
---|
|
64572001 |Disease|:
[[@Group]] { 363698007 |Finding site| = [[+ |
...
(<< 272673000 |Bone structure| |
...
...
116676008 |Associated morphology| = [[+ |
...
...
then only the following data value would be valid:
In this example, we will show an alternative format for representing the input data. A wide variety of formats are possible for representing template input data, including json, xml, tsv, csv etc. The exact format used will depend on the format required by the template processor.
Below is an example of some input data for the above template that uses the same abstract representation as above. This time we have not shown the explicit relationship to the logical model - however this can be inferred from the column names.
Expression Data | Group | Site | Morphology |
1 | 1 | Concept |
---|
t | 312763008 |Bone structure of trunk| |
---|
|
| |
2 | Concept |
---|
t | 84667006 |Bone structure of cervical vertebra| |
---|
|
| |
2 | 1 |
...
@Site
...
| Concept |
---|
t | 71341001 |Bone structure of femur| |
---|
|
| |
...
|
3 | 1 | Concept |
---|
t | 12611008 | Bone structure of tibia| |
---|
|
| |
As an example of an alternative data input format, this example input data is represented below in JSON.
Panel |
---|
title | Example JSON Input Data |
---|
|
{"Expression Data": [ { "Group": [ { "Site":"312763008 | |
...
Bone structure of trunk|", "Morphology":"72704001 |Fracture|" }, { "Site": "84667006 |Bone structure of cervical vertebra|", "Morphology": "72704001 |Fracture|" } ] }, { "Group": [ { "Site":"71341001 |Bone structure of femur|", "Morphology": "72704001 |Fracture|" } ] }, { "Group":[ { "Site":"12611008 | Bone structure of tibia|", "Morphology": "72704001 |Fracture|" } ] } ] } |
While it is important that there is no ambiguity as to how each piece of data should be used to create the resulting expressions, there are often opportunities to make the input data much simpler than is represented in the full logical model above. In particular:
- When the maximum cardinality of a relationship group is 1, there is no need to include the relationship group slot in the input data to group the attributes it contains;
- When the maximum cardinality of an attribute name-value pair is 1, there is no need to include the attribute name-value pair slot in the input data to group the corresponding name and value pairs;
- When there is either an attribute name slot with a fixed attribute value, or a fixed attribute name with an attribute value slot, there is no need to include the attribute name-value pair slot in the input data to group the corresponding name and value pairs.
- When the maximum cardinality of the focus concept slot is 1, the
- whenever the maximum cardinality of the focus concept, the relationship groups and attribute
With this in mind, the examples in 8 Expression Template Examples simplify the input data, where appropriate, using these assumptions and an implicit association with the logical model described above.
Summary
In summary, it is recommended to be as explicit as possible when specifying input data for expression templates. However, in situations the input data can be simplified, and then following default can be assumed by the input data:
- if the expression column is omitted then it is assumed that each row should be processed into separate expressions (i.e. no repeating of rows into the same expression)
- if the grouping is omitted, then it can be assumed that each column should be processed into separate expression parts (i.e. no grouping of rows into the same expression)