Extensions
Re-usable Extensions
Trifolia supports re-usable extensions for FHIR DSTU2 implementation guides and profiles.
Creating a Re-usable Extension
- Create a new profile in a FHIR DSTU2 implementation guide.
- Select FHIR DSTU2: Extension for the "type" of profile.
- Note that the Applies To button is disabled for Extension profiles.
- After selecting Extension as the type of profile, a constraint is automatically created by Trifolia for the "@url" attribute and matches the identifier specified for the extension. Any time the identifier is updated, the constraint will automatically be updated as well.
- Define a constraint for the type of value your extension will require (such as "valueCodeableConcept").
- Save the profile.
Trifolia treats all profiles that are of type FHIR DSTU2: Extension as re-usable extensions. The behavior of Trifolia's template/profile editor adjusts slightly (such as disabling the Applies To selection button, and automatically adding a @url constraint) to account for requirements in the core FHIR DSTU2 standard when editing extension profiles.
Using a Pre-defined Extension
- Open any FHIR DSTU2 profile.
- In the constraint editor, select an "extension" element that does NOT already have a constraint defined for it.
- A drop-down list shows in the constraint editor panel that provides a list of all extensions for which you have permissions.
- Select the extension you want to add to the profile and select the "+" (add) button.
- The "extension" element is turned into a constraint, and automatically creates constraints for each of the constraints defined in the extension.
- The "extension" element itself should be marked as a slice and the @url constraint within the extension should be marked as a descriminator. The conformance and cardinality is set to "SHALL 1..1" for the new extension constraint, as well as the @url descriminator.
Profile Extensions
The profile may define extensions in addition to the constraints. These are extensions that add information to the profile as a whole, but are not required to be implemented where the profile is used/asserted.
Both FHIR DSTU1 and FHIR DSTU2 profiles support extensions on the profile.
Adding Extensions to a Profile
- Edit any FHIR profile.
- The bottom entry in the Extensions panel of the Template/Profile tab always represents a "new" extension.
- Fill in the identifier, type, and value of the extension (all three fields are required).
- Select the Add button to the right of the fields.
- The extension is now added to the profile, and the profile can be saved. The extension added may be edited, but the type of the extension may not be changed; only the identifier and the value may be changed after extension is added.
Note: A future version of Trifolia will incorporate re-usable extensions in the profile extensions.