Make your first FHIR profile – within one hour!

By Rob Mulders – Just before the Atlanta 2015 connectathon, Furore 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 http://fhir.furore.com/forge 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 Furore (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”.

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.

Properties

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.

ElementTree

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.

burgerservicenummer

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

ElementProperties

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”.

Solution

You will see this in Forge:

SolutionTree

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”.

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.

Extend

This action adds the “MyExtension” element to contact.

MyExtension

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.

MyExtension2

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.

ReferenceOrganization

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

Reference

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.

Save

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!

Advertisements

12 thoughts on “Make your first FHIR profile – within one hour!

  1. David Moorhouse

    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 ?

    Thx

    David

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

    SOURCES
    Deployment url : http://forge.furore.com/install/Forge3.application
    Server : Microsoft-IIS/8.0
    X-Powered-By : ASP.NET
    Deployment Provider url : http://forge.furore.com/install/Forge3.application
    Application url : http://forge.furore.com/install/Application%20Files/Forge3_0_9_3_2/Forge3.exe.manifest
    Server : Microsoft-IIS/8.0
    X-Powered-By : ASP.NET

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

    APPLICATION SUMMARY
    * Installable application.

    ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://forge.furore.com/install/Forge3.application resulted in exception. Following failure messages were detected:
    + File, Forge.chm, has a different computed hash than specified in manifest.

    COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

    WARNINGS
    There were no warnings during this operation.

    OPERATION PROGRESS STATUS
    * [5/11/2015 8:59:32 a.m.] : Activation of http://forge.furore.com/install/Forge3.application 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=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35, processorArchitecture=msil using PresentationUI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=msil.
    * [5/11/2015 8:59:37 a.m.] : Request of trust and detection of platform is complete.

    ERROR DETAILS
    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)

    COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

    Reply
  2. Pingback: A Student at the 2015 FHIR DevDays Student Track | The Fhirplace

  3. Igor

    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.

    Reply
    1. muldersrob Post author

      Hey Igor, sorry for my late reply. I intend to write my post about “How to publish your profile – within one hour” during the next HL7 Working Group Meeting. That will be September 2016, in Baltimore.

      Reply
  4. adityajoshicurizent

    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.

    Reply
    1. Ardon Toonstra

      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.

      Reply
  5. Pingback: How to publish your profile – within one hour | The Fhirplace

  6. Mritunjay Dubey

    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 http://hapifhir.io/doc_validation.html. This throws an error as "Element matches more than one slice". Can you please suggest what is wrong here.

    Reply
    1. Mirjam Baltus

      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

      Reply
      1. Mritunjay Dubey

        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.

        Thanks

  7. Pingback: Make your first FHIR profile – within one hour! (Updated version Sep. 2016) | The Fhirplace

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s