Advanced slicing


In this module you will learn more about slicing. This module assumes you have basic knowledge on slicing. If you prefer to start with the basics, please go through the Slicing module first.

The topics covered in this module are:

  • Change existing slices
  • Re-slicing
  • Nested slicing

Reading material

1. Change existing slices

Profiling is often explained by constraining core FHIR resources. For example, you can create a Patient profile by constraining the Patient resource. But it is also possible to use an existing profile as your base profile and make additional constraints to it. The resulting profile is called a derived profile. When an element is already sliced in a base profile, it is possible to change the slicing in a derived profile.

The following changes can be made to existing slices:

  • Extending the discriminator
  • Changing slicing rules
  • Adding new slices
  • Creating new slices inside existing slices (re-slicing)

When profiling you can only add constraints, you can never remove them. The same applies to changing the slicing in a derived profiling. You may further constrain the slicing, but you cannot release constraints.

In a derived profile, the discriminator should have the same content as in the base profile. This means that additional paths can be added, but existing paths cannot be removed. You can either use the same discriminator as in the base profile or add a new one, as long as you conform to this rule.

Open slicing rules can be changed to closed and unordered to ordered, but not vice versa.

Adding new slices is only allowed when the slices are not closed.

2. Re-slicing

In a derived profile, you can re-slice an element that is already sliced in the base profile. For each new slice, you have to define a unique slice name. Note that it is also possible to re-slice within the original profile, but it is often meaningless to do so.

2.1 Process of re-slicing

To explain how the process of re-slicing works, suppose we have created a profile on Patient called FirelyPatient. In this profile, we have sliced the element Identifier. We have a slice called NationalSecurityNumber and a slice called HospitalPatientNumber.

Now suppose we wish to create a derived profile on FirelyPatient, let’s call it MyFirelyPatient. We can choose to do the following:

  1. Constrain the Identifier element. This constraint will have no name and will apply to both slices of Identifier defined in FirelyPatient (i.e. NationalSecurityNumber and HospitalPatientNumber).
  2. Constrain one of the slices of Identifier. In this case the name of the slice needs to be specified and the constraint will only apply to that specific slice.
  3. Add a new slice on Identifier with its own constraint(s). In this case a unique name for the slice needs to be defined and the constraint(s) will only apply to the new slice.
  4. Add a new slice on an existing slice. For example, we could add a slice on HospitalPatientNumber called EpicPatientNumber. In this case both the name of the original slice as well as a unique name for the slice need to be defined. The original name and the name of the new slice are separated by “/”. In this example we would get HospitalPatientNumber/EpicPatientNumber. Any constraints we add at this level will only apply to the new slice.
  5. Do a combination of the above.

2.2 Re-slicing in Forge

Note that although re-slicing is supported by the FHIR .NET API (snapshot generator), Forge does not support this (yet). The slice command is currently disabled for existing slices. So the UI does not let you define re-slicing. Forge should be able to open existing profiles with re-slices. So in theory, you could add re-slicing constraints by manually editing the XML and reload it in Forge. However, this has not been tested and is unsupported. The reason that this feature is not implemented yet, is because it is quite easy to shoot yourself in the foot and break the profile (i.e. cannot reload). So it needs additional validation to protect users against possible corruption.

3. Nested slicing

People often confuse re-slicing with nested slicing. The difference between them is that nested slices are not related to their parent element, while re-sliced elements are. In other words, a re-sliced element will have the same path as their parent element, while a nested slice will have a different one.

For example, suppose we want to add a slice to the system element of the NationalSecurityNumber slice of our FirelyPatient profile. The slice on the system element is called a nested slice as the system element is a child element of the NationalSecurityNumber slice. The new slice on system is however not related to the NationalSecurityNumber slice and they both have a different path.

Path SliceName
Slice 1 Identifier HospitalPatientNumber
Re-slice Identifier HospitalPatientNumber/EpicPatientNumber
Slice 2 Identifier NationalSecurityNumber
Nested slice Identifier.System BSN

Real-life examples

Basisprofil DE

The Basisprofil DE project contains the national German profiles created by HL7 Germany. The project also contains a couple of derived profiles that change the slicing of their base profile. Below are some examples.

Example 1 - Constraining slices

The profile shown below is a derived profile based on the German base Patient profile. The derived profile is meant for use in the context of German insurance core data management (VSDM, eGK-Datensatz). The slice VersichertenID_GKV (on Identifier) already exists in the base profile. In the derived profile, its minimum cardinality is set to 1.


useΣ ?!0..1codeBinding
systemΣ1..1uriFixed Value
periodΣ I0..1Period
assignerΣ I0..1Reference(Organization)
activeΣ ?!0..1boolean
useΣ ?!0..1codeBinding
namenszusatzS I0..1Extension
url1..1uriFixed Value
url1..1uriFixed Value
givenS Σ1..*string
url1..1uriFixed Value
periodΣ I0..1Period
systemΣ I0..1codeBinding
useΣ ?!0..1codeBinding
periodΣ I0..1Period
url1..1uriFixed Value
systemS Σ1..1uri
codeS Σ1..1code
birthDateS Σ1..1date
useΣ ?!0..1codeBinding
typeΣ I0..1codeBinding
url1..1uriFixed Value
url1..1uriFixed Value
url1..1uriFixed Value
url1..1uriFixed Value
cityS Σ1..1string
postalCodeS Σ1..1string
countryS Σ1..1stringBinding
startΣ I0..1dateTime
endΣ I0..1dateTime
nameI0..*HumanName, deutsches Basisprofil (Version 0.2)
addressI0..*Adresse, deutsches Basisprofil (Version 0.2)
generalPractitionerI0..*Reference(Organisation, deutsches Basisprofil (Version 0.2) | Practitioner, deutsches Basisprofil (Version 0.2))
managingOrganizationΣ I0..1Reference(Organisation, deutsches Basisprofil (Version 0.2))
otherΣ I1..1Reference(Patient | RelatedPerson)


Example 2 - Adding slices

Finally, in the patient-de-geronto profile (a Patient profile derived from the German patient-de-vsdm profile) additional slices are added on Identifier (e.g. geronto-pid and geronto-teleid).




Core specification

Nested slicing

The core specification contains a couple of profiles on Observation to capture different measurements, such as blood pressure. The core profile for blood pressure ( contains nested slices. First, the component element is sliced to obtain two separate slices for Systolic Blood Pressure and Systolic Blood Pressure. Next, the coding element is sliced to obtain a specific slice with a fixed system and code.



In this exercise you will continue with the Patient profile you created in earlier modules. In the first 3 steps we will use Forge to edit the profile. Download Forge if you have not done this earlier. Start by reading the case description.

    Case description
    Hospital X has some additional requirements to the Patient profile.
  • The use of the social security number (BNS) should be fixed to official
  • The use of the hospital information system number (HIS) should be set to secondary
  • The contact details can be either: email address, phone and fax, which should all be captured in different slices
  • A work phone number is mandatory and an additional personal number is optional
  • Besides work and personal numbers no additional phone numbers are allowed

Steps to follow

1. Create Patient profile

Skip this step if you have your Patient profile (including slices) already in place. You will if you have completed the exercises of the Slicing module.

  1. Open Forge and create a new profile on Patient (or use your Patient profile from other exercises).
  2. Slice the Identifier element and add slices for national security number (BSN) and hospital information system number (HIS).
  3. Slice the telecom element and add slices for phone and email.

2. Extend discriminator

  1. Create a new derived profile in Forge on you Patient profile.
  2. Extend the discriminator for the Identifier slice.
  3. Note that you cannot change the discriminator path, but you can add one.
  4. In the social security number (BSN) slice set the use to official.
  5. In the hospital information system number (HIS) slice set the use to secondary.

3. Add additional slice

  1. In the telecom element add a new slice for fax.
  2. Change the slice name to Fax.
  3. Set the (fixed) value of the system element to fax.

4. Re-slicing

  1. Re-slice the Phone slice. Note that you will have to directly edit the XML (or JSON) to do so as re-slicing is not (yet) supported in Forge.
  2. Add a discriminator on use.
  3. Add a slice for work phone number.
  4. Add a slice for personal phone number.
  5. Change the minimum cardinality of the work phone number to 1 to make it mandatory.

5. Changing the slicing rules

  1. Besides personal and work no additional phone numbers are allowed. Set the slicing rules to closed.
  2. At which level can you change the slicing rules?
  3. Would you also be allowed to set the slicing rules at the parent level (that is in the telecom element) to closed?



We are always looking for ways to improve our products. The Profiling Academy was built using our own IG-editor in Simplifier. If you have any feedback on this module or on our Profiling Academy in general, please leave a comment in the Issue Tracker of the project.

Get in touch

Start profiling

Most modules end with an exercise. Use Forge to start profiling yourself. Just contact us at if you need any help.

Learn more

Follow one of our predefined or tailor-made courses. We will make sure you know FHIR inside-out.

Need help or advice?

Let us assist you with your FHIR use case. Visit our company website to know more about our services or get into contact with Rien Wertheim right away.