This page is part of the Subscriptions R5 Backport (v1.0.0: STU 1) based on FHIR v4.3.0. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions
The FHIR Topic-Based Subscription Model is composed of three parts:
SubscriptionTopic
SubscriptionTopic
SubscriptionTopic
)channel
and endpoint
used to send notificationshistory
,The SubscriptionTopic
resource is used to define conceptual or computable events for Subscription
resources. Conceptually, subscription topics specify an event or change in data that is used to trigger a notification. Topic definitions also include the boundaries around what a Subscription can filter for and additional resources that MAY be included with notifications.
For example, a topic may define that notifications should be sent when an Encounter
is created or updated to have the specific value of status=in-progress
. The topic may also specify that filters may only be applied to the Patient (Encounter.subject
where subject is a Patient) referenced by the Encounter, and that notifications may include the relevant Patient resource.
In order to support this functionality in R4, the SubscriptionTopic resource has been added as to FHIR version 4.3.0. Detailed information about the resource can be found on the HL7 FHIR website.
In order to make subscription topics more widely available, support for SubscriptionTopic
resources is available via the FHIR Registry.
The Subscription
resource is used to request notifications for a specific client about a specific topic. Conceptually, a subscription is a concrete request for a single client to receive notifications per a single topic.
For example, a subscription may ask for notifications based on an ‘Encounter in-progress’ topic, such as the one briefly described as an example in Subscription Topics. The subscription requires a link to the canonical URL of the topic, such as http://server.example.org/fhir/subscriptiontopics/encounter-in-progress
, information about the channel, such as requesting notifications via rest-hook
to the endpoint at http://client.example.org/notification-endpoint/abc
), and payload configuration, such as requesting that bundles are encoded as application/fhir+json
and include only identifiers (id-only
). Additionally, a subscription sets the filters which are applied to determine when notifications should be sent, such as indicating that only notifications for Patient/123
should be sent.
In order to support topic-based subscriptions in R4, this guide defines several extensions for use on the R4 Subscription resource. A list of extensions defined by this guide can be found on the Artifacts page. Note that the future FHIR R5 publication may define capabilities included in this specification as cross-version extensions. Since the FHIR R5 is currently under development, there are no guarantees these extensions will meet the requirements of this guide. In order to promote widespread compatibility, cross version extensions SHOULD NOT be used on R4 subscriptions to describe any elements also described by this guide
In order to link a Subscription
to a SubscriptionTopic
and prevent any confusion between the R4 query-based and topic-based implementations, the link to a SubscriptionTopic
is specified in the Subscription.criteria
field. For more details, please see the Subscription Profile in this guide.
When a FHIR Server accepts a request to create a Subscription
, the server is indicating to the client that the server:
When processing a request for a Subscription
, following are some checks that a server SHOULD validate:
SubscriptionTopic
is valid and implemented by the serverIn FHIR R5, a new type of Bundle
has been introduced, which uses the new SubscriptionStatus
resource to convey status information in notifications. For FHIR R4, notifications are instead based on a history Bundle, and a SubscriptionStatus resource is used to convey related meta-information (e.g., which subscription the notification is for).
Note that since notifications use history
type Bundles, all notifications need to comply with the requirements for that bundle type. Specifically, there are two invariants on Bundle (bdl-3
and bdl-4
) that require a Bundle.entry.request
element for every Bundle.entry
.
entry[0]
), the request SHALL be filled out to match a request to the $status
operation.POST
or PUT
operation on the resource, etc.). However, a server MAY choose to simply include a GET
to the relevant resource instead.Unless otherwise specified by a server implementation and channel, the Subscriptions Framework does not involve guaranteed delivery of notifications. While the Subscriptions Framework is able to support such mechanisms, defining them are beyond the scope of the standard or this guide.
Servers SHOULD detect errors and take appropriate action where possible. In general, this boundary is when the notification is delivered. For example, during a REST-hook notification, the subscription server can detect errors up until the REST endpoint returns a HTTP status code (e.g., 200). This does not imply that a client successfully processed (or even received) a notification - simply that the server has sent the notification successfully.
Therefore, clients SHOULD be aware of some limitations regarding delivery. In particular:
In order to mitigate the impact from the above issues, the Subscriptions Framework includes mechanisms to detect both scenarios. Details can be found on the Errors Page.