Extending FHIR Functionality
The SanteDB FHIR subsystem allows developers to easily add new behaviours, resources, and operations. The following extension points and interfaces are exposed in the SanteDB FHIR package:
Message Operations (IFhirMessageOperation) - Used to add new FHIR message operations into the SanteDB stack (i.e. on the $process-message interface)
Operations (IFhirOperationHandler) - Used to add new FHIR operations invoked using
$operationNameCustom Extensions (IFhirExtensionHandler) - Used to add/expose individual extensions on the existing endpoints and messages.
Behavior Modifier (IFhirRestBehaviorModifier) - Used to intercept operations on the FHIR interface and modify the behaviour of the call.
Profile / Validation (IFhirProfileValidationHandler) - Used to perform validation on any resource which is created/updated. This is typically used on the $validate message.
Message Operations
FHIR Messaging allows for complex operations to be invoked using a Bundle which contains a MessageHeader resource. For example, in order to implement an operation HelloWorld , a FHIR message may contain:
{
"resourceType": "Bundle",
"type": "message",
"entry": [
{
"fullUrl": "MessageHeader/example-1",
"resource": {
"resourceType": "MessageHeader",
"id": "example-1",
"eventUri": "urn:hello:world",
"source": {
"endpoint": "http://ohie.org/test/harness"
},
"focus": [
{
"reference": "Parameters/example-1"
}
],
"destination": [
{
"endpoint": "http://ohie.org/test/endpoint/Bundle"
}
]
}
},
{
"fullUrl": "Parameters/example-1",
"resource": {
"resourceType": "Parameters",
"parameter": [
{
"name": "your-name",
"valueString": "Bob!"
}
]
}
}
]
}Given the contrived example above, you can register a new IFhirMessageOperation to be invoked when the operation urn:hello:world message trigger you would implement a handler.
Registering your Message Handler
Finally, SanteDB does not automatically enable all operations, therefore it is required to register your operation handler in the messages portion of the FHIR configuration section.
Rest Operations
REST operations are invoked using the GET or POST method on a scoped resource. Typically the invoke is in the form: http://example.com/fhir/Patient/$operation . FHIR REST operations can be registered with an implementation of IFhirOperationHandler , for example, a FHIR operation for hello-world may be called as GET http://example.com/fhir/Patient/$hello-world.
To implement the hello-world operation, a C# class is written.
Finally, SanteDB does not automatically enable all operations, therefore it is required to register your operation handler in the messages portion of the FHIR configuration section.
Extension Handlers
By default, SanteDB's internal properties are mapped to FHIR base resources, and this is handled through the DataTypeConverter class. You may, however, have a need to expose additional data, relationships, or receive them. This can be done by using FHIR Extensions.
FHIR Extension handlers are implemented using the IFhirExtensionHandler interface. For example, if you wanted to implement an extension handler which tags a patient if the value of the extension is a certain value.
Finally, SanteDB does not automatically enable all extensions, therefore it is required to register your extension handler in the messages portion of the FHIR configuration section.
Last updated
Was this helpful?