Skip to content

Slicing

chrisgrenz edited this page May 7, 2016 · 4 revisions

Named Slices

Fixed Slices

The most straightforward way to create a named slice - fix the value of the discriminator element using fixed[x].

<!-- Declare the slicing -->
<element>
	<path value="Patient.identifier" />
	<slicing>
		<discriminator value="system" />
		<rules value="open" />
	</slicing>
</element>
<!-- Fix the value of the discriminator to define the slice -->
<element>
	<path value="Patient.identifier.system" />
	<name value="mdm.system" />
	<fixedUri value="http://example.com/fhir/localsystems/PATIENT-ID-MDM" />
</element>

Slice by Extension

??HOW??

Recommend that slicing.discriminator become an element id.

Slice by Profile

Slice by profile uses a type profile as the discriminator for each slice. This implies:

  • The type profiles listed are mutually exclusive since each instance must map to exactly one slice.
  • Nothing in the type profile will be evaluated as "not valid" in resource validation - it will simply make the instance not part of the slice (selection vs. validation).

Patient Profile:

<!-- Declare the slicing -->
<element>
	<path value="Patient.identifier" />
	<slicing>
		<discriminator value="@profile" />
		<rules value="open" />
	</slicing>
</element>
<!-- Define a slice -->
<element>
	<path value="Patient.identifier" />
	<name value="mdmId" />
	<label value="Master Patient Id" />
	<type>
		<code value="Identifier" />
		<profile value="http://example.com/fhir/SD/patient-mdm-id" />
	</type>
</element>

This slice then refers to the profile http://example.com/fhir/SD/patient-mdm-id in which I can use the entire variety of constraints to specialize the slice.

Or, just fix a value there:

Identifier Profile:

<element>
	<path value="Element.system" />
	<min value="1" />
	<fixedUri value="http://example.com/fhir/localsystems/PATIENT-ID-MDM" />
</element>

Anonymous Slices

An anonymous slice is simply the declaration of a slicing (with discriminator) but without the declaration of any slices (or an incomplete set of slices). Anything with slicing.rules <> "closed" may have anonymous slices (as compared to the viewpoint where a instance is just not part of a slice).

Use Cases:

  • Profile governed merging of resources
  • Describing a resource for translation to another format (what is the "primary key" of the repeating element)

Clone this wiki locally