{
  "resourceType": "StructureDefinition",
  "id": "Subscription",
  "meta": {
    "lastUpdated": "2021-01-01T21:58:31.578+00:00"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
      "valueString": "Foundation.Other"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
      "valueCode": "trial-use"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 2
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
      "valueCode": "business"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "fhir"
    },
    {
      "url": "http://hl7.org/fhir/build/StructureDefinition/entered-in-error-status",
      "valueCode": ".status = off (just turn it off, maybe update the error message)"
    }
  ],
  "url": "http://hl7.org/fhir/StructureDefinition/Subscription",
  "version": "4.6.0",
  "name": "Subscription",
  "status": "draft",
  "date": "2021-01-01T21:58:31+00:00",
  "publisher": "Health Level Seven International (FHIR Infrastructure)",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "http://hl7.org/fhir"
        }
      ]
    },
    {
      "telecom": [
        {
          "system": "url",
          "value": "http://www.hl7.org/Special/committees/fiwg/index.cfm"
        }
      ]
    }
  ],
  "description": "The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.",
  "fhirVersion": "4.6.0",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Subscription",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DomainResource",
  "derivation": "specialization",
  "differential": {
    "element": [
      {
        "id": "Subscription",
        "path": "Subscription",
        "short": "Notification about a SubscriptionTopic",
        "definition": "The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.",
        "alias": [
          "WebHook",
          "Hook",
          "Routing Rule"
        ],
        "min": 0,
        "max": "*",
        "mapping": [
          {
            "identity": "rim",
            "map": "N/A"
          },
          {
            "identity": "w5",
            "map": "infrastructure.exchange"
          }
        ]
      },
      {
        "id": "Subscription.identifier",
        "path": "Subscription.identifier",
        "short": "Additional identifiers (business identifier)",
        "definition": "A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "isSummary": true,
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.identifier"
          }
        ]
      },
      {
        "id": "Subscription.name",
        "path": "Subscription.name",
        "short": "Human readable name for this subscription",
        "definition": "A natural language name identifying the subscription.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.status",
        "path": "Subscription.status",
        "short": "requested | active | error | off | entered-in-error",
        "definition": "The status of the subscription, which marks the server state for managing the subscription.",
        "comment": "A client can only submit subscription resources in the requested or off state. Only the server can  move a subscription from requested to active, and then to error. Either the server or the client can turn a subscription off.\n\nThis element is labeled as a modifier because the status contains codes that mark the resource as not currently valid.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "isModifier": true,
        "isModifierReason": "This element is labelled as a modifier because it is a status element that contains status entered-in-error which means that the resource should not be treated as valid",
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionStatusCodes"
            }
          ],
          "strength": "required",
          "description": "The status of a subscription.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-status"
        },
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.status"
          }
        ]
      },
      {
        "id": "Subscription.topic",
        "path": "Subscription.topic",
        "short": "Reference to the subscription topic being subscribed to",
        "definition": "The reference to the subscription topic to be notified about.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "canonical",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/SubscriptionTopic"
            ]
          }
        ],
        "isSummary": true,
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.what[x]"
          }
        ]
      },
      {
        "id": "Subscription.contact",
        "path": "Subscription.contact",
        "short": "Contact details for source (e.g. troubleshooting)",
        "definition": "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "ContactPoint"
          }
        ],
        "isSummary": true,
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.subject[x]"
          },
          {
            "identity": "w5",
            "map": "FiveWs.subject"
          }
        ]
      },
      {
        "id": "Subscription.end",
        "path": "Subscription.end",
        "short": "When to automatically delete the subscription",
        "definition": "The time for the server to turn the subscription off.",
        "comment": "The server is permitted to deviate from this time but should observe it.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "instant"
          }
        ],
        "isSummary": true,
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.done[x]"
          }
        ]
      },
      {
        "id": "Subscription.reason",
        "path": "Subscription.reason",
        "short": "Description of why this subscription was created",
        "definition": "A description of why this subscription is defined.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isSummary": true,
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.why[x]"
          }
        ]
      },
      {
        "id": "Subscription.filterBy",
        "path": "Subscription.filterBy",
        "short": "Criteria for narrowing the subscription topic stream",
        "definition": "The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions are met; otherwise it returns false.   (i.e., logical AND).",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "BackboneElement"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.filterBy.resourceType",
        "path": "Subscription.filterBy.resourceType",
        "short": "Allowed Data type or Resource (reference to definition) for this Subscription",
        "definition": "If the element is a reference to another resource, this element contains \"Reference\", and the targetProfile element defines what resources can be referenced. The targetProfile may be a reference to the general definition of a resource (e.g. http://hl7.org/fhir/StructureDefinition/Patient).",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "uri"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "FHIRDefinedTypeExt"
            }
          ],
          "strength": "extensible",
          "description": "Either a resource or a data type, including logical model types.",
          "valueSet": "http://hl7.org/fhir/ValueSet/defined-types"
        }
      },
      {
        "id": "Subscription.filterBy.filterParameter",
        "path": "Subscription.filterBy.filterParameter",
        "short": "Filter label defined in SubscriptionTopic",
        "definition": "The filter label (=key) as defined in the `SubscriptionTopic.canfilterBy.filterParameter`  element.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.filterBy.modifier",
        "path": "Subscription.filterBy.modifier",
        "short": "= | eq | ne | gt | lt | ge | le | sa | eb | ap | above | below | in | not-in | of-type",
        "definition": "Operator to apply when determining matches (Search Modifiers), from the list of allowed modifiers for this filter in the relevant SubscriptionTopic.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionFilterBySearchModifier"
            }
          ],
          "strength": "required",
          "description": "Operator to apply to filter label.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-search-modifier"
        }
      },
      {
        "id": "Subscription.filterBy.value",
        "path": "Subscription.filterBy.value",
        "short": "Literal value or resource path",
        "definition": "The literal value or resource path as is legal in search - for example, \"Patient/123\" or \"le1950\".",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.channelType",
        "path": "Subscription.channelType",
        "short": "Channel type for notifications",
        "definition": "The type of channel to send notifications on.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Coding"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionChannelType"
            }
          ],
          "strength": "extensible",
          "description": "The type of method used to execute a subscription.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-channel-type"
        }
      },
      {
        "id": "Subscription.endpoint",
        "path": "Subscription.endpoint",
        "short": "Where the channel points to",
        "definition": "The url that describes the actual end-point to send messages to.",
        "comment": "For rest-hook the end-point must be an http: or https: URL; for websocket ws: or wss:; for email, a mailto: url; and for message the endpoint can be in any form of url the server understands (usually, http/s: or mllp:). The URI is allowed to be relative; in which case, it is relative to the server end-point (since there may be more than one, clients should avoid using relative URIs).",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "url"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.header",
        "path": "Subscription.header",
        "short": "Usage depends on the channel type",
        "definition": "Additional headers / information to send as part of the notification.",
        "comment": "Exactly what these mean depend on the channel type. They 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.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "string"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.heartbeatPeriod",
        "path": "Subscription.heartbeatPeriod",
        "short": "Interval in seconds to send 'heartbeat' notification",
        "definition": "If present,  a 'hearbeat\" notification (keepalive) is sent via this channel with an the interval period equal to this elements integer value in seconds.    If not present, a heartbeat notification is not sent.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "unsignedInt"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.timeout",
        "path": "Subscription.timeout",
        "short": "Timeout in seconds to attempt notification delivery",
        "definition": "If present, the maximum amount of time a server will allow before failing a notification attempt.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "unsignedInt"
          }
        ],
        "isSummary": true
      },
      {
        "id": "Subscription.contentType",
        "path": "Subscription.contentType",
        "short": "MIME type to send, or omit for no payload",
        "definition": "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. The MIME types \"text/plain\" and \"text/html\" may also be used for Email subscriptions.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "MimeType"
            },
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding",
              "valueBoolean": true
            },
            {
              "url": "http://hl7.org/fhir/build/StructureDefinition/definition",
              "valueString": "The mime type of an attachment. Any valid mime type is allowed."
            }
          ],
          "strength": "required",
          "description": "BCP 13 (RFCs 2045, 2046, 2047, 4288, 4289 and 2049)",
          "valueSet": "http://hl7.org/fhir/ValueSet/mimetypes"
        }
      },
      {
        "id": "Subscription.content",
        "path": "Subscription.content",
        "short": "empty | id-only | full-resource",
        "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": 0,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionPayloadContent"
            }
          ],
          "strength": "required",
          "description": "Codes to represent how much resource content to send in the notification payload.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-payload-content"
        }
      },
      {
        "id": "Subscription.maxCount",
        "path": "Subscription.maxCount",
        "short": "Maximum number of triggering resources included in notification bundles",
        "definition": "If present, the maximum number of triggering resources that will be included in a notification bundle (e.g., a server will not include more than this number of trigger resources in a single notification).  Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "positiveInt"
          }
        ],
        "isSummary": true
      }
    ]
  }
}