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!

12 thoughts

  1. David Moorhouse on said:

    I have installed the MS Dot.Net framework 4.6 and rebooted my Windows 7 computer. Now when I download and try to run the forge application for DSTU2 I get an error: The error message is “Application validation did not succeed. Unable to continue” The error text is copied below.

    It looks like the computed hash is invalid – what do I need to do to get the Forge app running ?



    Windows : 6.1.7601.65536 (Win32NT)
    Common Language Runtime : 4.0.30319.42000
    System.Deployment.dll : built by: NETFXREL2
    clr.dll : built by: NETFXREL2STAGE
    dfdll.dll : built by: NETFXREL2
    dfshim.dll : 4.0.41209.0 (Main.041209-0000)

    Deployment url :
    Server : Microsoft-IIS/8.0
    X-Powered-By : ASP.NET
    Deployment Provider url :
    Application url :
    Server : Microsoft-IIS/8.0
    X-Powered-By : ASP.NET

    Deployment Identity : Forge3.application, Version=, Culture=neutral, PublicKeyToken=cfeef14fd31c4afc, processorArchitecture=msil
    Application Identity : Forge3.exe, Version=, Culture=neutral, PublicKeyToken=cfeef14fd31c4afc, processorArchitecture=msil, type=win32

    * Installable application.

    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of resulted in exception. Following failure messages were detected:
    + File, Forge.chm, has a different computed hash than specified in manifest.

    No transaction error was detected.

    There were no warnings during this operation.

    * [5/11/2015 8:59:32 a.m.] : Activation of has started.
    * [5/11/2015 8:59:33 a.m.] : Processing of deployment manifest has successfully completed.
    * [5/11/2015 8:59:33 a.m.] : Installation of the application has started.
    * [5/11/2015 8:59:33 a.m.] : Processing of application manifest has successfully completed.
    * [5/11/2015 8:59:37 a.m.] : Found compatible runtime version 4.0.30319.
    * [5/11/2015 8:59:37 a.m.] : Detecting dependent assembly PresentationUI, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35, processorArchitecture=msil using PresentationUI, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=msil.
    * [5/11/2015 8:59:37 a.m.] : Request of trust and detection of platform is complete.

    Following errors were detected during this operation.
    * [5/11/2015 9:01:10 a.m.] System.Deployment.Application.InvalidDeploymentException (HashValidation)
    – File, Forge.chm, has a different computed hash than specified in manifest.
    – Source: System.Deployment
    – Stack trace:
    at System.Deployment.Application.ComponentVerifier.VerifyFileHash(String filePath, Hash hash)
    at System.Deployment.Application.ComponentVerifier.VerifyFileHash(String filePath, HashCollection hashCollection)
    at System.Deployment.Application.ComponentVerifier.VerifyComponents()
    at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
    at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
    at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
    at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
    at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

    No transaction information is available.

  2. […] a FHIR profile. If necessary: create one yourself. This will get you working in a more structured […]

  3. Igor on said:

    Hi Rob, thank you very much for the great post. I’m wondering if you are still planning to write the next post demonstrating how to publish profiles to the outside world.

  4. adityajoshicurizent on said:

    How can I create Snapshot mode Profile in Forge 12.5 editor? by default when I create a profile for Patient, It is creating differential profile. In such case, I have to add all the elements. I can certainly change any of them but my requirement is hardly to change one or two elements, rest I want same as base profile which means I require snapshot mode. please help.

    • Ardon Toonstra on said:

      Hi adityajoshicurizent,

      In the latest Forge version (13.2) a snapshot XML can be created by going to Options in the top menu and select ‘Save snapshot component’ under ‘FHIR Options’. When you save your profile the output will be a snapshot XML, however, Forge will only show the differential in its XML viewer. I believe this also works in the Forge 12.5 editor.

  5. […] Ardon Toonstra – After completing your FHIR profiles, the next step will probably be to make them available to the world. Publishing your profiles will […]

  6. Mritunjay Dubey on said:

    I tried this tool, to add an extension for to patient resource. But I feel there is something wrong. I added an extension which generates the bellow xml. I have just added the relevant part.

    I feel there is a problem because there are two elements with . I am trying to validate it using This throws an error as "Element matches more than one slice". Can you please suggest what is wrong here.

    • Mirjam Baltus on said:

      Hello Mritunjay,
      as we discussed by email, the current snapshot generator in Forge still has some bugs. The next release (somewhere before September 18th) will fix this particular error.

      Thank you for reporting it,

      Mirjam Baltus

      • Mritunjay Dubey on said:

        Hey team,

        I wanted to know if I create an extension, why can’t I use that to extend a datatype as well as a resource’s element.

        For Example :- I wanted to extend Address saying there will be an AddressCode as well, but I want to extend it as in Patient.address.addressCode as well as override definition of Address Datatype saying there is a new field.

        But the context-type is restricting me to either use it in datatype or resource’s element.
        Please let me know how should I do it? Should I create two different extensions for both or something else.


  7. […] 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 […]

Post a comment

Your email address will not be published. Required fields are marked *