Using clinFHIR for profiling

One of things we’ve discussed many times in the past is profiling FHIR – taking the base resources and adapting them to specific Use Cases by adding extra fields (extensions) or restricting/removing base fields.

The community has provided tooling in the form of the forge tool from Furore for creating these profiles, but to do this properly requires a certain amount of planning and work, and there is a place for being able to quickly create a profile to try something out. This is kind of like clinical modeling – you have some data you wish to add to a resource, but you’re not sure where the best place to put it is – or you want to quickly create a profile that others can then comment on.

To meet this need, the latest version of ClinFHIR now has the facility for creating simple profiles, that can subsequently be used by the resource creator to create sample resources. These profiles are stored in a FHIR server in the usual way, so that anyone can create a sample resource from that profile to see what it looks like.

To start, load the resource builder from the main clinFHIR site. The first thing to do is to make sure that you’re referring to the correct servers. A simple way to do this is to click the gear icon to the top right, and select ‘Reset Config’ from the list. This will set the following default servers: (Note that this selection might change in the future)

  • Data Server (for Patients and Data) to the HAPI STU-3 server
  • Conformance Server (for the Profiles) to Grahames STU-3 server
  • Terminology Server (for Terminology services) to Grahames STU-3 server.

Of course you can set these to any of the configured servers’ – just be sure that they are at the same STU (Standard for Trial Use) level. (Incidentally there are also options on the gear menu to clear the cache of profiles and patients, which is handy when the lists get a bit long).

Next you need to select the base resource (actually the profile that defines the base resource) you want to modify. This is done by clicking the ‘Find Profile’ link in the second column on the front page (here is a post describing the new version of clinFHIR) and then selecting the appropriate resource type. Once you’ve done that, the profile will appear in the list of profiles in the middle column.

You’ll notice what looks like an eye immediately to the left of the profile name. Click on the eye, and the front page will be replaced by a tree representation of the profile. The following image shows what it looks like:

image 1

You’ll note that the tree view (which is quite simple in this profile) is to the left, and in the middle is a tab control currently showing some details of the currently selected node – and which will be updated as you select nodes.

At the top right is a link ‘New Profile’. Clicking on that link indicates that you want to create a profile based on the one selected (in this case the Basic resource) and does a couple of things as shown in the image below:

image 2

At the top middle of the page is the name of the profile that will be created. Enter a name into that box. Technically, this will become the id of the profile you create against the currently selected Conformance server, so clinFHIR will check that that name is not currently in use – warning you if it is.

It also displays a series of buttons to the right of the details. These buttons have the following functions.

Remove from profile will delete the currently selected node from the profile. In the screen shot above, this will remove the ‘created’ node from the profile.

Add Child Node and Add Sibling Node both add a new node (or element). The ‘Add child node’ adds the new node (which will be saved an as extension) ‘underneath’ the current node – in other words, the extension will be applied to the current node. ‘Add sibling node’ adds the extension at the same level as the selected node – in the example above this would be an extension on the root of the profile.

Clicking the ‘Add child node’, displays a small form allowing you to enter the key information about the new node (extension) as shown here:

image 3.png

So we’re adding an extension that will allow us to enter the phase of the moon when the resource is created. It will be a simple string, and there can only be one of them- and it’s optional. Click ‘Add’ to add it to the profile, and you’ll get a screen like this:

image 4

Note that the new node appears under the existing ‘created’ node.

Note also that at the bottom of the screen is a list of the changes you have made (additions and deletions), with the option to reverse that change.

Now click on the ‘Save’ button (which appears only after you entered a name – with no spaces), and with a bit of luck you’ll get a dialog stating that the profile has been saved.

Technically, what happens is that ClinFHIR will automatically create a new extension definition (actually a StructureDefinition resource) for each new element you have added, and then save the new profile with the correct references to the extension definitions.

Close the dialog to return to the front page, and you’ll find your new profile in the list of profiles.

Selecting a test patient and that profile (rather than clicking on the eye)  will display the resource builder with that profile as shown here:

image 5

You can create the resource in the usual way – and don’t forget to use the ‘Validate’ option to satisfy yourself that the resource is valid.

Some caveats.

  • The intention of this is to make it simple to visualize what a profile will look like so it just adds new extension definitions for each new element. Generally you would look for an existing extension definition that matched what you wanted to add (the moon phase in this example) as we really want re-use of extension definitions. (Future enhancements will add this).
  • The information you can add about the extension is quite limited. I’ll probably add a couple more items – like the ability to specify the ValueSet binding for a coded element – but it will never be a full featured tool like Forge.
  • When you specify a resource reference you can’t specify a resource type/s
  • Currently you can only add simple extensions. We’ll look to add complex ones in a later release (and update the resource builder to recognize them as well).
  • Right now, the functionality is brand new so testing has been minimal. We’ll squash bugs as fast as we can, but it will take people using the tool to find them. If you do get an error that let me know (preferably with a screenshot and description of what you were doing) and re-start the application.
  • The functionality has only been tested with STU-3 servers – and those servers can have issues at the moment as we work on the STU-3 release. Let me know if you run into problems.

On the task list for things to do:

  • Allow select an existing extension definition
  • Specify binding for coded elements
  • Support complex extensions
  • Allow to specify resource types in Resource reference
  • Add support for all datatypes

So there you have it – feedback welcomed (and appreciated)!


About David Hay
I'm an independent contractor working with a number of Organizations in the health IT space. I'm an HL7 Fellow, Chair Emeritus of HL7 New Zealand and a co-chair of the FHIR Management Group. I have a keen interest in health IT, especially health interoperability with HL7 and the FHIR standard. I'm the author of a FHIR training and design tool - clinFHIR - which is sponsored by InterSystems Ltd.

Leave a Reply

%d bloggers like this: