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:
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.
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.
Example
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.
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 with a FHIRPath expression. Only a subset of FHIRPath can be used here to keep processing the path simple. The FHIRPath subset consists of: regular element selection, e.g. 'identifier.use
', and the following three functions: .resolve()
, .extension("url")
and .ofType(type)
. See the full details about the subset of FHIRPath in the FHIR specification.
The Type
defines how the discriminator should be evaluated.
There are five types defined in the FHIR specification:
Example
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.
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"/> <slicing> <discriminator> <type value="type"/> <path value="resolve()"/> </discriminator> <rules value="open"/> </slicing> <min value="1"/> <max value="1"/> </element> <element id="MedicationStatement.subject:SubjectPatient"> <path value="MedicationStatement.subject"/> <sliceName value="SubjectPatient"/> <min value="0"/> <max value="1"/> <type> <code value="Reference"/> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient"/> </type> </element> <element id="MedicationStatement.subject:SubjectGroup"> <path value="MedicationStatement.subject"/> <sliceName value="SubjectGroup"/> <min value="0"/> <max value="1"/> <type> <code value="Reference"/> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Group"/> </type> </element>
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.
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.
Here below are examples of customers that we helped building profiles.
HL7 Norway promotes standardized exchange of clinical and administrative information between various health-related information systems in Norway, using international standards from HL7 (www.hl7.org).
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..*).
Name | Flags | Card. | Type | Description & Constraints![]() |
---|---|---|---|---|
![]() ![]() | 0..* | Practitioner | A person with a formal responsibility in the provisioning of healthcare or related services | |
![]() ![]() ![]() | Σ | 0..1 | id | Logical id of this artifact |
![]() ![]() ![]() | Σ | 0..1 | Meta | Metadata about the resource |
![]() ![]() ![]() | ?! Σ | 0..1 | uri | A set of rules under which this content was created |
![]() ![]() ![]() | 0..1 | code | Language of the resource content Binding: http://tools.ietf.org/html/bcp47 (required) | |
![]() ![]() ![]() | I | 0..1 | Narrative | Text summary of the resource, for human interpretation |
![]() ![]() ![]() | 0..* | Resource | Contained, inline Resources | |
![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() | ?! | 0..* | Extension | Extensions that cannot be ignored |
![]() ![]() ![]() | Σ | Identifier | A identifier for the person as this agent Slice: Unordered, Open At End, by system | |
![]() ![]() ![]() | Σ | 1..1 | Identifier | HPR-number |
![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() | ?! Σ | 0..0 | code | |
![]() ![]() ![]() ![]() | Σ | 0..0 | CodeableConcept | |
![]() ![]() ![]() ![]() | Σ | 1..1 | uri | The namespace for the identifier Fixed Value: urn:oid:2.16.578.1.12.4.1.4.4 |
![]() ![]() ![]() ![]() | Σ | 1..1 | string | The value that is unique Example: 123456 |
![]() ![]() ![]() ![]() | Σ | 0..0 | Period | |
![]() ![]() ![]() ![]() | Σ | 0..0 | Reference(Organization) | |
![]() ![]() ![]() | Σ | 1..1 | Identifier | F-number |
![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() | ?! Σ | 0..0 | code | |
![]() ![]() ![]() ![]() | Σ | 0..0 | CodeableConcept | |
![]() ![]() ![]() ![]() | Σ | 1..1 | uri | The namespace for the identifier Fixed Value: urn:oid:2.16.578.1.12.4.1.4.1 |
![]() ![]() ![]() ![]() | Σ | 1..1 | string | The value that is unique Example: 123456 |
![]() ![]() ![]() ![]() | Σ | 0..0 | Period | |
![]() ![]() ![]() ![]() | Σ | 0..0 | Reference(Organization) | |
![]() ![]() ![]() | Σ | 1..* | Identifier | A identifier for the person as this agent |
![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() | ?! Σ | 0..1 | code | usual | official | temp | secondary (If known) Binding: IdentifierUse (required) |
![]() ![]() ![]() ![]() | Σ | 0..0 | CodeableConcept | |
![]() ![]() ![]() ![]() | Σ | 1..1 | uri | The namespace for the identifier Fixed Value: urn:oid:2.16.578.1.12.4.1.2 |
![]() ![]() ![]() ![]() | Σ | 1..1 | string | The value that is unique Example: 123456 |
![]() ![]() ![]() ![]() | Σ | 0..0 | Period | |
![]() ![]() ![]() ![]() | Σ | 0..0 | Reference(Organization) | |
![]() ![]() ![]() | Σ | 0..1 | boolean | Whether this practitioner's record is in active use |
![]() ![]() ![]() | Σ | 0..1 | HumanName | A name associated with the person |
![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() | ?! Σ | 0..0 | code | |
![]() ![]() ![]() ![]() | Σ | 0..1 | string | Text representation of the full name |
![]() ![]() ![]() ![]() | Σ | 0..* | string | Family name (often called 'Surname') |
![]() ![]() ![]() ![]() | Σ | 0..* | string | Given names (not always 'first'). Includes middle names |
![]() ![]() ![]() ![]() | Σ | 0..0 | string | |
![]() ![]() ![]() ![]() | Σ | 0..0 | string | |
![]() ![]() ![]() ![]() | Σ | 0..0 | Period | |
![]() ![]() ![]() | Σ | 0..0 | ContactPoint | |
![]() ![]() ![]() | Σ | 0..1 | Address | Where practitioner can be found/visited |
![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() | ?! Σ | 0..1 | code | home | work | temp | old - purpose of this address Binding: AddressUse (required) Fixed Value: work |
![]() ![]() ![]() ![]() | Σ | 0..1 | code | postal | physical | both Binding: AddressType (required) Example: both |
![]() ![]() ![]() ![]() | Σ | 0..1 | string | Text representation of the address Example: 137 Nowhere Street, Erewhon 9132 |
![]() ![]() ![]() ![]() | Σ | 0..* | string | Street name, number, direction & P.O. Box etc. Example: 137 Nowhere Street |
![]() ![]() ![]() ![]() | Σ | 0..1 | string | Name of city, town etc. Example: Erewhon |
![]() ![]() ![]() ![]() | Σ | 0..1 | string | District name (aka county) Example: Madison |
![]() ![]() ![]() ![]() | Σ | 0..0 | string | |
![]() ![]() ![]() ![]() | Σ | 0..1 | string | Postal code for area Example: 9132 |
![]() ![]() ![]() ![]() | Σ | 0..1 | string | Country (can be ISO 3166 3 letter code) |
![]() ![]() ![]() ![]() | Σ | 0..0 | Period | |
![]() ![]() ![]() | Σ | 0..1 | code | male | female | other | unknown Binding: AdministrativeGender (required) |
![]() ![]() ![]() | Σ | 0..1 | date | The date on which the practitioner was born |
![]() ![]() ![]() | 0..0 | Attachment | ||
![]() ![]() ![]() | 0..* | BackboneElement | Roles/organizations the practitioner is associated with | |
![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() | ?! | 0..* | Extension | Extensions that cannot be ignored |
![]() ![]() ![]() ![]() | 0..1 | Reference(noAuditOrganization) | Organization where the roles are performed | |
![]() ![]() ![]() ![]() | Σ | 0..1 | CodeableConcept | Roles which this practitioner may perform Binding: PractitionerRole (example) |
![]() ![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() ![]() | Σ | 0..* | Coding | Code defined by a terminology system |
![]() ![]() ![]() ![]() ![]() ![]() | 0..1 | id | xml:id (or equivalent in JSON) | |
![]() ![]() ![]() ![]() ![]() ![]() | 0..* | Extension | Additional Content defined by implementations | |
![]() ![]() ![]() ![]() ![]() ![]() | Σ | 1..1 | uri | Identity of the terminology system |
![]() ![]() ![]() ![]() ![]() ![]() | Σ | 0..0 | string | |
![]() ![]() ![]() ![]() ![]() ![]() | Σ | 1..1 | code | Symbol in syntax defined by the system |
![]() ![]() ![]() ![]() ![]() ![]() | Σ | 0..1 | string | Representation defined by the system |
![]() ![]() ![]() ![]() ![]() ![]() | Σ | 0..0 | boolean | |
![]() ![]() ![]() ![]() ![]() | Σ | 0..1 | string | Plain text representation of the concept |
![]() ![]() ![]() ![]() | Σ | 0..0 | CodeableConcept | |
![]() ![]() ![]() ![]() | Σ | 0..1 | Period | The period during which the practitioner is authorized to perform in these role(s) |
![]() ![]() ![]() ![]() | 0..0 | Reference(Location) | ||
![]() ![]() ![]() ![]() | 0..0 | Reference(HealthcareService) | ||
![]() ![]() ![]() | 0..0 | BackboneElement | ||
![]() ![]() ![]() | 0..0 | CodeableConcept | ||
![]() |
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).
In the discriminator the type element is set to 'type' and the path is set to '$this'. See the XML code below.
<slicing> <discriminator> <type value="type" /> <path value="$this" /> </discriminator> <rules value="open" /> </slicing>
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:
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.
Most modules end with an exercise. Use Forge to start profiling yourself. Just contact us at simplifier@fire.ly if you need any help.
Follow one of our predefined or tailor-made courses. We will make sure you know FHIR inside-out.
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.
Powered by SIMPLIFIER.NET