By Ardon Toonstra – Rob’s former blogpost of about a year ago may be a bit outdated but definitely not irrelevant. As FHIR is picking up speed more and more people are starting to model FHIR to their specific needs. For the beginners in FHIR modelling – better known as “profiling” – this updated blogpost is the way to go.
As an example I will create a national ‘Dutch Patient’ profile. Even though Ewout Kramer is in the core team of FHIR, none of the specific concepts of our small country made it into the core spec of FHIR. In this blog, I will demonstrate how to make a customized profile.
Step 1 – Downloading and running Forge
Go to https://simplifier.net/ and click on Download Forge on the home page. Then create a free account on Simplifier.net, the global FHIR registry, before downloading Forge. This account may come in handy as this enables you to view and share your work in a click of button.
Click on ‘Goto Installer’ and ‘Install Forge’ for DSTU2 1.02. 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 Profile. 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 Session 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 amongst others: 1) enter a URL for your StructureDefinition (profile), 2) change the name of your StructureDefinition (profile) and 3) provide a description of your StructureDefinition.
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 on “New” and then on “New Extension” in the Solution explorer to create a new extension called “MyExtension”.
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” element.
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 in the Element Properties on the right site. If your customized profile Organization is opened in the Session Explorer Forge will automatically give that Profile URI as an option. Done!
Step 6 – Saving your profile
If your profile has a yellow star in the Session Explorer the profile has unsaved changes. To save your newly created profile you can select your profile in the Session Explorer and click the save icon. Ctrl + Shift + S allows you to save all profiles at the same time.
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 it’s definition is a separate StructureDefinition resource. Both the PatientNL.xml and Role.xml file can be viewed with any xml browser, to see what Forge actually created.
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 check “Save snapshot component”.
Share your work with your team or the FHIR community at large!
Because Forge is integrated with Simplifier.net and you now have an account it is possible to directly render and share your work online via Simplifier.net. This blog shows you the couple of mouse clicks that are needed.