Stream: shorthand
Topic: Setting extension on StructureDefinition
Bryn Rhodes (May 06 2020 at 23:45):
We're trying to set the value of an extension on the underlying StructureDefinition for a profile we're defining by using the "escape syntax" (^
):
Profile: NewOnsetOfT2DMDataElementCPG3
Parent: Observation
* ^extension[inferenceExpression].valueExpression.language = #text/cql
* ^extension[inferenceExpression].valueExpression.expression =
"exists([Condition in \"T2DMConditionVS\"] c where c.onset is within last 2 months)"
* code = ExampleCdsCS#t2dm
Which builds fine, but it seems to be treating the .valueExpression.language
part as constraints, rather than instance assignments...
"extension": [
{
"_sliceName": "inferenceExpression",
"valueExpression": {
"language": {
"fixedValue": "text/cql",
"_primitive": true
},
"expression": {
"fixedValue": "exists([Condition in \"T2DMConditionVS\"] c where c.onset is within last 2 months)",
"_primitive": true
}
}
}
],
Am I missing something about how to set the value of an extension on the underlying StructureDefinition?
Jean Duteau (May 07 2020 at 00:04):
Hmm, this looks broken. I had a couple of ideas that turned out either not to work or were just invalid.
Chris Moesel (May 07 2020 at 04:59):
I agree that SUSHI seems confused here. I'd only expect this to work if SUSHI could resolve inferenceExpression
to an extension's canonical URL. Still, I tried it out and even if it does resolve to a valid URL, it's not working right. This sort of thing works with Instance:
, but I guess is not working with ^
in a profile (even though that is really just operating on the instance of the SD). We'll have to look into it.
That said, there is another syntax that works. If you just reference the extension by a numbered index and set its values directly, it is happy. For example:
Profile: NewOnsetOfT2DMDataElementCPG3
Parent: Observation
* ^extension[0].url = "http://example.org/url/for/inferenceExpression"
* ^extension[0].valueExpression.language = #text/cql
* ^extension[0].valueExpression.expression =
"exists([Condition in \"T2DMConditionVS\"] c where c.onset is within last 2 months)"
* code = ExampleCdsCS#t2dm
I don't think you'll get any validation that way though (at least not in SUSHI).
Brian Kaney (May 07 2020 at 12:26):
@Chris Moesel should we log this as a GH issue?
Chris Moesel (May 07 2020 at 12:29):
Yes, please -- go ahead! It was a little too late and I was a little too tired to log it last night!
Bryn Rhodes (May 08 2020 at 15:47):
Another issue we're seeing with setting values of extensions, not sure if it's related to this or not, but given this example:
Instance: ExampleQuestionnaireResponse
InstanceOf: SDCQuestionnaireResponse
* status = #completed
* questionnaire = "Questionnaire/GeneratedQuestionnaire"
* questionnaire.extension[questionnaireDisplay].valueString = "Generated Questionnaire"
* subject = Reference("Patient/123")
* authored = "2020-01-01"
* item[0].linkId = "1"
* item[0].answer.valueBoolean = true
We're getting this error from SUSHI:
error Element QuestionnaireResponse.questionnaire.extension:questionnaireDisplay has minimum cardinality 1 but occurs 0 time(s).
Which also looks suspiciously like this issue: https://github.com/FHIR/sushi/issues/393
Chris Moesel (May 08 2020 at 16:05):
Agreed, that looks like it may be the same issue... What is the urgency on this and the previous issue you guys reported? We're pretty busy heading up to Connectathon, so didn't have these bug-fixes planned yet, but if this is an urgent matter that would be good to know so we can try to accommodate as best we can.
Bryn Rhodes (May 08 2020 at 17:45):
Not urgent, since SUSHI does actually generate the JSON we want, it just gives this error as part of the build.
Alex Goel (Jan 14 2021 at 19:59):
Bryn Rhodes said:
Another issue we're seeing with setting values of extensions, not sure if it's related to this or not, but given this example:
Instance: ExampleQuestionnaireResponse InstanceOf: SDCQuestionnaireResponse * status = #completed * questionnaire = "Questionnaire/GeneratedQuestionnaire" * questionnaire.extension[questionnaireDisplay].valueString = "Generated Questionnaire" * subject = Reference("Patient/123") * authored = "2020-01-01" * item[0].linkId = "1" * item[0].answer.valueBoolean = true
Fred Marsh
We're getting this error from SUSHI:error Element QuestionnaireResponse.questionnaire.extension:questionnaireDisplay has minimum cardinality 1 but occurs 0 time(s).
Which also looks suspiciously like this issue: https://github.com/FHIR/sushi/issues/393
Having a similar issue to this one. eCCDiagnosticReport.fsh
Instance: eCCDiagnosticReport
InstanceOf: http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note
Title: "eCC Diagnostic Report"
Description: "Example eCC Diagnostic report using US Core"
Usage: #example
LNC = http://loinc.org
* id = "eCCDiagnosticReport0"
* identifier.use = #usual
* identifier.type = http://terminology.hl7.org/CodeSystem/v2-0203#MR "Medical Record Number"
* identifier.system = "http://hospital.example.org"
* identifier.value = "eCCDiagnosticReport0"
* status = #final
* category = LNC#LP7839-6 "Pathology"
* code = LNC#60568-3 "Pathology Synoptic report"
* subject = Reference(q201)
* effective.effectiveDateTime = "2021-01-14T10:00:00"
* performer = Reference(pathpract1)
* result = Reference(Adrenal.Bx.Res.129_3.002.011.RC1_sdcFDF1.FormInstanceVersionURI.2157)
* result = Reference(Adrenal.Bx.Res.129_3.002.011.RC1_sdcFDF.f96d3fea-62b3-47e9-8443-f199c2f946f0.ver1.49275.100004300)
* result = Reference(Adrenal.Bx.Res.129_3.002.011.RC1_sdcFDF1.FormInstanceVersionURI.43324)
* result = Reference(Adrenal.Bx.Res.129_3.002.011.RC1_sdcFDF1.FormInstanceVersionURI.56271)
All of the required elements in our instance example are giving the same error:
error Element DiagnosticReport.status has minimum cardinality 1 but occurs 0 time(s).
Has this been addressed? @Chris Moesel
Chris Moesel (Jan 14 2021 at 20:14):
Hi @Alex Goel. The issue you're seeing is due to an errant line in the wrong location: LNC = http://loinc.org
. Aliases are their own standalone definitions in FSH, so you can't have them embedded in another FSH definition. Try removing that line and adding this to the top of your file:
Alias: LNC = http://loinc.org
I also noticed that in the file you attached, it said * ^status
rather than * status
. It looks like you've fixed it in this message, but just to confirm -- in an Instance
you do not use the ^
symbol.
Alex Goel (Jan 14 2021 at 20:41):
Whoops Thank you :)
Alex Goel (Jan 14 2021 at 20:46):
And yes, I fixed the ^ in the message, forgot to remove from file
Last updated: Apr 12 2022 at 19:14 UTC