Skip to content

Fix processing of slices on choice elements#1629

Open
cmoesel wants to merge 2 commits into
masterfrom
valuex-slice-paths
Open

Fix processing of slices on choice elements#1629
cmoesel wants to merge 2 commits into
masterfrom
valuex-slice-paths

Conversation

@cmoesel

@cmoesel cmoesel commented Jun 24, 2026

Copy link
Copy Markdown
Member

Description: When manually creating slices on choice elements (e.g., Observation.value[x]), SUSHI runs into a few issues:

  1. If you constrain a slice by type (using only) and then constrain another by type (also using only), in some cases SUSHI emits an error like this: Type constraint on Observation.value[x] makes rules in ObservationWithValueAttachment obsolete for choices: valueString.
  2. If you attempt to traverse into a sub-element of a slice, in some cases SUSHI emits an error like this: No element found at path value[x][valueAttachment].extension for ContainsRule in ObservationWithValueAttachment, skipping rule. (NOTE: error depends on type of rule applied to the path).

These issues were discovered and discussed on Zulip: #shorthand > Slicing and extending with a xver extension @ 💬.

This PR resolves both issues by improving handling for the special case of slices on choice elements.

Testing Instructions: The unit tests show the issue, but you may also test manually using this XVerObsValueAttachment.zip project based on the Zulip thread use case. First run the release version of SUSHI to confirm the errors are being logged. Then run this PR branch (using ts-node) to confirm the errors go away and the resulting StructureDefinition looks correct.

Related Issue: See https://chat.fhir.org/#narrow/channel/215610-shorthand/topic/Slicing.20and.20extending.20with.20a.20xver.20extension/near/604137635.

@cmoesel cmoesel requested a review from jduteau June 24, 2026 13:01
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.

1 participant