Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support logical model examples without resourceType or id #1418

Merged
merged 6 commits into from
Jan 25, 2024

Conversation

jafeltra
Copy link
Collaborator

@jafeltra jafeltra commented Jan 24, 2024

Fixes #1406

This PR supports including logical model examples that do not have a resourceType and/or an id. If the correct extension is added to the resource in the sushi-config.yaml file, then SUSHI will detect that and not log any warnings. This was based off the suggested approach from Zulip here. I confirmed that this approach works with the IG Publisher, and it will properly process the resource.

One thing to note is that we document including logical models here and indicate that the extension http://hl7.org/fhir/StructureDefinition/implementationguide-resource-format should be used. However, that Zulip thread indicated the extension http://hl7.org/fhir/tools/StructureDefinition/implementationguide-resource-format should be used. I tested this with the publisher, and both extension URLs work the same within the publisher, so I think it is valid for SUSHI to support both as well. If we hear back that one URL is preferred over the other, we can make sure that the Tips and Tricks page in FSH School reflects the best practice.

I also updated the error that was logged when a resourceType or id was missing to be a warning. If an example without an id or resourceType is included but configured correctly with the extension, this will not be logged. If the resource isn't configured correctly, the IG Publisher will crash, so we could keep it as an error, so I'm open to feedback here. My reasoning was that it seemed like the error should say something about configuring the resource type to resolve the error since it could be valid that resourceType or id was missing. Instead of including IGPublisher specific configuration in a SUSHI error message, I chose to just soften it to a warning. But again, I'm open to switching it back.

There's an example in the tests that shows this feature, but I've included a sample project here: LogicalExamplesWithoutResourceTypeId.zip

There is also a FSH School PR here that updates the Tips and Tricks to include how to configure an example without a resourceType and id.

@jafeltra jafeltra force-pushed the allow-logical-exmaples-without-id branch from e5867e5 to 4dc35e6 Compare January 24, 2024 14:10
Copy link
Member

@cmoesel cmoesel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a case can be made for having that error be an error or warning (and in fact, you made both cases). I think perhaps warning is fine for our needs -- and also is more flexible if other use cases turn up in the future that allow for resources without id or resourceType.

I've made one suggestion for optimizing/simplifying some of the new code. Feel free to push back if you think it is unnecessary.

Copy link
Member

@cmoesel cmoesel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and works well. I tested it using the provide project (thanks!) and confirmed that SUSHI build the IG JSON correctly and then the IG Publisher successfully processes it as well. I also confirmed that a warning is logged if there is no corresponding resource entry in the sushi-config.yaml. Thanks, Julia!

Copy link
Collaborator

@mint-thompson mint-thompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation and tests all look good. Thank you!

@jafeltra jafeltra merged commit d1d3ced into master Jan 25, 2024
14 checks passed
@jafeltra jafeltra deleted the allow-logical-exmaples-without-id branch January 25, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SUSHI chokes on JSON logical model instances that don't have resourceType/id
3 participants