Sushi auto-adds extensions in R5 resources implementing interfaces that overlap with user-specified extensions in profiles
- Dominant language
- TypeScript
- Stars
- 188
- Forks
- 64
- Avg merge
- 8d 11h
- Merged PRs (30d)
- 3
Description
Hi,
First of all thank you for your work on this great software!
I've encountered the following problem in FHIR R5 with resources that implement interfaces such as the MetadataResource (e.g. PlanDefinition) or CanonicalResource (e.g. ActorDefinition): When running sushi on profiles of resources that implement these interfaces, sushi always inserts the following extension in the resulting code:
**Empty profile of PlanDefinition**
```
Profile: PlanDefinitionProfile
Parent: PlanDefinition
Id: plan-definition-profile
Title: "Plan Definition Profile"
Description: "Plan Definition Profile Without Content"
```
**JSON after conversion**
```json
{
"resourceType": "StructureDefinition",
"id": "plan-definition-profile",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-implements",
"valueUri": "http://hl7.org/fhir/StructureDefinition/CanonicalResource"
}
],
```
This is not a problem per se (but also not really required I think, because it's specified in the base resource already), but when specifying an own extension like so:
```
Profile: PlanDefinitionProfileWithExtensions
Parent: PlanDefinition
Id: plan-definition-profile-with-extension
Title: "Plan Definition Profile With Extension"
Description: "Plan Definition Profile With Extension"
* ^extension[+].url = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm"
* ^extension[=].valueInteger = 0
```
this gets converted to:
```json
{
"resourceType": "StructureDefinition",
"id": "plan-definition-profile-with-extension",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
"valueUri": "http://hl7.org/fhir/StructureDefinition/MetadataResource",
"valueInteger": 0
}
],
```
i.e. mixing the two extensions together, resulting in incorrect StructureDefinitions - because the ...-fmm extension should only contain valueInteger field and not the valueUri from the ...-implements extension.
Contributor guide
Research direction
Start by reproducing the FHIR R5 PlanDefinition examples with the SUSHI command-line entry point and compare the generated StructureDefinition extensions. Trace the profile extension generation and assignment involved in the conversion; done means the automatically added implements extension remains separate from a user-specified structuredefinition-fmm extension, with each retaining only its own value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100