FHIR Chat · Constraining canonical references to a profile · shorthand

Stream: shorthand

Topic: Constraining canonical references to a profile


view this post on Zulip Keith Boone (Sep 04 2020 at 17:30):

What is the syntax to tell Sushi that the resource at the specified canonical URL will conform to a profile? Specifically, I'm looking to say that there must be at least one Measure.library that conforms to a specifc profile of Library.

view this post on Zulip Keith Boone (Sep 04 2020 at 17:31):

Ideally, I want to say all libraries referenced by a measure will conform to such-and -such profile..

view this post on Zulip Nick Freiter (Sep 04 2020 at 18:31):

I can't figure out how to do this using the only syntax. It feels like you should be able to, but maybe that is something that is missing from FSH. You should be able to specify that a canonical will conform to a profile using the caret syntax:

Profile: MyMeasure
Parent: Measure
* library ^type[0].targetProfile = Canonical(NamedLibrary)
// * library ^type[0].targetProfile = "http://example.org/StructureDefinition/NamedLibrary"

Profile: NamedLibrary
Parent: Library
* name 1..1

where the first line shows how you would accomplish that if you are referencing a locally defined Library, and the commented out line shows how you could do this if just wanted to hard-code the URL.

view this post on Zulip Keith Boone (Sep 04 2020 at 19:16):

This worked for me, thanks!
Yes, ideally, we'd be able to say * library only Canonical(NamedLibrary) and it would work the way we'd expect. I think that works with Reference, and it should work with Canonical().

view this post on Zulip Keith Boone (Sep 05 2020 at 00:03):

I spoke too soon. Sushi liked it, but Publisher complained:
java.lang.Exception: Error generating snapshot for C:\Users\kboone\git\fhir-saner\input\profiles\StructureDefinition-PublicHealthMeasure(PublicHealthMeasure): Unable to generate snapshot for http://hl7.org/fhir/us/saner/StructureDefinition/PublicHealthMeasure in C:\Users\kboone\git\fhir-saner\input\profiles\StructureDefinition-PublicHealthMeasure
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshots(Publisher.java:4360)
at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:3699)
at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:854)
at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:715)
at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:7946)
Caused by: org.hl7.fhir.exceptions.FHIRException: Unable to generate snapshot for http://hl7.org/fhir/us/saner/StructureDefinition/PublicHealthMeasure in C:\Users\kboone\git\fhir-saner\input\profiles\StructureDefinition-PublicHealthMeasure
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshot(Publisher.java:4413)
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshots(Publisher.java:4358)
... 4 more
Caused by: org.hl7.fhir.exceptions.DefinitionException: Type mismatch processing profile http://hl7.org/fhir/us/saner/StructureDefinition/PublicHealthMeasureLibrary at path Measure.library: The element type is canonical, but the profile http://hl7.org/fhir/us/saner/StructureDefinition/PublicHealthMeasureLibrary is for a different type Library
at org.hl7.fhir.r5.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:929)
at org.hl7.fhir.r5.conformance.ProfileUtilities.generateSnapshot(ProfileUtilities.java:539)
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshot(Publisher.java:4411)
... 5 more

I think I'll have to wait for @Grahame Grieve or @Josh Mandel or @Lloyd McKenzie to explain this one to me.

view this post on Zulip Grahame Grieve (Sep 05 2020 at 00:48):

looks like you meant to specify a targetProfile but you specified a profile instead


Last updated: Apr 12 2022 at 19:14 UTC