Create a new extension
- David hay
To create a new extension, click the 'new extension' button in the tool bar. The following modal is displayed.
The first thing to do is to enter a name for the extension. clinFHIR will use this to create a 'connonical' name - actually a url that is globally unique. it does this by appending the name you enter (without spaces) to the string 'clinfhirext'- you can see the id being created as you type. The Extension is assumed to be created on the registry that is supporting the tool - the Health Intersections server by default.
When you leave the name field, the app will make a query to the server to see if the extension name has already been used. If it has, then you will get a warning. It won't stop you from creating the extension, but the existing one will be overwritten if you continue and save this one. Once this check has been performed, a 'Save' button will appear.
This workflow would not be suitable in a production setting of course. FHIR does support more complex workflow to safely create extenson definitions than a production tool should follow. Once published, an extension should not be altered, as resources can start using it so its meaning should not alter.
The following options are supported for new extensions.
- Name. As described above, this is used to generate the unique URL for the extesion. It is required.
- Description. A detailed description of what the purpose and meaning of the extension is. It is also required
- Display. A short description
- Publisher. Who created the extension. This defaults to 'clinfhir' but you can override this if you like.
- Allow more than 1. Check this box if it is OK to have more than one of these extensions in a resource
- DataType. The datatype of this extension. Only a single datatype is supported. If a coded datatype is selected, then an option to select the ValueSet is displayed. This will invoke the ValueSet Browser so you can find and select the ValueSet you want.
- Context Type. This is currently fixed at 'resource' - ie the extension can only be applied to a resource and not to an element within the resource (actually the app does not enforce this - more work is required
- Resource Type. When the Context Type is resource, this allows you to indicate the types of resource that this extension can be applied to. You can select multiple resource types. Leave blank if it can be applied to any resource.
Once the data for the extension has been entered, click save. clinFHIR will attempt to save the resource in the registry. If it is successful, then the complete URL of the extension is displayed for your information. You could use this url to retrieve the extension directly if you wish to - it's the URL that will appear in a resource instance containing this extension.
After you close the dialog, the new extension will appear in the right pane of the Profile Builder. You must click the 'Add to Profile' button to actually add the extension to the profile
A reminder that this is a very simple extension. The specification allows for a lot more options, including multiple datatypes and nested extensions that clinFHIR does not support.