Profiles & Operations > Profile: Subscription

Profile: Subscription

This profile provides guidance for implementing FHIR R5 Subscription resource features & elements using extensions defined in FHIR R4.

It is used by a Subscriber to request subscription to a specific events and get notification whenever these events are created or updated by the Subscription Service.

In order to align with the use of FHIR R4 at OntarioHealth, Subscriptions are expected to conform to the Subscription profile defined by the Subscriptions R5 Backport Implementation Guide

Simplifier project page: OntarioBackportSubscription

Derived from: Subscription R5 Backport

Formal Views of Profile Content

Description of Profiles, Differentials, Snapshots and how the different presentations work

Differential View

idΣ0..1string
metaΣ0..1Meta
implicitRulesΣ ?!0..1uri
language0..1codeBinding
text0..1Narrative
contained0..*Resource
system-idS C1..1Extension(Identifier)
modifierExtension?! C0..*Extension
statusΣ ?!1..1codeBinding
contactΣ0..*ContactPoint
endΣ0..1instant
reasonΣ1..1string
id0..1string
filterCriteriaS C0..*Extension(string)
value0..1System.String
errorΣ0..1string
id0..1string
notificationRetryPeriodC0..*Extension(Complex)
heartbeatPeriodC0..*Extension(unsignedInt)
timeoutC0..*Extension(unsignedInt)
maxCountC0..*Extension(positiveInt)
modifierExtensionΣ ?! C0..*Extension
id0..1string
customChannelTypeS Σ C0..1Extension(Coding)
value0..1System.String
endpointΣ0..1url
id0..1string
contentS Σ C1..1Extension(code)
value0..1System.String
headerΣ0..*string

Hybrid View

idΣ0..1string
metaΣ0..1Meta
implicitRulesΣ ?!0..1uri
language0..1codeBinding
text0..1Narrative
contained0..*Resource
system-idS C1..1Extension(Identifier)
modifierExtension?! C0..*Extension
statusΣ ?!1..1codeBinding
contactΣ0..*ContactPoint
endΣ0..1instant
reasonΣ1..1string
id0..1string
filterCriteriaS C0..*Extension(string)
value0..1System.String
errorΣ0..1string
id0..1string
notificationRetryPeriodC0..*Extension(Complex)
heartbeatPeriodC0..*Extension(unsignedInt)
timeoutC0..*Extension(unsignedInt)
maxCountC0..*Extension(positiveInt)
modifierExtensionΣ ?! C0..*Extension
id0..1string
customChannelTypeS Σ C0..1Extension(Coding)
value0..1System.String
endpointΣ0..1url
id0..1string
contentS Σ C1..1Extension(code)
value0..1System.String
headerΣ0..*string

Snapshot View

idΣ0..1string
metaΣ0..1Meta
implicitRulesΣ ?!0..1uri
language0..1codeBinding
text0..1Narrative
contained0..*Resource
system-idS C1..1Extension(Identifier)
modifierExtension?! C0..*Extension
statusΣ ?!1..1codeBinding
contactΣ0..*ContactPoint
endΣ0..1instant
reasonΣ1..1string
id0..1string
filterCriteriaS C0..*Extension(string)
value0..1System.String
errorΣ0..1string
id0..1string
notificationRetryPeriodC0..*Extension(Complex)
heartbeatPeriodC0..*Extension(unsignedInt)
timeoutC0..*Extension(unsignedInt)
maxCountC0..*Extension(positiveInt)
modifierExtensionΣ ?! C0..*Extension
id0..1string
customChannelTypeS Σ C0..1Extension(Coding)
value0..1System.String
endpointΣ0..1url
id0..1string
contentS Σ C1..1Extension(code)
value0..1System.String
headerΣ0..*string

Table View

Subscription..
Subscription.extensionExtension0..*
Subscription.extension:systemidExtension1..1
Subscription.criteria..
Subscription.criteria.extension:filterCriteriaExtension..
Subscription.channel..
Subscription.channel.extension:notificationRetryPeriodExtension..
Subscription.channel.extension:heartbeatPeriodExtension..
Subscription.channel.extension:timeoutExtension..
Subscription.channel.extension:maxCountExtension..
Subscription.channel.type..
Subscription.channel.type.extension:customChannelTypeExtension0..1
Subscription.channel.payload1..
Subscription.channel.payload.extension1..
Subscription.channel.payload.extension:contentExtension1..1
Subscription.channel.header..

JSON View

{
"resourceType": "StructureDefinition",
"url": "http://ontariohealth.ca/fhir/pubsub/StructureDefinition/profile-Subscription",
"name": "OntarioBackportSubscription",
"status": "draft",
"fhirVersion": "4.0.1",
"kind": "resource",
"abstract": false,
"type": "Subscription",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Subscription",
"derivation": "constraint",
"element": [
{
"id": "Subscription.extension",
"path": "Subscription.extension",
"slicing": {
{
"type": "value",
"path": "url"
}
],
"ordered": false,
"rules": "open"
},
"short": "Extension",
"definition": "An Extension",
"min": 0,
"max": "*",
"base": {
"path": "DomainResource.extension",
"min": 0,
"max": "*"
},
"type": [
{
"code": "Extension"
}
],
{
"key": "ele-1",
"severity": "error",
"human": "All FHIR elements must have a @value or children",
"expression": "hasValue() or (children().count() > id.count())",
"xpath": "@value|f:*|h:div",
"source": "http://hl7.org/fhir/StructureDefinition/Element"
},
{
"key": "ext-1",
"severity": "error",
"human": "Must have either extensions or value[x], not both",
"expression": "extension.exists() != value.exists()",
"xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
"source": "http://hl7.org/fhir/StructureDefinition/Extension"
}
],
"mustSupport": true,
"isModifier": false,
"isSummary": false
},
{
"id": "Subscription.extension:systemid",
"path": "Subscription.extension",
"sliceName": "system-id",
"short": "Extension Element to store client system ID",
"definition": "This field is designed to hold an Identifier data type for storing a client system ID.",
"min": 1,
"max": "1",
"base": {
"path": "DomainResource.extension",
"min": 0,
"max": "*"
},
"type": [
{
"code": "Extension",
"profile": [
"http://ontariohealth.ca/fhir/pubsub/StructureDefinition/ext-subscriptionIdentifier"
]
}
],
"ele-1"
],
{
"key": "ele-1",
"severity": "error",
"human": "All FHIR elements must have a @value or children unless an empty Parameters resource",
"expression": "hasValue() or (children().count() > id.count()) or $this is Parameters",
"xpath": "@value|f:*|h:div|self::f:Parameters",
"source": "http://hl7.org/fhir/StructureDefinition/Element"
},
{
"key": "ext-1",
"severity": "error",
"human": "Must have either extensions or value[x], not both",
"expression": "extension.exists() != value.exists()",
"xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])",
"source": "http://hl7.org/fhir/StructureDefinition/Extension"
}
],
"mustSupport": true,
"isModifier": false,
"mapping": [
{
"identity": "rim",
"map": "n/a"
},
{
"identity": "rim",
"map": "N/A"
}
]
},
{
"id": "Subscription.criteria",
"path": "Subscription.criteria",
"mustSupport": true
},
{
"id": "Subscription.criteria.extension:filterCriteria",
"path": "Subscription.criteria.extension",
"sliceName": "filterCriteria",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-filter-criteria"
]
}
],
"mustSupport": true,
"isModifier": false
},
{
"id": "Subscription.channel.extension:notificationRetryPeriod",
"path": "Subscription.channel.extension",
"sliceName": "notificationRetryPeriod",
"type": [
{
"code": "Extension",
"profile": [
"http://ontariohealth.ca/fhir/pubsub/StructureDefinition/ext-SubscriptionNotificationRetryPeriod"
]
}
],
"isModifier": false
},
{
"id": "Subscription.channel.extension:heartbeatPeriod",
"path": "Subscription.channel.extension",
"sliceName": "heartbeatPeriod",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-heartbeat-period"
]
}
],
"isModifier": false
},
{
"id": "Subscription.channel.extension:timeout",
"path": "Subscription.channel.extension",
"sliceName": "timeout",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-timeout"
]
}
],
"isModifier": false
},
{
"id": "Subscription.channel.extension:maxCount",
"path": "Subscription.channel.extension",
"sliceName": "maxCount",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-max-count"
]
}
],
"isModifier": false
},
{
"id": "Subscription.channel.type.extension:customChannelType",
"path": "Subscription.channel.type.extension",
"sliceName": "customChannelType",
"short": "Extended channel type for notifications",
"definition": "The type of channel to send notifications on.",
"comment": "This extension allows for the use of additional channel types that were not defined in the FHIR R4 subscription definition.",
"min": 0,
"max": "1",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-channel-type"
]
}
],
"mustSupport": true,
"isSummary": true
},
{
"id": "Subscription.channel.payload",
"path": "Subscription.channel.payload",
"min": 1
},
{
"id": "Subscription.channel.payload.extension",
"path": "Subscription.channel.payload.extension",
"slicing": {
{
"type": "value",
"path": "url"
}
],
"ordered": false,
"rules": "open"
},
"min": 1
},
{
"id": "Subscription.channel.payload.extension:content",
"path": "Subscription.channel.payload.extension",
"sliceName": "content",
"short": "Notification content level",
"definition": "How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.",
"comment": "Sending the payload has obvious security implications. The server is responsible for ensuring that the content is appropriately secured.",
"min": 1,
"max": "1",
"type": [
{
"code": "Extension",
"profile": [
"http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-payload-content"
]
}
],
"mustSupport": true,
"isSummary": true
},
{
"id": "Subscription.channel.header",
"path": "Subscription.channel.header",
"definition": "Use to specify additional information that will be included inside the notification payload when the notification is sent. Each entry consists of a key-value pair. This should support sending client certificates and client keys with validation to determine if it is the certificate itself or just the name.",
"comment": "This can convey additional information to the recipient and/or meet security requirements; for example, support of multiple headers in the outgoing notifications for rest-hook type subscriptions."
}
]
}
}

Usage Notes

.extension:system-id

  • Used to capture the client system ID which will be provided by Ontario Health at onboarding. eg. EMR ID

.status

  • The status of the subscription - requesters should set this value to "requested" when creating a subscrition request

.criteria

  • Used to capture the canonical URL of the SubscriptionTopic

.criteria.extension:filterCriteria

  • Used to apply filter criteria, similar to those used in search strings

channel.extenision:notificationretryperiod

  • Specifies the time interval (duration) that the Subscription service should wait before retrying a failed notification attempt.

.channel.extension:heartbeatPeriod

  • Interval in seconds to send 'heartbeat' notification

.channel.extension:timeout

  • Timeout in seconds to attempt notification delivery

.channel.extension:maxCount

  • Maximum number of triggering resources included in notification bundles

.channel.type

  • allowed values: rest-hook | websocket
  • for rest-hook, must supply bearer certificate for Mutual TLS or authorization header
  • user may use polling of notifications as a recovery mechanism via web socket channel

.channel.endpoint

  • URL endpoint used to deliver subscription notifications, notably URL for rest-hook and websocket.

.channel.type.extension:customeChannelType

  • not used in this implementation

.channel.payload

  • MIME type to be used to transmit the payload

.channel.payload.extension:content

  • used to convey the type of payload requested: empty (no resource content is sent in notifications), id-only (only resource ids are sent in notifications), or full-resource (entire resource is sent in notification)

.channel.header

  • used to specify additional information that will be included inside the notifaction payload when the notification is sent. Each entry consists of a key-value pair. This should support sending client certificates and client keys with validation to determine if it is the certificate itself or just the name.