Custom resources using StructureDefinition
Custom resources are defined by individual organizations or projects to meet specific needs not covered by the FHIR standard. While these resources can be useful within a particular ecosystem, they may not be interoperable with other systems that do not recognize or support those custom resources.
FHIR uses StructureDefinition resources to model data structures. Aidbox allows you to model data in the same way by expressing your custom resource using a FHIR StructureDefinition resource.
Configure Aidbox
To begin using custom FHIR resources, enable the FHIR Schema validation engine in Aidbox.
Setup Aidbox with FHIR Schema validation engineCreate StructureDefinition for custom resource
To create a custom resource in Aidbox using StructureDefinition you have to create StructureDefinition resource via REST API.
It is a usual FHIR StructureDefinition resource, but with several limitations:
name
,type
, andid
must be equal.kind
: must be equal toresource
orlogical
derivation
: If it is set tospecialization
- Aidbox will create a new resource type with tables in the database and other resource infrastructure. If it is set toconstraint
- Aidbox will create a new profile that can be referenced on resource instances.
The further guide details the process of creating custom resources for a notification system, demonstrating the typical workflow of creating, managing, and sending template-based notifications from a healthcare system to patients using custom resources defined through StructureDefinition.
To implement a notification flow, you may need a notification resource and a template resource to store your notification messages.
Let's start with shaping a TutorNotificationTemplate resource.
This resource contains one property defined under StructureDefinition.differential
:
template
: This property is for notification template text and is of the FHIRstring
data type. Also, it is a required property.
Now, that we got resource to store our templates, let's shape a more complex one - a resource TutorNotification
that has the following properties:
type
: property that containsbinding
value set URL invalueSet
property andstrength
:required
, that is used to force binding validation.status
: property withbinding
tovalueSet: http://hl7.org/fhir/ValueSet/task-status
with additional constraints torequested
,in-progress
orcompleted
values.template
: reference toTutorNotificationTemplate
that we created above.message
: message text and is of the FHIRstring
data type.sendAfter
: property that specifies thedateTime
after which this notification should be sent.subject
: reference to thePatient
resource to whom this notification will be sent.
Define search parameters
So request that creates a welcome sms notification for James Morgan at 12:00 should look like this:
Then we probably want to create some patient:
Let's create an instance of TutorNotificationTemplate
resource with a welcome message based on the related patient's given name.
Now you can interact with cuctom resources just like with any other FHIR resources.
Interact with a resource
It allows you to make the following requests:
The other one is used to include related Patient resources in the search bundle.