SNOMED Documentation Search


You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

In addition to the simple examples shown on the previous pages, more advanced expression templates can also be used. On this page we show some examples of expression constraints with multiple replacement slots, multiple cardinality constraints and slot co-dependency constraints.

Multiple Replacement Slots

In many situations, it is useful for an expression template to contain more than one replacement slot. Below are some examples.

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| ) @Procedure]]:
        { 
405813007 |Procedure site - direct|  = [[+ (< 91723000 |Anatomical structure| ) @BodySite]],
            
260686004 |Method|  = [[+ (< 129264002 |Action (qualifier value)| ) @Method]] }
If the slots are populated with the values:

then the following expression would be generated.

Example 2 

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 (named "Finding") is a placeholder for the  | Clinical finding|  known to be present in the family member, while the second slot (named "Relationship") is a placeholder for the  | Subject relationship context|  of this | Clinical finding| .

If the following input data is provided (in which each row represents a separate expression):

Then the following family history expressions would be generated.

Multiple Cardinality Constraints

Expression templates may also use more than one cardinality constraint to indicate the repeatability of different parts of the expression. Below are some examples.

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|

    [[1..1]] [[+ (< 71388002 |Procedure| ) @Procedure]] : 
        [[ 1..2 @SMgroup]] { [[1..1]] 
405813007 |Procedure site - direct|  = [[+ (< 91723000 |Anatomical structure| ) @BodySite]], 
                                [[1..1]] 
260686004 |Method|  = [[+ (< 129264002 |Action (qualifier value)| ) @Method]] }
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|  value and exactly one | Method|  value should be used.

The following input data satisfies these cardinality constraints.

If the slots are populated with the values above, then the following expressions would be generated.

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.

    [[1..1]] [[+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|  = [[+id (<  91723000 |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 (<  410514004 |Finding context value| ) @Context]] }
The first cardinality constraint (i.e. 1..1 ) indicates that exactly one value should be populated in the Condition slot. The second cardinality constraint (i.e. 1..2 ) indicates that it is valid to include either 1 or 2 relationship groups (named "AFgroup") in the resulting expression. Each AFgroup relationship group must have exactly one | Associated finding| , exactly one | Subject relationship context| , exactly one | Temporal context|  and exactly one | Finding context| .  The value of the  | Associated finding|  in each AFgroup is an expression, may optionally be refined using a single relationship group named "SSgroup". Each SSgroup optionally has one | Severity|  and optionally has one | Finding site| .

Based on these cardinality constraints, the following input data is valid.

If the slots are populated with the values above, then the following expressions would be generated.

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.


Feedback
  • No labels