FHIR / FHIR/sushi

SUSHI behavior for fixed CodeableConcept may have unexpected results

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

Description

SUSHI applies pattern values before processing rules (I think). As a result, in some cases (like CodeableConcept), it results in unexpected output if an instance rule overwrites a previously applied pattern value.

For example, given this profile and instance:
```
Profile: ConditionProfile
Parent: Condition
* code = http://foo.org|foov0.0.1#bar

Instance: MyCondition
InstanceOf: ConditionProfile
* code.coding[0] = http://notfoo.org#notbar
* code.coding[1] = http://foo.org|foov0.0.1#bar
* subject = Reference(Patient/John)
```
the instance ends up with the following code:
```json
{
"coding": [
{
"code": "notbar",
"system": "http://notfoo.org",
"version": "foov0.0.1"
},
{
"code": "bar",
"system": "http://foo.org",
"version": "foov0.0.1"
}
]
}
```
Note that the `http://notfoo.org#notbar` code ends up with the `foov0.0.1` system from the pattern.

Ideally, SUSHI should be smarter about how it does this so that it recognizes that `coding[0]` is assigned a different value that does not match the pattern -- and as a result, puts the pattern at `coding[1]` instead (ideally recognizing that although `coding[1]` also is also assigned a value, that value matches the pattern).

FSHOnline: https://fshschool.org/FSHOnline/#/share/3rfNkMb

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the ConditionProfile and MyCondition example from the issue, using the linked FSHOnline case if helpful, then trace SUSHI's pattern-value processing and instance-rule application. Done means an explicitly different coding[0] keeps its own system and version, while the matching pattern is placed on coding[1] without unexpected overwrites.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.