Stream: shorthand
Topic: Getting canonical from defined resource
Max Körlinge (Mar 24 2021 at 14:48):
Hi again =)
I am trying to set the Questionnaire.item.answerValueSet
to a valueset I've defined in my fish tank, lets call it MyValueSet
. The answerValueSet
expects a canonical
value. How do I set it to MyValueSet
?
I've tried
* item[0].answerValueSet = MyValueSet
* item[0].answerValueSet = my-value-set-id
* item[0].answerValueSet = #MyValueSet
* item[0].answerValueSet = $MyValueSet
As you can see, I'm just guessing at this point. I tried searching for it in the shorthand specification but couldn't find it. The top alternative (which seems to me the most logical one) yields error Cannot find definition for Instance: MyValueSet. Skipping rule.
Max Körlinge (Mar 24 2021 at 15:06):
I have the same issue with QuestionnaireResponse when creating an instance.
Instance: QuestionnaireResponseExample
InstanceOf: MyQuestionnaireResponse
* questionnaire = InlineQuestionnaire
Instance: InlineQuestionnaire
InstanceOf: MyQuestionnaire
Usage: #inline
* title = "Example"
* description = "Example"
* purpose = "Example"
* status = #active
where questionnaire
is supposed to be a canonical
. This fails in sushi compile because: Cannot assign Questionnaire value: InlineQuestionnaire. Value does not match element type: canonical
ryan moehrke (Mar 24 2021 at 15:16):
have you defined MyValueSet in the same FSH tank? also this structure exists in FSH i haven't used it so I can't comment on if/how it works here https://build.fhir.org/ig/HL7/fhir-shorthand/reference.html#reference-and-canonical-data-types
Chris Moesel (Mar 24 2021 at 15:37):
I think you're looking for the Canonical(...)
feature. In your first example, you should be able to do:
* item[0].answerValueSet = Canonical(MyValueSet)
The Canonical
keyword will extract the canonical URL from the resource name/id you feed it (as long as it can find the definition for that resource).
Chris Moesel (Mar 24 2021 at 15:39):
Ah. And I see that's actually what @ryan moehrke linked to above. Thanks, Ryan! I was about to look for that reference.
Max Körlinge (Mar 24 2021 at 18:04):
Spot on, thanks guys! Not sure how I missed it
Last updated: Apr 12 2022 at 19:14 UTC