FHIR / FHIR/sushi

Avoid emitting warning when unfolding multiple-profile element when setting implied properties on an Instance

Open
#1,504 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
188
Forks
64
Avg merge
8d 8h
Merged PRs (30d)
5

Description

When a profile has an element, and that element itself has several allowed profiles, a warning is emitted when that element is unfolded. However, this may not necessarily be a useful warning to emit. Consider this example FSH, taken from the Zulip conversation linked at the end of this issue:
```
Alias: $au-core-patient = http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient
Alias: $au-ihi = http://hl7.org.au/fhir/StructureDefinition/au-ihi
Profile: XYZPatient
Parent: $au-core-patient
Id: xyz-patient
Title: "XYZ Patient"
Description: "XYZ Patient Profile"
* ^abstract = false
* ^status = #draft
* ^date = "2024-08-24T10:00:00+10:00"
* id MS
* identifier[ihi] only $au-ihi

Instance: XYZPatientPatientDonaldDuck
InstanceOf: XYZPatient
Title: "XYZPatient Patient"
Description: "Example of a patient used for placing a diagnostic requests"

* identifier[ihi].type.coding[+] = $v2-0203#NI
* identifier[ihi].type.coding[=].system = "http://terminology.hl7.org/CodeSystem/v2-0203"
* identifier[ihi].type.coding[=].code = #NI
* identifier[ihi].type.text = "IHI Number"
* identifier[ihi].system = "http://ns.electronichealth.net.au/id/hi/ihi/1.0"
* identifier[ihi].value = "8003608833357361"
```

The `identifier` element has several profiles on it based on the definition of the `au-core-patient` profile. The `identifier` element is also required: it has a minimum of 1, so when creating the `XYZPatientPatientDonaldDuck` Instance, it is checked for fixed values. This element is unfolded to check for child elements that have fixed values. When unfolding it, the warning is emitted. However, there's nothing the author can do here to avoid getting that warning. So, when unfolding it to check for fixed values, it might be best to not emit the warning at all.

There are variations on this scenario which are also important to consider. For example, if `identifier` has a minimum of 0, it would still be checked for fixed values (and unfolded) in this example, because there are rules on the Instance that create an `identifier`. If the rule is on `identifier[ihi]` or some other defined slice, should the warning be avoided? If the rule is on `identifier` and does not refer to a defined slice, should the warning be avoided?

See also original Zulip conversation: https://chat.fhir.org/#narrow/stream/215610-shorthand/topic/Base.20element.20type.20will.20be.20used.20instead.20of.20any.20profiles

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the FSH example in the issue and trace the Instance unfolding path that checks required elements for fixed values. Determine how warnings are emitted for elements with multiple allowed profiles, including sliced and unsliced rules. Done means the unavoidable warning is suppressed in the fixed-value checking case while other relevant warnings remain covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.