Stream: shorthand
Topic: Failed canonical lookup
Elliot Silver (Jan 31 2021 at 07:25):
I have a profile of QuestionnaireResponse that I can't get to recognize the canonical of the associated Questionnaire:
Instance: WhoCrQuestionnaireCovid19Surveillance
InstanceOf: Questionnaire
Description: "TODO"
Title: "Revised case report form for Confirmed Novel Coronavirus COVID-19"
Usage: #definition
* insert PublisherContextInstance
* name = "WhoCrQuestionnaireCovid19Surveillance"
* version = "2020.2"
* subjectType = #Patient
* url = "http://openhie.github.io/covid-19/Questionnaire/WhoCrQuestionnaireCovid19Surveillance"
Profile: WhoCrQuestionnaireResponseCovid19Surveillance
Parent: QuestionnaireResponse
Description: "Who Case Reporting QuestionnaireResponse"
Title: "Who Case Reporting QuestionnaireResponse"
* questionnaire = Canonical(WhoCrQuestionnaireCovid19Surveillance)
* status from WhoCrValueSetQuestionnaireResponseAcceptedStatus
* subject only Reference(WhoCrPatient)
I get the error:
error Cannot use canonical URL of WhoCrQuestionnaireCovid19Surveillance because it does not exist. Be sure that WhoCrQuestionnaireCovid19Surveillance exists and it has a URL.
File: /Users/elliot/src/covid-ig/input/fsh/who-cr-Provenance.fsh
Line: 45
It all works fine if I change the third-last line to be:
* questionnaire = "http://openhie.github.io/covid-19/Questionnaire/WhoCrQuestionnaireCovid19Surveillance"
What am I missing?
Elliot Silver (Jan 31 2021 at 07:56):
Hmm, the Questionnaire is an Instance. @Chris Moesel, do the URLs of instances get added to the sushi canonical lookup table, or is it only things that you have special keywords for (ValueSet, Profile, etc.)? Is it only things that have canonical URLs automatically generated that can be used with Canonical()?
Elliot Silver (Jan 31 2021 at 08:05):
As an aside, I also noticed that I can't use the ValueSet: keyword to create a profiled ValueSet instance, e.g., an SDC ValueSet (http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-valueset). I can create a ValueSet instance, and set its meta.profile value; but I can't create a ValueSet instance with a parent other than ValueSet, unless I want to create the entire instance from scratch using the Instance: keyword.
Chris Moesel (Feb 01 2021 at 13:41):
Elliot Silver said:
Do the URLs of instances get added to the sushi canonical lookup table, or is it only things that you have special keywords for (ValueSet, Profile, etc.)?
I think your hunch is probably right; SUSHI probably only looks up items generated by the keywords. But I think that can and probably should be improved. Instances don't always have a canonical URL (e.g., and instance of a Patient), but SUSHI should support canonicals for the specific instances that do. Thanks for using Questionnaire
as an example, because I was thinking we only had to do this for Conformance and Terminology resources, but it looks like there are a few other outliers there too.
I've file this as SUSHI#743.
Chris Moesel (Feb 01 2021 at 13:57):
Elliot Silver said:
As an aside, I also noticed that I can't use the ValueSet: keyword to create a profiled ValueSet instance, e.g., an SDC ValueSet (http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-valueset). I can create a ValueSet instance, and set its meta.profile value; but I can't create a ValueSet instance with a parent other than ValueSet, unless I want to create the entire instance from scratch using the Instance: keyword.
When you say "can't create a ValueSet instance with a parent other than ValueSet", do you really mean that you can't create a ValueSet that conforms to a specific profile of ValueSet? Because there is no field in VS to declare a "parent" or "base" (or anything like that). Assuming that's what you mean, then the closest thing you can do is what you've already done: set the meta.profile
via a ^
rule.
If SUSHI allowed you to specify a ConformsTo:
field (or re-use InstanceOf:
but in the context of ValueSet:
), what else would you want SUSHI to do in that case (besides set the meta.profile
for you)? Are are you looking for a more flexible syntax to allow you access to the defined extensions in the profile? Or are you hoping for additional validation? Or something else?
Elliot Silver (Feb 01 2021 at 15:57):
Yes, can't create a ValueSet that conforms to a specific profile. Adding ConformsTo: would be really nice, assuming you could apply it to anything -- VS, profiles, instances -- this would deal with some of the "multiple inheritance" issues I've run into.
I was thinking about this for two reasons: to have the additional validation to know what I am creating is compliant, and avoid having to "drop down" to caret syntax. (It was actually prompted by the fact that I have some ValueSets declared as instances in order to be able to contain them, and other ValueSets declared as standalone, and noticing the difference in how I had to declare them.)
I recall someone recently was trying to profile a StructureDefinition -- not say that a particular profiled resource met another profile, but to say that the profile StructureDefinition itself met a profile. I wonder if there is a way to solve that problem elegantly with this?
Chris Moesel (Feb 01 2021 at 16:08):
TBH, validation is not a strong suit of SUSHI. We validate simple things (like cardinality checks), but punt on validation of more complex things (especially terminology-based validation). We punt on difficult validation because: (a) we don't want external dependencies like terminology servers, (b) we don't think the ROI justifies it when we know the next step in the tool chain (IG Publisher) will do full validation and find any issues that SUSHI did not validate. The only advantage SUSHI validation gives is quicker feedback since it is more lightweight than the publisher (but perhaps that advantage would be lost as we supported more complex validation capabilities because SUSHI would become less and less lightweight). So, all that to say, if we supported ConformsTo:
then you might get cardinality validation, but that's about it. Is it worth it?
As for being able to avoid ^
rules, we're hoping to extend the value set and code system grammars some more for FSH STU2 to address at least some of the common needs for dropping into ^
rules in value sets and code systems. So hopefully that will help.
I think the idea of ConformsTo:
to support building profiled instances of SDs, VSs, CSs, is interesting, but I think we'd want to understand how common a problem it is before embarking on it. I suspect that right now, anyway, there are probably more commonly occurring issues and limitations we'd want to address first.
Elliot Silver (Feb 01 2021 at 16:11):
Sushi validation is one thing, but putting the information in there so that the IG publisher can validate is another. I don't need the sushi validation if the IG can do it.
Elliot Silver (Feb 01 2021 at 16:12):
But I'd also agree, this isn't a priority.
Chris Moesel (Feb 01 2021 at 16:34):
Sushi validation is one thing, but putting the information in there so that the IG publisher can validate is another.
Right. I think you can accomplish this today via ^ meta.profile = "http://canonical/for/profile/to/conform/to"
, but if you find otherwise, let us know!
Elliot Silver (Feb 06 2021 at 01:08):
@Jose Costa Teixeira
Last updated: Apr 12 2022 at 19:14 UTC