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

Support Allowed R5 resources in R4 IGs #1350

Closed cmoesel closed 1 year ago

cmoesel commented 1 year ago

Allow authors to create instances of R5 ActorDefinition, Requirements, SubscriptionTopic, and TestPlan in R4 IGs (and R5 ActorDefinition, Requirements, and TestPlan in R4B IGs). Also allow these R5 resources to be referred to via references and canonicals (e.g., from an obligation extension). This was discussed in this Zulip thread and the specific allowed R5 resources are listed in this Java class.

This capability is primarily supported by adding these special resources to FHIRDefinitions when it is initialized -- so they are always fishable. We also add a _timeTraveler flag to these resources so we can appropriately reject them where they're not allowed (namely as parents of profiles/logicals). Versions of FHIR that have these resources already simply overwrite the ones we added (and thus, do not have the _timeTraveler flag).

This PR also introduces a new FHIRVersionsUtility that can be used for determining information about FHIR versions based on their version number. Some existing code dealing with FHIR versions was refactored to leverage this new approach.

You can manually test this by creating an R4 or R4B IG and creating instances of one of the special R5 classes. You can also try using the obligation extension to reference one of these R5 classes (likely ActorDefinition).

NOTE: My initial implementation supported this capability by automatically loading all of R5 as a "supplemental FHIR package" -- and then extending the MasterFisher to support fishing by supplemental versions. This approach, however, was more complicated and more costly (in terms of memory). I believe my final implementation is better, but I've left the 1st implementation as a separate commit if you'd like to review it.