Stream: shorthand
Topic: Defining nested inline extensions
Jean Duteau (Nov 18 2020 at 19:59):
I thought I had done this before but I can't find any examples in my IGuides. I want to create a complex inline extension where one of the extension slices has extensions:
Extension: ItemRule
Id: extension-itemRule
Description: "Provides a set of rules that provide logic on which questions should be navigated to"
* extension contains ruleType 1..1 MS and rules 1..* MS and skipTo 1..1 MS
* extension[ruleType].value[x] only code
* extension[ruleType].valueCode from ItemRuleType (required)
* extension[skipTo].value[x] only string
* extension[rules] contains operator 1..1 MS and value 1..1 MS and fact 1..1 MS
* extension[rules][operator].value[x] only code
* extension[rules][operator].valueCode from ItemRuleOperatorType (required)
* extension[rules][operator].value[x] only string
* extension[rules][fact].value[x] only string
When I do this, I get an error about not being to create the operator slice:
error Cannot create operator slice. No slicing found for Extension.extension:rules.
File: /Users/jeanduteau/Documents/DDIWork/IBM-BEST/datastandards/questionnaire-fsh/Questionnaire.fsh
Line: 179
Help me Obi-Wan Kenobi, you're my only hope!
Chris Moesel (Nov 18 2020 at 20:58):
This is confusing for sure, but I think that extension[rules] contains...
actually re-slices the rules
slice -- because extension[rules]
is still referring to the rules
extension itself.
I think what you really want is extension[rules].extension contains...
and then refer to the sub-extensions by extension[rules].extension[operator]
, etc.
Chris Moesel (Nov 18 2020 at 21:04):
I just tested this in FSH Online and it worked:
Extension: ItemRule
Id: extension-itemRule
Description: "Provides a set of rules that provide logic on which questions should be navigated to"
* extension contains ruleType 1..1 MS and rules 1..* MS and skipTo 1..1 MS
* extension[ruleType].value[x] only code
* extension[ruleType].valueCode from ItemRuleType (required)
* extension[skipTo].value[x] only string
* extension[rules].extension contains operator 1..1 MS and value 1..1 MS and fact 1..1 MS
* extension[rules].extension[operator].value[x] only code
* extension[rules].extension[operator].valueCode from ItemRuleOperatorType (required)
* extension[rules].extension[fact].value[x] only string
ValueSet: ItemRuleType
ValueSet: ItemRuleOperatorType
Note that in your original FSH you tried to constrain the operator to a code
and a string
, so I removed the 2nd constraint.
Jean Duteau (Nov 18 2020 at 21:31):
thanks. that makes way more sense
Last updated: Apr 12 2022 at 19:14 UTC