Stream: shorthand
Topic: adding extension to Instance
Patrick Werner (Nov 24 2020 at 15:25):
I'm trying to add an extension to Questionnaire.item:
item[0].extension[http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl].valueCoding = http://molit.eu/fhir/CodeSystem/questionnaire-codes-tbd#vas
Patrick Werner (Nov 24 2020 at 15:26):
and getting:
error The element or path you referenced does not exist: item.extension[http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl].valueCoding
File: /Users/patrickwerner/Downloads/fsh-tutorial-master/FishExampleComplete/input/fsh/Questionnaire.fsh
Line: 6
error Cannot read property 'children' of undefined
Patrick Werner (Nov 24 2020 at 15:29):
Can't find the correct syntax for adding the extension content
Jose Costa Teixeira (Nov 24 2020 at 17:36):
Patrick Werner said:
and getting:
error The element or path you referenced does not exist: item.extension[http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl].valueCoding
File: /Users/patrickwerner/Downloads/fsh-tutorial-master/FishExampleComplete/input/fsh/Questionnaire.fsh
Line: 6
error Cannot read property 'children' of undefined
did you define the extension before in the questionnaire? What is this an instanceOf?
and I think extensions can be referred to by id or name, not by url.
Jose Costa Teixeira (Nov 24 2020 at 17:37):
If you haven't defined the extension, this should work:
- item[0].extension[0].valueCoding = http://molit.eu/fhir/CodeSystem/questionnaire-codes-tbd#vas
- item[0].extension[0].url = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"
Elliot Silver (Nov 24 2020 at 18:32):
I was running into a similar problem a week or two ago. You may be running into the fact that using the url for the array index only works in sushi 1+.
Patrick Werner (Nov 24 2020 at 18:37):
i'm using SUSHI v1.0.1
Patrick Werner (Nov 24 2020 at 18:40):
Jose Costa Teixeira [said](https://chat.fhir.org/#narrow/stream/215610-
did you define the extension before in the questionnaire? What is this an instanceOf?
no i didn't as it is a core extension, defined in the FHIR spec.
So the syntax: item[0].extension[http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl].valueCoding = http://molit.eu/fhir/CodeSystem/questionnaire-codes-tbd#vas
is not compliant to the FSH spec?
If yes, i'd like to make the proposal to add this syntax. Would be very neat to be able to add an Extension into an Instance with a single line statement.
Elliot Silver (Nov 24 2020 at 18:40):
Well, that rules that issue out.
Patrick Werner (Nov 24 2020 at 18:42):
Jose Costa Teixeira said:
If you haven't defined the extension, this should work:
- item[0].extension[0].valueCoding = http://molit.eu/fhir/CodeSystem/questionnaire-codes-tbd#vas
- item[0].extension[0].url = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"
works. Thanks @Jose Costa Teixeira
Elliot Silver (Nov 24 2020 at 18:43):
What I did was
Alias: $ext-element-minValue = http://hl7.org/fhir/StructureDefinition/minValue
...
* item[7].item[8].extension[$ext-element-minValue].valueInteger = 0
And this seems to work well.
Patrick Werner (Nov 24 2020 at 18:55):
reading the FSH spec {Extension name|id|url}
should be usable here, so i assume FSH allows it, but SUSHI isn't supporting it (yet)?
Or am i missing a part of the spec which restricts the reference to an Extension to be name-only?
Chris Moesel (Nov 24 2020 at 20:40):
@Patrick Werner -- there are two issues at play here:
questionnaire-itemControl
's value is aCodeableConcept
, so you must usevalueCodeableConcept
, notvalueCoding
- I think you should be able to use the full URL there, but as you noted, it's not working in SUSHI. As @Elliot Silver suggested above, however, it works if you assign the URL to an alias and then reference the alias.
Working example:
Alias: $item-control = http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl
Instance: MyQ
InstanceOf: Questionnaire
* status = #active
* item[0].extension[$item-control].valueCodeableConcept = http://molit.eu/fhir/CodeSystem/questionnaire-codes-tbd#vas
* item[0].linkId = "foo"
* item[0].type = #group
I'll log a bug about the URL not working directly.
Chris Moesel (Nov 24 2020 at 20:46):
Patrick Werner (Nov 24 2020 at 21:09):
thx for the response and for creating the issue, wasn't 100% sure if i understood the FSH grammar correctly @Chris Moesel
i already changed the item to valueCodeableConcept (noticed during validation).
Last updated: Apr 12 2022 at 19:14 UTC