FHIR / sushi

SUSHI (aka "SUSHI Unshortens Short Hand Inputs") is a reference implementation command-line interpreter/compiler for FHIR Shorthand (FSH).
Apache License 2.0
145 stars 44 forks source link

Use current extension for specifying IG resource format #1421

Closed jafeltra closed 8 months ago

jafeltra commented 8 months ago

According to Zulip here, the extension URL we had been using to configure logical model examples has been deprecated. The new extension for the implementationguide-resource-format extension is http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-format.

This PR updates SUSHI to automatically add the correct extension when creating the resource entry of an Instance of a Logical for the IG JSON. It also adds a warning when a provided configuration uses the deprecated extension URL to help users update to the current URL.

I ran a full regression and no one seems to actually be using this old URL because I didn't see any new warnings logged.

Note that there is already a PR on FSH School to update the extension we document there.

jafeltra commented 8 months ago

In reviewing this, I discovered a bug in our general implementation of this for bring-your-own-JSON logical instances. In short, it only works if the resourceType in the JSON is the id of the logical model -- but if the resourceType is the canonical URL of the logical model, it doesn't work and ends up creating two entries for the instance in the IG JSON (and also doesn't flag the deprecated URL). I think that using the canonical URL is actually the right thing, so it's unfortunate we don't handle it correctly. (Note that when we export FSH Instances of logical models, we use the canonical URL).

I had noticed this recently too, so since you ran into it as well, I think it is worth fixing sooner rather than later. I think I handled it correctly, and it wasn't a huge change, so I included it in c0e6ead. I think it fixes all the cases in the example you provided, but let me know if I missed anything.