Make your first FHIR profile – within one hour!

By Rob Mulders – Just before the Atlanta 2015 connectathon, Firely released the new FHIR DSTU2 version of Forge, the Profile Editor. With this tool, I was able to make my first HL7 FHIR profile within one hour. That gave me the inspiration to write this new blogpost in the series ‘Make your first FHIR …. within one hour!’.

As an active member of HL7 The Netherlands, the first thing that came to my mind was making a ‘Patient in the Netherlands’ profile. Even though Ewout Kramer is in the core team of FHIR, some special features of our small country did not make it into the base spec of FHIR. In this blog, I will demonstrate how to make a customized profile.

Step 1 – Downloading and running Forge

Go to and click on Install Forge for DSTU2 1.0. You will have to accept the terms of both Microsoft (for the .Net runtime if you do not already have that) and Firely (for Forge). I can assure you both companies really exist and do no harm. After installing both components, Forge will automatically launch.

Step 2 – Creating and naming your own profile

In Forge, choose File – New Constraint. The resource tab is now opened. This screen shows all available FHIR base resources. Select the “Patient” resource and click the “Select” button. In the Solution Explorer on the left side you now see “MyPatient”.


If you click on MyPatient in the menu on the left you will open the Properties tab of MyPatient. Here you can: 1) enter a URL for your StructureDefinition (profile), 2) change the name of your StructureDefinition (profile) and 3) enter your contact information.


Step 3 – Use slicing to add your own unique identifier

Next to the Properties tab you will find the Element Tree tab. This tab holds the element tree that contains all the elements of the base resource “Patient”. Forge offers multiple actions to modify a StructureDefinition. For example, you can change the information of the base elements, slice elements, or add extensions to elements.


Selecting an element in the tree will open the Element Properties on the right side of the screen. Examples of element properties are: the name, a short description, the cardinality and the datatype.

A patient usually has one (or more) identifiers. To specify multiple identifiers you can slice the element “identifier”. You do this by selecting the element you want to slice and click the Slice button. Once you sliced the element, you can add slices by clicking the “Add slice” button. For this example I added the Dutch Social Security Number, called burgerservicenummer. You can add more slices by selecting the element (identifier in this example) and clicking the “Add slice” button again.


Once you have created the slice burgerservicenummer, you can edit its properties in the Element Properties screen.


Step 4 – Use extensions to add a role to the contactperson of a patient

If the base resource does not contain all the elements you need, you can create an Extension for the element you need. Click the paperclip icon in the Solution explorer to create a new extension called “MyExtension”.


You will see this in Forge:


The extension also has a Properties and Element Tree tab where you can modify the information of the extension. In this example I want to add a “Role” to the contactperson of a patient. In the Properties tab of the extension I changed the name of the extension to “Role”.


To add the Role extension to the “contact” element in the PatientNL profile I first select the “contact” element. Secondly I click the “Extend” button.


This action adds the “MyExtension” element to contact.


Selecting MyExtension will open the Element Properties window on the right side. In this window you can select the “Role” extension from a dropdown menu.


Under Name you can specify the name of the role of the contactperson of the patient.

Step 5 – Use referencing to make the contactperson part of an organization

Sometimes you want an element in a profile to reference another profile. For example, the contact of a patient can be part of an organization. If the profile Organization exists, you can reference to this profile by adding the canonical url to the organization element in contact. To do this first select the organization element.


Then add the Profile URI to the reference data type. Done!


Step 6 – Saving your profile

If your profile has a yellow star in the Solution Explorer the profile has unsaved changes. To save your newly created profile you can select your profile in the Solution Explorer and click the save icon.


In the Save as dialog box, choose your name for the .xml file in which your Conformance Resource will be stored. You will also need to save Role, since this has become a separate resource. Both the PatientNL.xml and Role.xml file can be viewed with any xml browser, to see what Forge made out of it.

As a default setting your profile is saved as a differential, which means it only saves the changes you made in comparison with the base resource. If you want to save your complete profile as an xml or json file, go to Options and click “Generate Snapshot”.

Next time

In my next blogpost, I hope to demonstrate how you can publish your profile to the outside world. For instance, as a software vendor, you want to enable outsiders to use your profile to hook up to your system. Who knows, maybe suddenly a whole bunch of app developers will write killer apps that boosts the use of your system!