In this module you will learn more about Slicing. We will use Forge, the official HL7®FHIR® profile editor, to edit our profiles. You can download Forge for free.

The topics covered in this module are:

  • When to use slicing
  • Defining a discrimator
  • Slicing in Forge

Reading material

Once you have finished the Start Profiling module, you are well versed in how to apply constraints to your profile's elements. These changes are overall constraints that, once made, pertain to an element in its entirety. Slicing allows you to assign specific constraints to each individual slice of an element.

1. When to use slicing

Slicing is useful when constraints need to be made that do not necessarily apply to the whole element. In this case it would be best to slice the element first and then apply constraints to the slices individually. This allows you to define different constraints to each slice of a single element, thereby further customizing your profile.

Suppose you want to be really specific about what types of phone numbers you are sending or receiving for your Patient resources. In some situations, you may want to specify that your Patient resource must have a mobile number and can have a home phone and work phone. To make the mobile number obligatory without also making the home phone and work phone necessary it would be best to first slice the telecom element and then to assign the cardinality and use to each slice individually.

2. Defining a discriminator

A system will need some type of indicator to determine what differentiates the slices. In other words it needs to know which element to choose to be able to tell the elements apart. The discriminator is used to distinguish the sliced elements from one another. The discriminators in their sum should allow systems to easily determine which slice belongs to each section.

When you first slice an element you will need to assign a discriminator. To do this you will need to assign a Path and Type when creating slices. The Path indicates in which element the discriminator can be found. The Type defines how the discriminator should be evaluated. There are five types defined in the FHIR specification:

  • value - The slices have different values in the nominated element
  • exists - The slices are differentiated by the presence or absence of the nominated element
  • pattern - The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x]
  • type - The slices are differentiated by type of the nominated element to a specified profile
  • profile - The slices are differentiated by conformance of the nominated element to a specified profile

Suppose you want to slice the element Patient.identifier and add a slice for both the national identifier and the hospital identifier for a Patient. The discriminator will be the value of the naming system used to register the identifier (e.g. in the Netherlands the BSN number is used as the national identifier, while the hospital will use a local patient number as the hospital identifier). In this case the Type of the discriminator is value and its Path is system.

3. Cardinality of slices and slice entry

When you have defined one or more slices on an element, you can define different cardinalities for each slice and the sliced element. In the example of the previous section, you could say for example that a patient should at least have a BSN number and an optional local patient number. The cardinality of the identifier element would be for example be 0..* or you could restrict it to 0..2 if you don't want to allow more than two identifiers. The cardinality of the slice for BSN number would be 1..1 to make it mandatory and the cardinality of the local patient number would be 0..1 to make it optional.

Another possibility is that you add a couple of optional slices (0..1) and specify that exactly one of them should be defined by restricting the cardinality of the slice entry to 1..1. For example, suppose you want to slice the element MedicationStatement.subject and add the following slices: a slice named SubjectPatient and a slice named SubjectGroup. Both slices are optional, but the slice entry cardinality requires you to specify at least one subject.

<element id="MedicationStatement.subject">
    <path value="MedicationStatement.subject"/>
            <type value="type"/>
            <path value="$this"/>
        <rules value="open"/>
    <min value="1"/>
    <max value="1"/>
<element id="MedicationStatement.subject:SubjectPatient">
    <path value="MedicationStatement.subject"/>
    <sliceName value="SubjectPatient"/>
    <min value="0"/>
    <max value="1"/>
        <code value="Reference"/>
        <targetProfile value=""/>
<element id="MedicationStatement.subject:SubjectGroup">
    <path value="MedicationStatement.subject"/>
    <sliceName value="SubjectGroup"/>
    <min value="0"/>
    <max value="1"/>
        <code value="Reference"/>
        <targetProfile value=""/>

4. Slicing rules

Slicing rules define how slices are interpreted when evaluating an instance of the resource. When slicing an element you can use these rules to define whether or not you want to allow additional content. In the rules element of the sliced element you can choose one of the following options.

Code Definition
closed No additional content is allowed other than that described by the slices in this profile.
open Additional content is allowed anywhere in the list.
openAtEnd Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.

For example, let's say you have sliced Practitioner.identifier. In the Netherlands, we have different ways of identifying practitioners: UZI number, AGB code and BIG code. Let's say you added a slice for UZI number as well as a slice for AGB code. When the slicing is open, you are allowed to add additional identifiers, such as the a BIG code. When the slicing is closed, however, you are not allowed to add a BIG code. When the slicing is open at end, you are allowed to add a BIG code, but only at the end of the list of identifiers.

5. Slicing in Forge

Select the element that you want to slice and click on the scissor icon. The element is now ‘Sliced’ and it is possible to add slices by clicking the scissor icon with a little plus. You can create as many slices as necessary by selecting the sliced element and clicking the ‘Add Slice’ icon again. The added slices can be defined and constrained as any other element.

After adding slices, Forge shows a warning message containing the message that there is no discriminator defined for the sliced elements. The discriminator information can be provided in the ‘Element Properties’ of the sliced element under ‘Slicing Details’. Assign a Path and Type to assign a discriminator. Note that Forge automatically initializes the discriminator for type slices when you slice a "name[x]" element.

By default the Rules element is set to Open. You can change this in the sliced element (the one with the scissor icon next to it) by selecting the desired value from the drop down menu.

Keep in mind that slicing is also used to express extensions definitions and extension elements. The Forge UI tries to hide this complexity from the user, however it is clearly visible in the XML viewer.

Real-life examples

Here below are examples of customers that we helped building profiles.

HL7 Norway

HL7 Norway promotes standardized exchange of clinical and administrative information between various health-related information systems in Norway, using international standards from HL7 (

The example below shows the HL7 Norway profile for a Practitioner. In Norway, practitioners have a HPR number (a health employee number, issued by the National Agency for Healthcare), a F-number (a birth number, issued by the Tax Administration) and a HERID (a unique identifier for a given health unit, which can be either a person, organization or service). To distinguish between these types of identifiers, the identifier element is sliced and for each of type of identifier a slice is added. The discriminator in this case is the value of the system (i.e. type=value, path=system). A practitioner should have exactly one HPR-number and one F-number (cardinality in these slices is 1..1). In addition, a practitioner should have at least one HERID (cardinality in this slice is 1..*).

Command 'tree' could not render: Project was not found for noAuditLog/noAuditPractitioner.


Nictiz is the centre of expertise for standardization and eHealth in The Netherlands. HL7 Netherlands core and MedMij profiles are published on Simplifier. MedMij is a national project that aims to give Dutch citizens integrated access to all their health data in one personal health environment. FHIR is used as a standard to exchange health information between the involved parties. The profiles are based on standardized clinical building blocks called Health and Care Information Models (HCIM).

The example below shows the Dutch profile for the HCIM InstructionsForUse (e.g. dose and route of medication administration), which is based on the core Dosage data type. The element dose[x] is sliced on data type and two slices are added: DoseQuantity (a slice for data type SimpleQuantity) and DoseRange (a slice for data type Range).

timingΣ0..*HCIM AdministrationSchedule

In the discriminator the type element is set to 'type' and the path is set to '$this'. See the XML code below.

        <type value="type" />
        <path value="$this" />
      <rules value="open" />


In this exercise you will continue with the Patient profile that you created in the Start Profiling module. If you did not follow this module, please create a new profile on Patient and complete the required fields in the Properties tab. Start by reading the case description. Here below are a couple of links that you may find useful during this exercise:

    Case description
    Hospital X wants to receive patient data from general practitioners. The hospital has decided to build conform the FHIR standard, starting with administrative data of patients and their general practitioner. The following (additional) requirements are specified:
  • Patients are identified by their BSN number, a specific HIS ID is optional
  • Email address is mandatory
  • Phone number is optional

Steps to follow

  1. Start Forge and open your Patient profile.
  2. Slice the element ‘identifier’.
  3. Add two slices.
  4. Give both slices a logical name.
  5. Choose the right value for ‘system’ to ensure that the BSN number is unique and according to the given system. See the link above.
  6. Ensure that the elements ‘system’ and ‘value’ in 'identification' are mandatory.
  7. Add a discriminator on system for the two slices. Select the right constraints in this element. Note that path already contains the value system.
  8. Now you know how to slice, change the profile to meet the remaining two requirements.


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.