Magentus Practice Management FHIR Implementation Guide
1.2.35 - ci-build
Magentus Practice Management FHIR Implementation Guide - Local Development build (v1.2.35) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions
Theatre Bookings uses a combination of Appointment
and AppointmentResponse
resources to negotiate agreement around the finalisation of a Theatre Booking. Appointment
resources are created and managed by the VMO while AppointmentResponse
s are created by participants in the booking to indicate their ability to participate, or in our case the acceptance of the proposed Theatre Booking to the hospital. Participants can include people, equipment, and locations. Our initial implementation identifies the following participants: VMO, Hospital, Patient, Assistant, and Anaesthetist. At this stage, the Hospital is only focussed on the Hospital's role in the Theatre Booking whoich is inclusive of location/theatre, staff, and equipment as managed by the Hospital.
The FHIR Resources for a Theatre Booking and manifested through a FHIR Appointment are shown in the diagram below. The Appointment
is at the centre of this set of FHIR Resources and link to/from this resource allowing the package of resources to be discovered through an Appointment
search.
Unlike traditional healthcare integration approaches, our approach to Theatre Booking is not based on a point-to-point messaging model. Instead the VMO Practice Management System (PMS) and the Hospital interact through a shared FHIR server in which Appointment
s and AppointmentResponse
s are stored. Each partner tracks change in this common FHIR repository to understand the status of a Theatre Booking. Monitoring for booking changes can either be through polling with a FHIR search or via a subscription to changes based on search criteria of interest. Key to these interactions are changes in the Status
of the Appointment
and Status
of a participant's agreement via the AppointmentResponse
.
Bookings that end up in a cancelled
state do not change from that final state. However, pending
and booked
states for a Theatre Booking can change depending on the status of a AppointmentResponse
received from a Hospital. The following diagram shows the status changes in a booking based upon those responses.
The FHIR Profiles for the resources of interest are listed below.
Additional EBooking Resources are contained within the resources above, the FHIR profiles for these resources are listed below.
Magentus Solutions Profile | FHIR® Resource |
---|---|
Bookings Anaesthetic Request | ServiceRequest |
Bookings Prosthesis | Device |
Magentus Coverage | Coverage |
The FHIR Resources generated and referenced by the Bookings Partner are shown in the diagram below.
The FHIR Profiles used by the Bookings Partner are listed below.
Magentus Profile | FHIR® Resource |
---|---|
Bookings Appointment Response | AppointmentResponse |
In order to receive subcription notifications from the FHIR Server when resources of interest are created or updated, a subscription is registered. A subscription request includes the following properties.
Property | Description | Example |
---|---|---|
criteria | Search criteria to match resources of interest | Appointment?status=pending,cancelled |
status | Fixed: requested | requested |
channel.type | Fixed: rest-hook | rest-hook |
channel.endpoint | Web service URL where webhook is posted | https://webhook.site/bbd78ee4-e267-4633-8acc-38a5e1dc54a0 |
channel.header | Authorization header to be used in the subscription notification | Authorization: Bearer secret-token-abc-123 |
Example The following example creates a new Subscription for the Appointment resource with a criteria on the status element filtering on the values of pending OR cancelled (Note: the comma delimitor between parameter values represents an OR, see https://hl7.org/fhir/r4/search.html#combining).
POST /Subscription
{
"resourceType": "Subscription",
"criteria": "Appointment?status=pending,cancelled",
"status": "requested",
"reason": "Appointment pending and cancelled subscription",
"channel": {
"type": "rest-hook",
"endpoint": "https://webhook.site/bbd78ee4-e267-4633-8acc-38a5e1dc54a0",
"header": ["Authorization: Bearer secret-token-abc-123"]
}
}
The Subscription endpoint can also be used to Search, Read, Update and Delete as per the standard FHIR REST API pattern.
A subcription notification is received as a POST request on the endpoint specified in the subscription registration request. The POST request has an empty body.
Example
POST https://webhook.site/bbd78ee4-e267-4633-8acc-38a5e1dc54a0
Authorization: Bearer secret-token-abc-123
The subscription notification shall respond as quickly as possible with a success status of 200 OK or 202 Accepted, and an empty body. The latter is normally returned when the request is accepted for processing but processing will commence after the response has been returned, which is the preferred approach for subscription notifications.
Any error response may result in a subsequent retry by the FHIR Server to submit the Subscription Notification until the number of retries is exceeded at which time the FHIR Server will stop the subscription. See Managing Subscriptions and Errors for more details.
When a subscription notification is received, perform a Search request with the corresponding criteria along with a _lastUpdated parameter with the timestamp when the last search request was performed with the gt prefix (see https://hl7.org/fhir/r4/search.html#prefix).
Example
GET /Appointment?status=pending,cancelled&_lastUpdated=gt2022-12-13T12:30:00Z
In order to retrieve the entire Bookings transaction, use the following _include
and _revinclude
parameters.
Parameter | Value |
---|---|
_include | Appointment:based-on |
_include | Appointment:actor |
_include:iterate | Patient:organization |
_include:iterate | ServiceRequest:requester |
_include:iterate | PractitionerRole:practitioner |
_include:iterate | PractitionerRole:organization |
_revinclude:iterate | Encounter:based-on |
_revinclude:iterate | ChargeItem:context |
_revinclude:iterate | Consent:data |
Example
GET /Appointment?status=pending,cancelled&_lastUpdated=gt2022-12-13T12:30:00Z&_include=Appointment:based-on&_include:iterate=ServiceRequest:requester&_include=Appointment:actor&_revinclude:iterate=Encounter:based-on&_revinclude:iterate=Consent:data&_include:iterate=Patient:organization&_revinclude:iterate=ChargeItem:context&_include:iterate=PractitionerRole:practitioner&_include:iterate=PractitionerRole:organization
An example search response is shown in Bookings Appointment SearchSet Bundle
Alternatively, the FHIR _search request using a HTTP POST may be used as shown in the following example.
Example
POST /Appointment/_search
Content-Type: application/x-www-form-urlencoded
status=pending,cancelled
_lastUpdated=gt2022-12-13T12:30:00Z
_include=Appointment:based-on
_include=iterate:ServiceRequest:requester
_include=Appointment:actor
_revinclude:iterate=Encounter:based-on
_revinclude:iterate=Consent:data
_include:iterate=Patient:organization
_revinclude:iterate=ChargeItem:context
_include:iterate=PractitionerRole:practitioner
_include:iterate=PractitionerRole:organization
Alternativly, you can create a Subscription that executes a PUT notification request that contains the relative reference to the FHIR Resource that triggered the notification.
This approach may be preferred as it will enable the notification listener to retrieve only the specific resource that triggered notification and not need to manage the possibility of retreiving multiple resources to process as part of the notification's corresponding Search request.
In order to receive subcription notifications from the FHIR Server with the resource reference that triggered the notification, use a subscription registration request with the following parameters.
Property | Description | Example |
---|---|---|
criteria | Search criertia to match resources of interest | Appointment?status=pending,cancelled |
status | Fixed: requested | requested |
channel.type | Fixed: rest-hook | rest-hook |
channel.endpoint | Web service URL where webhook is posted | https://webhook.site/bbd78ee4-e267-4633-8acc-38a5e1dc54a0 |
channel.header | Authorization header to be used in the subscription notification | Authorization: Bearer secret-token-abc-123 |
channel.payload | Fixed: application/fhir+json | application/fhir+json |
Example
POST /Subscription
{
"resourceType": "Subscription",
"criteria": "Appointment?status=pending,cancelled",
"status": "requested",
"reason": "Appointment pending and cancelled subscription with resource reference",
"channel": {
"type": "rest-hook",
"endpoint": "https://webhook.site/bbd78ee4-e267-4633-8acc-38a5e1dc54a0",
"header": ["Authorization: Bearer secret-token-abc-123"],
"payload": "application/fhir+json"
}
}
This subcription notification is received as a PUT request on the endpoint specified in the subscription registration request. The PUT request conatines the relative reference to the Resource that triggered the notification and an empty body.
Example
PUT https://webhook.site/bbd78ee4-e267-4633-8acc-38a5e1dc54a0/Appointment/840fdd86-f273-4c56-89af-cc5dcda59
Authorization: Bearer secret-token-abc-123
When a subscription PUT notification is received, you can retreive the referenced resource using a Search request with an _id
parameter. Note that there is no need for the corresponding subscription criteria and _lastUpdated
parameters as this request will directly retreive the specific resource that triggered the subscription.
Example
GET /Appointment?_id=840fdd86-f273-4c56-89af-cc5dcda59
The _include
and _revinclude
parameters may also be used as described above.