Building resources from FHIR profiles.

This post finishes off our ‘mini-series’ on creating a simple profile using clinFHIR – now we’ll create a resource based on the profile that we created earlier.

We’ve already created resources in clinFHIR and the process is actually the same – except that we select a profile rather than a base resource. To do that, select the Resource Builder and then a patient to get the Resource Builder screen. Click the radio button labeled ‘Profiled Resource’ under the ‘Select Profile’ label (remember that even the base resources in FHIR use the profiling mechanism). You’ll see a link just to the right labeled ‘Find New’. Clicking on that link brings up a window where you can search for the profile to use.

Screen Shot 2015-08-03 at 7.10.17 am

Enter the name (or part of it) in the ‘name’ field (leaving the other fields untouched) and click ‘Search’ button. You’ll get a list of matching profiles, which should include the one you created earlier. Click on that profile – you’ll see the definition of the profile (which you can ignore) and a button will appear at the top right labeled ‘select’ (which you should click).

After that the selected profile will be displayed in the resource builder as shown in the image below:

Screen Shot 2015-08-03 at 6.39.21 am

Note that the extension (or extensions if there is more than one) will be displayed in a different color and the description rather than the path is shown. Otherwise it works in exactly the same way as any other element – in the diagram above the datatype has been clicked and a search is under way.

The builder will not display any elements you removed from the profile, and if you adjusted the multiplicity of any element (e.g. made it required) then that will be honored in the builder as well.

Otherwise the builder behaves exactly as before – with one exception.

Take a look at the resource that is being generated.

Screen Shot 2015-08-03 at 7.17.14 am

You’ll note that the ‘meta’ element now has a ‘profile’ array with the name of the profile you selected when creating this resource. What this means is that this resource is claiming to be conformant to the profile – it obeys all the rules you set. If you specified an element as required then there will be a value for that element in the resource, if you removed an element then there will not be a value. Any coded elements will have a value from the valuesets you specified, and so forth.

Note that this is expressed as a ‘claim’ – if it really matters to a server that a resource instance is conformant to a profile, then it does need to check – the community is developing libraries that will do that, or you can build your own, but if you do build your own, then wait until DSTU-2 is complete as there are some changes in the spec that will effect how this is being done – particularly with the concept of ‘Implementation Guides’ that we’ll discuss another time. And a word of warning: the whole profiling mechanism is quite sophisticated – you’ll need to understand it well if you want to roll your own.

So that completes our little series on profiling.

And just to re-emphasise, the profiling part of clinFHIR is not intended to replace the ‘official’ profiling tool – forge. It is a simplified tool, and uses only a subset of the profiling capabilities of FHIR. Don’t use it to edit the profiles created as part of the spec!

You’ll also find that the builder probably won’t correctly display the profiles from the spec either – especially profiled datatypes. This will eventually be corrected, but for now you’re probably better to utilize the base resource profiles and those you create within the tool itself.

Have fun profiling FHIR!

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.

One Response to Building resources from FHIR profiles.

  1. Pingback: Creating Lists in clinFHIR | Hay on FHIR

Leave a Reply

Discover more from Hay on FHIR

Subscribe now to keep reading and get access to the full archive.

Continue reading