Skip to content

Don't allow new slices on a slicing closed by a parent - #1649

Open
drlalithapranathi wants to merge 1 commit into
FHIR:masterfrom
drlalithapranathi:gh-471-closed-slicing
Open

drlalithapranathi wants to merge 1 commit into
FHIR:masterfrom
drlalithapranathi:gh-471-closed-slicing

Conversation

@drlalithapranathi

Copy link
Copy Markdown
Contributor

Description:

Fixes #471. A child profile could use a contains rule to add a new slice to a slicing its parent closed, with no error or warning. The spec only lets a derived profile add new slices "if the slices are not already closed" (https://hl7.org/fhir/R4/profiling.html#reslicing).

Now a contains rule that adds a new slice to a slicing that was already closed before the profile's own rules ran gets an error, and the slice isn't added. It checks the element's captured original, so it only looks at what was inherited.

What stays the same:

  • closing a slicing and adding slices in the same profile
  • reslicing an existing slice, which the spec still allows
  • restating a slice that already exists. That keeps the duplicate warning or error it gets today, since nothing new is being added.

Two open questions are in my comment on the issue: whether to also cover the places SUSHI adds slices implicitly (validateValueAtPath and sliceMatchingValueX), and whether this should be an error or a warning.

Testing Instructions:

npm run check. Seven new tests in the #ContainsRule block of test/export/StructureDefinitionExporter.test.ts. To see it by hand:

Profile: ParentObs
Parent: Observation
* component ^slicing.discriminator.type = #pattern
* component ^slicing.discriminator.path = "code"
* component ^slicing.rules = #closed
* component contains systolic 0..1

Profile: ChildObs
Parent: ParentObs
* component contains pulse 0..1

Regression: no changes detected on these 12 repos, which all use closed slicing: gematik/fhir-profiles-erp, hl7ch/ch-emed, IHE/ITI.MHD, IHE/ITI.PMIR, ahdis/ch-elm, HL7-Poland/pl-fhir-lab, TWNHIFHIR/pas, HL7/fhir-shc-vaccination-ig, openimis/openimis_fhir_r5_ig, HL7/FHIR-us-pq-cmc-fda, medizininformatik-initiative/kerndatensatz-kardiologie, HL7/davinci-epdx.

Related Issue:

Fixes #471

A child profile could use a contains rule to add a slice to a slicing
its parent had closed, and SUSHI said nothing. Now that's an error and
the slice isn't added.

Only new slices count. Closing a slicing and adding slices in the same
profile still works, so does reslicing an existing slice, and restating
a slice that already exists keeps the usual duplicate handling.
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.

SUSHI should not allow authors to add slices to closed slicings

1 participant