FHIR Chat · adding extension to Instance · shorthand

Stream: shorthand

Topic: adding extension to Instance


view this post on Zulip 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

view this post on Zulip 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

view this post on Zulip Patrick Werner (Nov 24 2020 at 15:29):

Can't find the correct syntax for adding the extension content

view this post on Zulip 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.

view this post on Zulip Jose Costa Teixeira (Nov 24 2020 at 17:37):

If you haven't defined the extension, this should work:

view this post on Zulip 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+.

view this post on Zulip Patrick Werner (Nov 24 2020 at 18:37):

i'm using SUSHI v1.0.1

view this post on Zulip 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#vasis 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.

view this post on Zulip Elliot Silver (Nov 24 2020 at 18:40):

Well, that rules that issue out.

view this post on Zulip Patrick Werner (Nov 24 2020 at 18:42):

Jose Costa Teixeira said:

If you haven't defined the extension, this should work:

works. Thanks @Jose Costa Teixeira

view this post on Zulip 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.

view this post on Zulip 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?

view this post on Zulip Chris Moesel (Nov 24 2020 at 20:40):

@Patrick Werner -- there are two issues at play here:

  1. questionnaire-itemControl's value is a CodeableConcept, so you must use valueCodeableConcept, not valueCoding
  2. 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.

view this post on Zulip Chris Moesel (Nov 24 2020 at 20:46):

SUSHI #674

view this post on Zulip 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