<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="SubscriptionStatus" />
  <meta>
    <lastUpdated value="2021-01-02T08:58:31.578+11:00" />
  </meta>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-category">
    <valueString value="Foundation.Other" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="trial-use" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="0" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category">
    <valueCode value="business" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="fhir" />
  </extension>
  <extension url="http://hl7.org/fhir/build/StructureDefinition/entered-in-error-status">
    <valueCode value=".status = entered-in-error" />
  </extension>
  <url value="http://hl7.org/fhir/StructureDefinition/SubscriptionStatus" />
  <version value="4.6.0" />
  <name value="SubscriptionStatus" />
  <status value="draft" />
  <date value="2021-01-02T08:58:31+11:00" />
  <publisher value="Health Level Seven International (FHIR Infrastructure)" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://hl7.org/fhir" />
    </telecom>
  </contact>
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://www.hl7.org/Special/committees/fiwg/index.cfm" />
    </telecom>
  </contact>
  <description value="The SubscriptionStatus resource describes the state of a Subscription during notifications." />
  <fhirVersion value="4.6.0" />
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="SubscriptionStatus" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
  <derivation value="specialization" />
  <differential>
    <element id="SubscriptionStatus">
      <path value="SubscriptionStatus" />
      <short value="Status information about a Subscription provided during event notification" />
      <definition value="The SubscriptionStatus resource describes the state of a Subscription during notifications." />
      <min value="0" />
      <max value="*" />
      <constraint>
        <key value="sst-1" />
        <severity value="error" />
        <human value="events listed in event notifications" />
        <expression value="type = 'event-notification' implies (notificationEvent.exists() and notificationEvent.first().exists())" />
        <xpath value="not(f:type/@value='event-notification') or exists(f:notificationEvent[1])" />
        <source value="http://hl7.org/fhir/StructureDefinition/SubscriptionStatus" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="infrastructure.exchange" />
      </mapping>
    </element>
    <element id="SubscriptionStatus.status">
      <path value="SubscriptionStatus.status" />
      <short value="requested | active | error | off | entered-in-error" />
      <definition value="The status of the subscription, which marks the server state for managing the subscription." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <isSummary value="true" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="SubscriptionStatus" />
        </extension>
        <strength value="required" />
        <description value="The status of a subscription at the time this notification was generated." />
        <valueSet value="http://hl7.org/fhir/ValueSet/subscription-status" />
      </binding>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.status" />
      </mapping>
    </element>
    <element id="SubscriptionStatus.type">
      <path value="SubscriptionStatus.type" />
      <short value="handshake | heartbeat | event-notification | query-status | query-event" />
      <definition value="The type of event being conveyed with this notificaiton." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <isModifier value="true" />
      <isModifierReason value="Not known why this is labelled a modifier" />
      <isSummary value="true" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="SubscriptionNotificationType" />
        </extension>
        <strength value="required" />
        <description value="The type of notification represented by the status message." />
        <valueSet value="http://hl7.org/fhir/ValueSet/subscription-notification-type" />
      </binding>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.what[x]" />
      </mapping>
    </element>
    <element id="SubscriptionStatus.eventsSinceSubscriptionStart">
      <path value="SubscriptionStatus.eventsSinceSubscriptionStart" />
      <short value="Events since the Subscription was created" />
      <definition value="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 value="0" />
      <max value="1" />
      <type>
        <code value="integer64" />
      </type>
      <isSummary value="true" />
    </element>
    <element id="SubscriptionStatus.notificationEvent">
      <path value="SubscriptionStatus.notificationEvent" />
      <short value="Detailed information about any events relevant to this notification" />
      <definition value="Detailed information about events relevant to this subscription notification." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="SubscriptionStatus.notificationEvent.eventNumber">
      <path value="SubscriptionStatus.notificationEvent.eventNumber" />
      <short value="Event number" />
      <definition value="The sequential number of this event in this subscription context." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="integer64" />
      </type>
    </element>
    <element id="SubscriptionStatus.notificationEvent.timestamp">
      <path value="SubscriptionStatus.notificationEvent.timestamp" />
      <short value="The instant this event occurred" />
      <definition value="The actual time this event occured on the server." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="instant" />
      </type>
    </element>
    <element id="SubscriptionStatus.notificationEvent.focus">
      <path value="SubscriptionStatus.notificationEvent.focus" />
      <short value="The focus of this event" />
      <definition value="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 value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
    </element>
    <element id="SubscriptionStatus.notificationEvent.additionalContext">
      <path value="SubscriptionStatus.notificationEvent.additionalContext" />
      <short value="Additional context for this event" />
      <definition value="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 value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
    </element>
    <element id="SubscriptionStatus.subscription">
      <path value="SubscriptionStatus.subscription" />
      <short value="Reference to the Subscription responsible for this notification" />
      <definition value="The reference to the Subscription which generated this notification." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Subscription" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.why[x]" />
      </mapping>
    </element>
    <element id="SubscriptionStatus.topic">
      <path value="SubscriptionStatus.topic" />
      <short value="Reference to the SubscriptionTopic this notification relates to" />
      <definition value="The reference to the SubscriptionTopic for the Subscription which generated this notification." />
      <comment value="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 value="0" />
      <max value="1" />
      <type>
        <code value="canonical" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/SubscriptionTopic" />
      </type>
      <isSummary value="true" />
    </element>
    <element id="SubscriptionStatus.error">
      <path value="SubscriptionStatus.error" />
      <short value="List of errors on the subscription" />
      <definition value="A record of errors that occurred when the server processed a notification." />
      <comment value="Recommended practice: clear errors when status is updated." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <isSummary value="true" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="SubscriptionError" />
        </extension>
        <strength value="example" />
        <description value="Codes to represent subscription error details." />
        <valueSet value="http://hl7.org/fhir/ValueSet/subscription-error" />
      </binding>
    </element>
  </differential>
</StructureDefinition>