<?xml version="1.0" encoding="UTF-8"?><SubscriptionTopic xmlns="http://hl7.org/fhir">
  <id value="example"/>
  <meta>
    <security>
      <system value="http://terminology.hl7.org/CodeSystem/v3-ActReason"/>
      <code value="HTEST"/>
      <display value="test health data"/>
    </security>
  </meta>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="fhir"/>
  </extension>
  <url value="http://example.org/FHIR/SubscriptionTopic/example"/>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:uuid:1caa02ba-051b-4602-8856-65921748ae76"/>
  </identifier>
  <version value="1.0.0-beta.1"/>
  <title value="example"/>
  <status value="draft"/>
  <date value="2019-01-01"/>
  <publisher value="HL7 International / FHIR Infrastructure"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/fiwg"/>
    </telecom>
  </contact>
  <description value="Example topic for completed encounters"/>
  <trigger>
    <description value="An Encounter has been completed"/>
    <resource value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
    <supportedInteraction value="update"/>
    <queryCriteria>
      <previous value="status:not=completed"/>
      <resultForCreate value="test-passes"/>
      <current value="status=completed"/>
      <resultForDelete value="test-fails"/>
      <requireBoth value="true"/>
    </queryCriteria>
    <fhirPathCriteria value="(%previous.empty() | (%previous.status != 'completed')) and (%current.status = 'completed')"/>
    <canFilterBy>
      <description value="Filter based on the subject of an encounter."/>
      <resource value="Encounter"/>
      <filterParameter value="subject"/>
    </canFilterBy>
    <canFilterBy>
      <description value="Filter based on the group membership of the subject of an encounter."/>
      <resource value="Encounter"/>
      <filterParameter value="_in"/>
    </canFilterBy>
    <canFilterBy>
      <description value="Filter based on the length of an encounter."/>
      <resource value="Encounter"/>
      <filterParameter value="length"/>
      <comparator value="gt"/>
      <comparator value="lt"/>
      <comparator value="ge"/>
      <comparator value="le"/>
    </canFilterBy>
    <canFilterBy>
      <description value="Filter based on the account for billing an encounter."/>
      <resource value="Encounter"/>
      <filterParameter value="account"/>
      <modifier value="missing"/>
      <modifier value="not"/>
      <modifier value="identifier"/>
    </canFilterBy>
    <notificationShape>
      <resource value="Encounter"/>
      <include value="Encounter:patient&amp;iterate=Patient.link"/>
      <include value="Encounter:practitioner"/>
      <include value="Encounter:service-provider"/>
      <include value="Encounter:account"/>
      <include value="Encounter:diagnosis"/>
      <include value="Encounter:observation"/>
      <include value="Encounter:location"/>
      <relatedQuery>
        <queryType/>
        <query value="Patient?_include:iterate=Patient:link"/>
      </relatedQuery>
      <relatedQuery>
        <queryType>
          <system value="http://example.org/fhir/CodeSystem-patient-queries"/>
          <code value="current-providers"/>
        </queryType>
        <query value="$current-providers"/>
      </relatedQuery>
    </notificationShape>
  </trigger>
</SubscriptionTopic>