{
  "resourceType": "StructureDefinition",
  "id": "SubscriptionStatus",
  "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": 0
    },
    {
      "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 = entered-in-error"
    }
  ],
  "url": "http://hl7.org/fhir/StructureDefinition/SubscriptionStatus",
  "version": "4.6.0",
  "name": "SubscriptionStatus",
  "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 SubscriptionStatus resource describes the state of a Subscription during notifications.",
  "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": "SubscriptionStatus",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DomainResource",
  "derivation": "specialization",
  "differential": {
    "element": [
      {
        "id": "SubscriptionStatus",
        "path": "SubscriptionStatus",
        "short": "Status information about a Subscription provided during event notification",
        "definition": "The SubscriptionStatus resource describes the state of a Subscription during notifications.",
        "min": 0,
        "max": "*",
        "constraint": [
          {
            "key": "sst-1",
            "severity": "error",
            "human": "events listed in event notifications",
            "expression": "type = 'event-notification' implies (notificationEvent.exists() and notificationEvent.first().exists())",
            "xpath": "not(f:type/@value='event-notification') or exists(f:notificationEvent[1])",
            "source": "http://hl7.org/fhir/StructureDefinition/SubscriptionStatus"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "N/A"
          },
          {
            "identity": "w5",
            "map": "infrastructure.exchange"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.status",
        "path": "SubscriptionStatus.status",
        "short": "requested | active | error | off | entered-in-error",
        "definition": "The status of the subscription, which marks the server state for managing the subscription.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionStatus"
            }
          ],
          "strength": "required",
          "description": "The status of a subscription at the time this notification was generated.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-status"
        },
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.status"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.type",
        "path": "SubscriptionStatus.type",
        "short": "handshake | heartbeat | event-notification | query-status | query-event",
        "definition": "The type of event being conveyed with this notificaiton.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ],
        "isModifier": true,
        "isModifierReason": "Not known why this is labelled a modifier",
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionNotificationType"
            }
          ],
          "strength": "required",
          "description": "The type of notification represented by the status message.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-notification-type"
        },
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.what[x]"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.eventsSinceSubscriptionStart",
        "path": "SubscriptionStatus.eventsSinceSubscriptionStart",
        "short": "Events since the Subscription was created",
        "definition": "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 notifications.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "integer64"
          }
        ],
        "isSummary": true
      },
      {
        "id": "SubscriptionStatus.notificationEvent",
        "path": "SubscriptionStatus.notificationEvent",
        "short": "Detailed information about any events relevant to this notification",
        "definition": "Detailed information about events relevant to this subscription notification.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "BackboneElement"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.notificationEvent.eventNumber",
        "path": "SubscriptionStatus.notificationEvent.eventNumber",
        "short": "Event number",
        "definition": "The sequential number of this event in this subscription context.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "integer64"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.notificationEvent.timestamp",
        "path": "SubscriptionStatus.notificationEvent.timestamp",
        "short": "The instant this event occurred",
        "definition": "The actual time this event occured on the server.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "instant"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.notificationEvent.focus",
        "path": "SubscriptionStatus.notificationEvent.focus",
        "short": "The focus of this event",
        "definition": "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 object.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Resource"
            ]
          }
        ]
      },
      {
        "id": "SubscriptionStatus.notificationEvent.additionalContext",
        "path": "SubscriptionStatus.notificationEvent.additionalContext",
        "short": "Additional context for this event",
        "definition": "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 objects.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Resource"
            ]
          }
        ]
      },
      {
        "id": "SubscriptionStatus.subscription",
        "path": "SubscriptionStatus.subscription",
        "short": "Reference to the Subscription responsible for this notification",
        "definition": "The reference to the Subscription which generated this notification.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Subscription"
            ]
          }
        ],
        "isSummary": true,
        "mapping": [
          {
            "identity": "w5",
            "map": "FiveWs.why[x]"
          }
        ]
      },
      {
        "id": "SubscriptionStatus.topic",
        "path": "SubscriptionStatus.topic",
        "short": "Reference to the SubscriptionTopic this notification relates to",
        "definition": "The reference to the SubscriptionTopic for the Subscription which generated this notification.",
        "comment": "This value SHOULD NOT be present when using `empty` payloads, MAY be present when using `id-only` payloads, and SHOULD be present when using `full-resource` payloads.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "canonical",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/SubscriptionTopic"
            ]
          }
        ],
        "isSummary": true
      },
      {
        "id": "SubscriptionStatus.error",
        "path": "SubscriptionStatus.error",
        "short": "List of errors on the subscription",
        "definition": "A record of errors that occurred when the server processed a notification.",
        "comment": "Recommended practice: clear errors when status is updated.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "isSummary": true,
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubscriptionError"
            }
          ],
          "strength": "example",
          "description": "Codes to represent subscription error details.",
          "valueSet": "http://hl7.org/fhir/ValueSet/subscription-error"
        }
      }
    ]
  }
}