FHIR / FHIR/sushi

Add support for R5 #position discriminator in slicing

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

Description

FHIR R5 introduces a `#position` discriminator type with the following description:
> The slices are differentiated by their index. This is only possible if all but the last slice have min=max cardinality, and the (optional) last slice contains other undifferentiated elements.

It further notes that position is
> Used to match slices based on their index. This is only possible if all but the last slice have a fixed cardinality where min > 0 and min = max. The last slice MAY have min != max. Typical example: slice on Practitioner.name to require that the first name be the usual name for the practitioner, and it must be present.

If you try to set a discriminator type to `#position` now, SUSHI issues an error, even in R5 projects:
> ^slicing.discriminator[0].type: Invalid value: #position. Value must be selected from one of the following: #value, #exists, #pattern, #type, #profile

We need to allow for this discriminator. Furthermore, our instance exporter needs to be smart enough to put positional slices in the right order, regardless of the order they are assigned in the instance.

Contributor guide

Open the contributing guide

Research direction

Locate the discriminator validation and the instance exporter, then read how R5 discriminator types are currently checked and how slices are ordered during export. Confirm that #position is accepted for R5 projects and that positional slices are emitted in index order regardless of assignment order.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.