Release 5

This page is part of the FHIR Specification (v5.0.0: R5 - STU). This is the current published version. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B

2.13 Resource SubscriptionStatus - Content

FHIR Infrastructure icon Work GroupMaturity Level: 2 Trial UseSecurity Category: Business Compartments: No defined compartments

The SubscriptionStatus resource describes the state of a Subscription during notifications.

This document contains information about the SubscriptionStatus resource and details specific to options in it. See Subscriptions for general information about using Subscriptions in FHIR.

The SubscriptionStatus resource is used to convey information about the current state of a Subscription during client notifications. It is not persisted or allowed to be referenced by other resources except as described below.

The SubscriptionStatus resource is used in the Subscriptions Framework. Information about the Boundaries and Relationships both within the Subscriptions Framework and to other areas of the FHIR specification can be found here.

No references for this Resource.

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. SubscriptionStatus TUDomainResourceStatus information about a Subscription provided during event notification
+ Rule: Event notifications must contain events
+ Rule: Status messages must contain status

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
... status ΣC0..1coderequested | active | error | off | entered-in-error
Binding: Subscription Status (Required)
... type ?!ΣC1..1codehandshake | heartbeat | event-notification | query-status | query-event
Binding: Subscription Notification Type (Required)
... eventsSinceSubscriptionStart Σ0..1integer64Events since the Subscription was created
.... eventNumber 1..1integer64Sequencing index of this event
.... timestamp 0..1instantThe instant this event occurred
.... focus 0..1Reference(Any)Reference to the primary resource or information of this event
.... additionalContext 0..*Reference(Any)References related to the focus resource and/or context of this event

... subscription Σ1..1Reference(Subscription)Reference to the Subscription responsible for this notification
... topic Σ0..1canonical(SubscriptionTopic)Reference to the SubscriptionTopic this notification relates to
... error Σ0..*CodeableConceptList of errors on the subscription
Binding: Subscription Error Codes (Example)


doco Documentation for this format icon

See the Extensions for this resource

UML Diagram (Legend)

SubscriptionStatus (DomainResource)The status of the subscription, which marks the server state for managing the subscriptionstatus : code [0..1] « null (Strength=Required)SubscriptionStatusCodes! » « This element has or is affected by some invariantsC »The type of event being conveyed with this notification (this element modifies the meaning of other elements)type : code [1..1] « null (Strength=Required)SubscriptionNotificationType! » « This element has or is affected by some invariantsC »The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notificationseventsSinceSubscriptionStart : integer64 [0..1]The reference to the Subscription which generated this notificationsubscription : Reference [1..1] « Subscription »The reference to the SubscriptionTopic for the Subscription which generated this notificationtopic : canonical [0..1] « SubscriptionTopic »A record of errors that occurred when the server processed a notificationerror : CodeableConcept [0..*] « null (Strength=Example)SubscriptionErrorCodes?? »NotificationEventEither the sequential number of this event in this subscription context or a relative event number for this notificationeventNumber : integer64 [1..1]The actual time this event occurred on the servertimestamp : instant [0..1]The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR objectfocus : Reference [0..1] « Any »Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objectsadditionalContext : Reference [0..*] « Any »Detailed information about events relevant to this subscription notificationnotificationEvent[0..*]

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco


[ a fhir:SubscriptionStatus;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root

  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:status [ code ] ; # 0..1 I requested | active | error | off | entered-in-error
  fhir:type [ code ] ; # 1..1 I handshake | heartbeat | event-notification | query-status | query-event
  fhir:eventsSinceSubscriptionStart [ integer64 ] ; # 0..1 Events since the Subscription was created
  fhir:notificationEvent ( [ # 0..* I Detailed information about any events relevant to this notification
    fhir:eventNumber [ integer64 ] ; # 1..1 Sequencing index of this event
    fhir:timestamp [ instant ] ; # 0..1 The instant this event occurred
    fhir:focus [ Reference(Any) ] ; # 0..1 Reference to the primary resource or information of this event
    fhir:additionalContext  ( [ Reference(Any) ] ... ) ; # 0..* References related to the focus resource and/or context of this event
  ] ... ) ;
  fhir:subscription [ Reference(Subscription) ] ; # 1..1 Reference to the Subscription responsible for this notification
  fhir:topic [ canonical(SubscriptionTopic) ] ; # 0..1 Reference to the SubscriptionTopic this notification relates to
  fhir:error  ( [ CodeableConcept ] ... ) ; # 0..* List of errors on the subscription
]

Changes from both R4 and R4B

This resource did not exist in Release R4

See the Full Difference for further information

This analysis is available for R4 as XML or JSON and for R4B as XML or JSON.

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. SubscriptionStatus TUDomainResourceStatus information about a Subscription provided during event notification
+ Rule: Event notifications must contain events
+ Rule: Status messages must contain status

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
... status ΣC0..1coderequested | active | error | off | entered-in-error
Binding: Subscription Status (Required)
... type ?!ΣC1..1codehandshake | heartbeat | event-notification | query-status | query-event
Binding: Subscription Notification Type (Required)
... eventsSinceSubscriptionStart Σ0..1integer64Events since the Subscription was created
.... eventNumber 1..1integer64Sequencing index of this event
.... timestamp 0..1instantThe instant this event occurred
.... focus 0..1Reference(Any)Reference to the primary resource or information of this event
.... additionalContext 0..*Reference(Any)References related to the focus resource and/or context of this event

... subscription Σ1..1Reference(Subscription)Reference to the Subscription responsible for this notification
... topic Σ0..1canonical(SubscriptionTopic)Reference to the SubscriptionTopic this notification relates to
... error Σ0..*CodeableConceptList of errors on the subscription
Binding: Subscription Error Codes (Example)


doco Documentation for this format icon

See the Extensions for this resource

UML Diagram (Legend)

SubscriptionStatus (DomainResource)The status of the subscription, which marks the server state for managing the subscriptionstatus : code [0..1] « null (Strength=Required)SubscriptionStatusCodes! » « This element has or is affected by some invariantsC »The type of event being conveyed with this notification (this element modifies the meaning of other elements)type : code [1..1] « null (Strength=Required)SubscriptionNotificationType! » « This element has or is affected by some invariantsC »The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated. This number is NOT incremented for handshake and heartbeat notificationseventsSinceSubscriptionStart : integer64 [0..1]The reference to the Subscription which generated this notificationsubscription : Reference [1..1] « Subscription »The reference to the SubscriptionTopic for the Subscription which generated this notificationtopic : canonical [0..1] « SubscriptionTopic »A record of errors that occurred when the server processed a notificationerror : CodeableConcept [0..*] « null (Strength=Example)SubscriptionErrorCodes?? »NotificationEventEither the sequential number of this event in this subscription context or a relative event number for this notificationeventNumber : integer64 [1..1]The actual time this event occurred on the servertimestamp : instant [0..1]The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR objectfocus : Reference [0..1] « Any »Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objectsadditionalContext : Reference [0..*] « Any »Detailed information about events relevant to this subscription notificationnotificationEvent[0..*]

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco


[ a fhir:SubscriptionStatus;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root

  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:status [ code ] ; # 0..1 I requested | active | error | off | entered-in-error
  fhir:type [ code ] ; # 1..1 I handshake | heartbeat | event-notification | query-status | query-event
  fhir:eventsSinceSubscriptionStart [ integer64 ] ; # 0..1 Events since the Subscription was created
  fhir:notificationEvent ( [ # 0..* I Detailed information about any events relevant to this notification
    fhir:eventNumber [ integer64 ] ; # 1..1 Sequencing index of this event
    fhir:timestamp [ instant ] ; # 0..1 The instant this event occurred
    fhir:focus [ Reference(Any) ] ; # 0..1 Reference to the primary resource or information of this event
    fhir:additionalContext  ( [ Reference(Any) ] ... ) ; # 0..* References related to the focus resource and/or context of this event
  ] ... ) ;
  fhir:subscription [ Reference(Subscription) ] ; # 1..1 Reference to the Subscription responsible for this notification
  fhir:topic [ canonical(SubscriptionTopic) ] ; # 0..1 Reference to the SubscriptionTopic this notification relates to
  fhir:error  ( [ CodeableConcept ] ... ) ; # 0..* List of errors on the subscription
]

Changes from both R4 and R4B

This resource did not exist in Release R4

See the Full Difference for further information

This analysis is available for R4 as XML or JSON and for R4B as XML or JSON.

 

Additional definitions: Master Definition XML + JSON, XML Schema/Schematron + JSON Schema, ShEx (for Turtle) + see the extensions, the spreadsheet version & the dependency analysis

PathValueSetTypeDocumentation
SubscriptionStatus.status SubscriptionStatusCodes (a valid code from Subscription Status)Required

State values for FHIR Subscriptions.

SubscriptionStatus.type SubscriptionNotificationType Required

The type of notification represented by the status message.

SubscriptionStatus.error SubscriptionErrorCodes Example

Codes to represent subscription error details

UniqueKeyLevelLocationDescriptionExpression
img sst-1Rule (base)Event notifications must contain events(type = 'event-notification' or type = 'query-event') implies notificationEvent.exists()
img sst-2Rule (base)Status messages must contain statustype = 'query-status' implies status.exists()

This resource is used to communicate information about a Subscription and the events represented by a notification bundle. The process of sending a notification (e.g., a notification this status is included with) can change the status of that subscription. Servers SHALL populate elements with the most recent information at the time of generation (e.g., when a notification is created) and receivers SHOULD be aware that this information might not be current at the time a notification is processed (e.g., a subscription was active but has subsequently moved to an error state).

Subscription notifications MAY contain PHI. Applications are responsible for following FHIR security guidance and compliance with relevant security requirements (e.g., corporate policy, government regulation, etc.). Hinting for the allowed amount of PHI is available in the relevant Subscription resource, via the channel and payload information.

Since Subscription Topic definitions contain human-readable descriptions and definitions, the purpose of a topic may be understood by viewing the resource. Given that canonical links to topics are intended to be resolvable and/or searchable (e.g., indexed in a registry), it is assumed that anyone with a link to a topic also knows what that topic is about. Thus, topics MAY be considered PHI and SHOULD be reviewed before inclusion in a notification.

Hinting about when a canonical topic URL may be included with a notification can be derived from a subscription's payload level. E.g.:

  • empty: SHOULD NOT be present
  • id-only: MAY be present
  • full-resource: SHOULD be present

Since this specification does not currently define any channel types that guarantee client receipt of notifications, a monotonically-increasing event number is critical to detecting several classes of delivery errors (more information is available at Detecting Delivery Errors). However, with the availability of custom-defined channels, notifications can be sent across channels that provide guaranteed delivery (e.g., a message queue), which removes the need for global tracking of event numbers.

For channels that do not need event numbers, it is still desireable for clients to have an index for the events present in a notification. In all cases, a value for SubscriptionStatus.notificationEvent.eventNumber is required - either the number in-sequence based on the total number of events on a subscription or a notification-bundle relative index (e.g., 1, 2, 3, etc.).

ElementDelivery TypeOptionalityNotes
SubscriptionStatus.eventsSinceSubscriptionStartBest EffortRequiredServers SHALL include this value when sending event notifications in order to allow clients to detect missing events.
This value is inclusive of this notification (e.g., the first event notification sent would include one (1) in this element).
SubscriptionStatus.eventsSinceSubscriptionStartGuaranteedOptionalServers MAY include this value when sending event notifications.
SubscriptionStatus.notificationEvent.eventNumberBest EffortRequiredEvent numbers SHALL match the index in the subscription event sequence. E.g., the highest-numbered event in the notification will match the number in eventsSinceSubscriptionStart.
SubscriptionStatus.notificationEvent.eventNumberGuaranteedRequiredA relative index of events in a single notification, e.g., 1, 2, 3, etc..

This specification describes five distinct outbound notification types: Event, Handshake, Heartbeat, Query Status, and Query Event. For each, the notification body is a subscription-notification Bundle with a SubscriptionStatus resource used to convey Subscription and notification details.

The primary notification bundle type is a notification about an event.

ElementOptionalityNotes
SubscriptionStatus.statusRecommendedCurrent status of the relevant subscription (e.g., active).
SubscriptionStatus.typeRequiredSHALL be event-notification
SubscriptionStatus.eventsSinceSubscriptionStartSpecialRequired for subscriptions with best-effort delivery, optional for subscriptions with guaranteed delivery. See Event Numbering for details.
SubscriptionStatus.notificationEventRequiredFor notifications that include events, this element SHALL be present. Details about specific elements within this structure are included in this table.
SubscriptionStatus.notificationEvent.eventNumberSpecialRequired for subscriptions with best-effort delivery, optional for subscriptions with guaranteed delivery. See Event Numbering for details.
SubscriptionStatus.notificationEvent.timestampRecommendedSo that clients can discover when an event actually occurred, timestamp is recommended.
SubscriptionStatus.notificationEvent.focusSpecialLinks contained in the focus element contain resource IDs, so will or will not be present based on the payload level relevant to the notification:
  • empty: SHALL NOT be present
  • id-only: SHALL be present
  • full-resource: SHALL be present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.notificationEvent.additionalContextSpecialLinks contained in the additionalContext element contain resource IDs and MAY or MAY not exist. Presence is determined based on the payload level relevant to the notification, if they are available:
  • empty: SHALL NOT be present
  • id-only: SHOULD be present
  • full-resource: SHOULD be present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.topicOptionalSee Content and PHI.

When a connection to an Endpoint is established or re-established, a server MAY send a Handshake notification to the endpoint.

The client expectations upon receipt of a Handshake notification differ for each channel type (e.g., for the rest-hook channel type, a client endpoint responds to event notifications with standard HTTP response codes).

ElementOptionalityNotes
SubscriptionStatus.statusRecommendedCurrent status of the relevant subscription (e.g., active).
SubscriptionStatus.typeRequiredSHALL be handshake
SubscriptionStatus.eventsSinceSubscriptionStartOptionalFor a new Subscription, if this value is present it SHALL be zero (0).
A sender MAY send a handshake with a non-zero number of events, for example as process for re-establishing communication after an error state.
Note: this value SHALL NOT be incremented by sending a handshake notification.
SubscriptionStatus.notificationEventSpecialA server MAY include historical events for a client with a handshake, if any exist. For example, during a reconnection process, a server MAY opt to include all events since the last successful transmission to the client. Details about specific elements within this structure are included in this table.
SubscriptionStatus.notificationEvent.eventNumberSpecialRequired for subscriptions with best-effort delivery, optional for subscriptions with guaranteed delivery. See Event Numbering for details.
SubscriptionStatus.notificationEvent.timestampSpecialIf a server is including prior events, timestamp is recommended, so that clients can process historical events with proper context.
SubscriptionStatus.notificationEvent.focusSpecialLinks contained in the focus element contain resource IDs, so will or will not be present based on the payload level relevant to the notification:
  • empty: SHALL NOT be present
  • id-only: SHALL be present if a notificationEvent is included
  • full-resource: SHALL be present if a notificationEvent is present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.notificationEvent.additionalContextSpecialLinks contained in the additionalContext element contain resource IDs and MAY or MAY not exist. Presence is determined based on the payload level relevant to the notification, if they are available:
  • empty: SHALL NOT be present
  • id-only: SHOULD be present if a notificationEvent is present
  • full-resource: SHOULD be present if a notificationEvent is present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.topicOptionalSee Content and PHI.

The client is not expected to take any special action in receipt of a Handshake notification beyond the channel-specific requirement for receiving an event notification.

A heartbeat notification is a subscription-notification Bundle of type heartbeat sent without incrementing the subscription event count, though servers MAY include the most recent event in the notification. For servers, heartbeat notifications allow systems to ensure that the connection is still alive and valid. For clients, heartbeat notifications serve as a method to detect errors in communication. Note that a client is not required to take any action in receipt of a heartbeat beyond the channel-specific requirement for receiving an event notification (e.g., accepting the notification bundle with an HTTP 200).

Heartbeat intervals are negotiated while creating a Subscription. If accepted, servers SHOULD send one heartbeat per interval on the accepted subscription.

ElementOptionalityNotes
SubscriptionStatus.statusRecommendedCurrent status of the relevant subscription (e.g., active).
SubscriptionStatus.typeRequiredSHALL be heartbeat
SubscriptionStatus.eventsSinceSubscriptionStartRecommendedThe presence of this value allows clients to detect missing notifications. Recommended for subscriptions with best-effort delivery, optional for subscriptions with guaranteed delivery.
Note: this value SHALL NOT be incremented by sending a heartbeat notification.
SubscriptionStatus.notificationEventSpecialA server MAY include historical events for a client with a heartbeat, if any exist. For example, a server MAY opt to include the most recent event since the last successful transmission to the client. Details about specific elements within this structure are included in this table.
SubscriptionStatus.notificationEvent.eventNumberSpecialIf a server is including any prior events, this element is required for subscriptions with best-effort delivery and optional for subscriptions with guaranteed delivery. See Event Numbering for details.
SubscriptionStatus.notificationEvent.timestampSpecialIf a server is including any prior events, timestamp is recommended, so that clients can process historical events with proper context.
SubscriptionStatus.notificationEvent.focusSpecialLinks contained in the focus element contain resource IDs, so will or will not be present based on the payload level relevant to the notification:
  • empty: SHALL NOT be present
  • id-only: SHALL be present if a notificationEvent is included
  • full-resource: SHALL be present if a notificationEvent is present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.notificationEvent.additionalContextSpecialLinks contained in the additionalContext element contain resource IDs and MAY or MAY not exist. Presence is determined based on the payload level relevant to the notification, if they are available:
  • empty: SHALL NOT be present
  • id-only: SHOULD be present if a notificationEvent is present
  • full-resource: SHOULD be present if a notificationEvent is present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.topicOptionalSee Content and PHI.

Clients can ask a server at any time for the current status of a Subscription, for example via the $status operation.

Since the $status operation is part of the FHIR REST API, the guidance below assumes that a user has been authenticated and is allowed access to all relevant resources.

ElementOptionalityNotes
SubscriptionStatus.statusRequiredCurrent status of the relevant subscription (e.g., active).
SubscriptionStatus.typeRequiredSHALL be query-status
SubscriptionStatus.eventsSinceSubscriptionStartSpecialRequired for subscriptions with best-effort delivery, optional for subscriptions with guaranteed delivery. See Event Numbering for details.
Note: this value SHALL NOT be incremented by sending a query-status notification.
SubscriptionStatus.notificationEventSpecialA query-status notification MAY contain recent notifications.
SubscriptionStatus.topicRecommendedSee Content and PHI, but note that guidance will vary since there is an active user session.

Some servers may allow clients to ask for events which have already occurred, for example via the $events operation.

Since the $events operation is part of the FHIR REST API, the guidance below assumes that a user has been authenticated and the server has filtered any results according to what the user is allowed access.

ElementOptionalityNotes
SubscriptionStatus.statusRecommendedCurrent status of the relevant subscription (e.g., active).
SubscriptionStatus.typeRequiredSHALL be query-event.
SubscriptionStatus.eventsSinceSubscriptionStartRecommendedThis value is allows clients to know if they are missing notifications. Recommended for subscriptions with best-effort delivery and optional for subscriptions with guaranteed delivery.
Note: this value SHALL NOT be incremented by sending a query-event bundle.
See Event Numbering for more information.
SubscriptionStatus.notificationEventRequiredFor notifications that include events, this element SHALL be present. Details about specific elements within this structure are included in this table.
SubscriptionStatus.notificationEvent.eventNumberSpecialRequired for subscriptions with best-effort delivery, optional for subscriptions with guaranteed delivery. See Event Numbering for details.
SubscriptionStatus.notificationEvent.timestampRecommendedSo that clients can discover when an event actually occurred, timestamp is recommended.
SubscriptionStatus.notificationEvent.focusSpecialLinks contained in the focus element contain resource IDs, so will or will not be present based on the payload level relevant to the notification:
  • empty: SHALL NOT be present
  • id-only: SHALL be present
  • full-resource: SHALL be present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.notificationEvent.additionalContextSpecialLinks contained in the additionalContext element contain resource IDs and MAY or MAY not exist. Presence is determined based on the payload level relevant to the notification, if they are available:
  • empty: SHALL NOT be present
  • id-only: SHOULD be present
  • full-resource: SHOULD be present
Note that servers SHOULD include the Reference.type element if if the type is not specified in Reference.reference
SubscriptionStatus.topicRecommendedSee Content and PHI, but note that guidance will vary since there is an active user session.

The SubscriptionStatus resource is key in detecting various errors in communication and processing. For more information, see Managing Subscriptions and Errors in the Subscriptions Framework page.

Search parameters for this resource. See also the full list of search parameters for this resource, and check the Extensions registry for search parameters on extensions related to this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services.

(No search parameters for this resource)