# Typed Replacement Slots

## Overview

Replacement slots may be given a *replacement type* to indicate what type of value may be used to replace the slot. The *replacement type* directly follows the '+' symbol inside the slot (with optional whitespace between). Permitted *replacement types* include:

* **id** : The slot may be replaced by a single SNOMED CT concept reference.
* **scg** : The slot may be replaced by a SNOMED CT compositional grammar expression (either a precoordinated or postcoordinated expression).
* **tok** : The slot may be replaced by a token (or symbol) that is defined in the base syntax.
* **str** : The slot may be replaced by a quoted string of characters. This is used to represent a concrete attribute value that is typed as a string.
* **int** : The slot may be replaced by a integer (preceded by a '#' symbol). This is used to represent a concrete attribute value that is typed as an integer.
* **dec** : The slot may be replaced by a decimal (preceded by a '#' symbol). This is used to represent a concrete attribute value that is typed as a decimal.
* **bool** : The slot may be replaced by a boolean. This is used to represent a concrete attribute value that is typed as a boolean.

Please note, that if no *replacement type* is specified after the '+' symbol, then a *replacement type* of '**scg** ' is assumed.

## Concept Replacement Slots

Slots with a replacement type of '**id** ' may only be replaced by a single concept reference. For example, the replacement slot in the following expression template

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="1" content="404684003 |Clinical finding| : 255234002 |After| = \[\[+id]]" %}

may be replaced by the concept [82271004 | Injury of head|](http://snomed.info/id/82271004) to form the expression

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="1" content="404684003 |Clinical finding| : 255234002 |After| = 82271004 |Injury of head|" %}

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.

## Expression Replacement Slots

Slots with a replacement type of '**scg** ' may be replaced by any (precoordinated or postcoordinated) expression. For example, the slot in the following expression template

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="1" content="404684003 |Clinical finding| : 255234002 |After| = \[\[+scg]]" %}

may be replaced by any of the following values

[82271004 |Injury of head|](http://snomed.info/id/82271004)\
[417163006 |Injury|](http://snomed.info/id/417163006) : [363698007 |Finding site|](http://snomed.info/id/363698007) = [69536005 |Head structure|](http://snomed.info/id/69536005)\
[417163006 |Injury|](http://snomed.info/id/417163006) + [118934005 |Disorder of head|](http://snomed.info/id/118934005)

to generate the following expressions.

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="1" content="404684003 |Clinical finding| : 255234002 |After| = 82271004 |Injury of head|" processed="true" %}

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="3" content="404684003 |Clinical finding| :
255234002 |After| = ( 417163006 |Injury| : 363698007 |Finding site| = 69536005 |Head structure| )" %}

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="3" content="404684003 |Clinical finding| :
255234002 |After| = ( 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.

## Token Replacement Slots

Slots with a replacement type of '**tok** ' may be replaced by any token (or symbol) that is defined in the base language. For example, the following expression has a definition status that has not yet been defined.

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="2" content="\[\[+tok]] 73211009 |Diabetes mellitus| :
363698007 |Finding site| = 113331007 |Endocrine system|" %}

If the definitionStatus [| '<<<'|](http://snomed.org/fictid) is used to complete the slot then the resulting expression would be:

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="2" content="<<< 73211009 |Diabetes mellitus| :
363698007 |Finding site| = 113331007 |Endocrine system|" %}

## Concrete Value Replacement Slots

Slots with a replacement type of '**str** ', '**int** ', '**dec** ' or '**bool** ' may be replaced by any string, integer, decimal or boolean value respectively. For example, the slot in the expression template below:\
(see footnote 1)

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="1" content="322236009 |Paracetamol 500mg tablet| : 774167006 |Product name| = \[\[+str]]" %}

may be replaced by the string PANADOL to form the following expression

{% @snomed-syntax-highlighter/snomed-syntax-highlighter 0="" 1="" 2="" 3="" lines="1" content="322236009 |Paracetamol 500mg tablet| : 774167006 |Product name| = " %}

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:

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="5" content="417720003 |Zinc 25 mg oral capsule| : { 749999999108 |Has pack size magnitude| = \[\[+int]], 774163005 |Has pack size unit| = 428641000 |Capsule| }" processed="true" %}

may be replaced by the integer value 30 to form the expression

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="5" content="417720003 |Zinc 25 mg oral capsule| : { 1142142004 |Has pack size| = #30, 774163005 |Has pack size unit| = 428641000 |Capsule| }" processed="true" %}

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:

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="5" content="426016003 |Diazepam 5 mg/mL oral solution| : { 1142142004 |Has pack size| = \[\[+dec]], 774163005 |Has pack size unit| = 258770004 |Liter| }" processed="true" %}

may be replaced by the decimal value 1.5 to form the expression

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="5" content="426016003 |Diazepam 5 mg/mL oral solution| : { 1142142004 |Has pack size| = #1.5, 774163005 |Has pack size unit| = 258770004 |Liter| }" processed="true" %}

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:

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="2" content="318969005 |Irbesartan 150 mg oral tablet| :
859999999102 |Is in national benefit scheme| = \[\[+bool]]" %}

may be replaced by the boolean value TRUE to form the expression[2](https://confluence.ihtsdotools.org/display/DOCSTS/8.2.+Typed+Replacement+Slots#Footnote2)

{% @snomed-syntax-highlighter/snomed-syntax-highlighter lines="2" content="318969005 |Irbesartan 150 mg oral tablet| :
859999999102 |Is in national benefit scheme| = TRUE" processed="true" %}

| Footnotes Ref | Notes                                                                                                                                                                                                                                                                                                                       |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 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. |
| 2             | Please note that the concept 859999999102 \|Is in national benefit scheme\| is a fictitious attribute used here to illustrate boolean values.                                                                                                                                                                               |

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=SNOMED+Template+Syntax+Specification&#x26;entry.670899847=Typed%20Replacement%20Slots" class="button primary">Provide Feedback</a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snomed.org/snomed-ct-specifications/snomed-ct-template-syntax-specification/8-expression-template-examples/8.2-typed-replacement-slots.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
