HL7 Austria Reference IG
0.1.0 - ci-build

Slicing

The following applies to elements other than code (in this case we focused on Composition.section.code) as long as they are of type CodeableConcept e.g. Composition.type

tl;dr - IF YOU DO NOT WANT TO READ THE WHOLE PAGE

Do not use exactly in general! exactly leads to considerable restrictions (see below).

If at least 1 Coding with the specified values should occur in the slice:

  • discriminator.path = "code" (=CodeableConcept level)

If exactly 1 Coding with the specified values should occur in the slice and no other Coding:

  • discriminator.path = "code.coding" or discriminator.path = "code.coding.code" (=Coding or Code level)
  • There is no difference between the two if exactly is not used.

Basic rules

Relationship between discriminator.path and slice level

discriminator.path and the level at which the individual slices are specified must match! See the following example.

Correct Wrong
Use of code in discriminator.path and setting the code on section.code. Use of code.coding.code in discriminator.path and setting the code on section.code.
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code = ExampleCompositionSectionsCS#Section1
* section contains Section2 1..
* section[Section2].code = ExampleCompositionSectionsCS#Section2
* section contains Section3 1..
* section[Section3].code = ExampleCompositionSectionsCS#Section3
    
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code.coding.code"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code = ExampleCompositionSectionsCS#Section1
* section contains Section2 1..
* section[Section2].code = ExampleCompositionSectionsCS#Section2
* section contains Section3 1..
* section[Section3].code = ExampleCompositionSectionsCS#Section3
    

Consistent slice level

All slices must use the same slice level! See the following example:

Correct Wrong
Use of code in discriminator.path and setting the code on section.code. Use of code in discriminator.path and setting the code on section.code.coding for Section2
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code = ExampleCompositionSectionsCS#Section1
* section contains Section2 1..
* section[Section2].code = ExampleCompositionSectionsCS#Section2
* section contains Section3 1..
* section[Section3].code = ExampleCompositionSectionsCS#Section3
    
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code = ExampleCompositionSectionsCS#Section1
* section contains Section2 1..
* section[Section2].code.coding = ExampleCompositionSectionsCS#Section2
    

Effects of different discriminator.path settings (WITHOUT exactly)

discriminator.path = "code" (CodeableConcept level) (WITHOUT exactly)

FSH IG
ExampleComposition4
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code"
* section ^slicing.rules = #open
* section contains Section2 1..
* section[Section2].code = ExampleCompositionSectionsCS#Section2
    

discriminator.path = "code.coding" (Coding level) (WITHOUT exactly)

FSH IG
ExampleComposition5
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code.coding"
* section ^slicing.rules = #open
* section contains Section2 1..
* section[Section2].code.coding = ExampleCompositionSectionsCS#Section2
    

discriminator.path = "code.coding.code" (Code level) (WITHOUT exactly)

FSH IG
ExampleComposition6
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code.coding.code"
* section ^slicing.rules = #open
* section contains Section2 1..
* section[Section2].code.coding.system = Canonical(ExampleCompositionSectionsCS)
* section[Section2].code.coding.code = #Section2
    

Effects of different discriminator.path settings (WITH exactly)

discriminator.path = "code" (CodeableConcept level) (WITH exactly)

FSH IG
ExampleComposition4
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code = ExampleCompositionSectionsCS#Section1 (exactly)
    

discriminator.path = "code.coding" (Coding level) (WITH exactly)

FSH IG
ExampleComposition5
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code.coding"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code.coding = ExampleCompositionSectionsCS#Section1 (exactly)
    

discriminator.path = "code.coding.code" (Code level) (WITH exactly)

FSH IG
ExampleComposition6
* section.code from ExampleCompositionSectionsVS
* section ^slicing.discriminator[+].type = #value
* section ^slicing.discriminator[=].path = "code.coding.code"
* section ^slicing.rules = #open
* section contains Section1 1..
* section[Section1].code.coding.system = Canonical(ExampleCompositionSectionsCS)
* section[Section1].code.coding.code = #Section1 (exactly)
    

Required Pattern vs. Fixed Value

Rendering in the IG vs. StructureDefinition

The IG Publisher adapts the rendering to the hierarchy (see Effects of different discriminator.path settings (WITHOUT exactly)). The highest hierarchy level is always decisive for the assessment of a slice. This means that if discriminator.path = "code" is specified, the relevant information as to whether it is a pattern (ElementDefinition pattern[x]) or a fixed value (ElementDefinition fixed[x]) is found at the CodeableConcept level. In the hierarchies below, the IG Publisher still states "Fixed value", even if it may only be a pattern in terms of the StructureDefinition.

Setting fixed values in FSH

Only specifying exactly in FSH results in a fixed value in the StructureDefinition. Everything else results in a pattern in the StructureDefinition.

WITHOUT exactly WITH exactly
CodeableConcept level If a pattern is set at the CodeableConcept level, additional codings are allowed. If a fixed value is set at the CodeableConcept level, no additional codings are allowed. Furthermore, populating elements other than those defined by the slice is forbidden.
Coding level If a pattern is set at the Coding level, in addition to the specified code, displays, extensions, etc. can also be used. If a fixed value is set at the Coding level, only the specified elements with the fixed values may occur underneath, and no other elements, e.g. if system, code and display are fixed, then these must be present and match the specified values, and e.g. a version or extension is not allowed.
Code level Pattern and fixed value mean the same thing for primitive data types (system -> uri, code -> code) - i.e. an exact match is required.

Recommendations

Allowing additional codings

If additional code+system combinations should be allowed, then discriminator.path = "code" (CodeableConcept level) must be used. Whether additional fields are allowed in the coding defined by the slice (display, extension, …) depends on whether exactly is used on code (CodeableConcept level) or not. When using exactly on code (CodeableConcept level), no other elements are allowed.

Only one code + system combination allowed and no other

If no additional code+system combinations should be allowed, then discriminator.path = "code.coding" or discriminator.path = "code.coding.code" must be used. Whether additional fields are allowed in the coding defined by the slice (display, extension, …) depends on whether exactly is used on code.coding or not. When using exactly on code.coding (Coding level), no other elements are allowed.