<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="a372e3bb-43b8-4379-9a6b-538f4bac6117" />
  <url value="https://health.gov.on.ca/sadie/fhir/StructureDefinition/OutgoingEmail" />
  <version value="1.0.0" />
  <name value="OutgoingToRequestor" />
  <title value="OutgoingToRequestor" />
  <status value="active" />
  <description value="This profile is for all use cases involving outgoing messages to the Requestor.   &#xA;This includes email alerts to the Requestor and Delegates regarding a request." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Communication" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Communication" />
  <derivation value="constraint" />
  <differential>
    <element id="Communication">
      <path value="Communication" />
      <comment value="#### **_`FOR SADIE USE:  This is for outgoing messages, it needs:`_**&#xA;&#xA;- a status, which is sent to completed once it is mailed&#xA;- a priority which is always = routine&#xA;- medium which is always set to the code for email&#xA;- about which is either a questionnaireResponse or serviceRequest&#xA;- recipient(s) which are Practioners or PractitionorRoles&#xA;- payload which is the message" />
    </element>
    <element id="Communication.identifier">
      <path value="Communication.identifier" />
      <max value="0" />
    </element>
    <element id="Communication.instantiatesCanonical">
      <path value="Communication.instantiatesCanonical" />
      <max value="0" />
    </element>
    <element id="Communication.instantiatesUri">
      <path value="Communication.instantiatesUri" />
      <max value="0" />
    </element>
    <element id="Communication.basedOn">
      <path value="Communication.basedOn" />
      <max value="0" />
    </element>
    <element id="Communication.partOf">
      <path value="Communication.partOf" />
      <definition value="#### **_` FOR SADIE USE:  This is a reference to the Requestor Role that is the owner of the basedOn Request.  This is used by the security inteceptor.`_**&#xA;&#xA;The type of message conveyed such as alert, notification, reminder, instruction, etc." />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://health.gov.on.ca/sadie/fhir/StructureDefinition/FlexFormsRole" />
      </type>
    </element>
    <element id="Communication.inResponseTo">
      <path value="Communication.inResponseTo" />
      <max value="0" />
    </element>
    <element id="Communication.status">
      <path value="Communication.status" />
      <definition value="The status of the transmission.&#xA;&#xA;#### **_` FOR SADIE USE:  Once the email is sent the status will be set to completed`_**" />
    </element>
    <element id="Communication.statusReason">
      <path value="Communication.statusReason" />
      <max value="0" />
    </element>
    <element id="Communication.category">
      <path value="Communication.category" />
      <definition value="#### **_` FOR SADIE USE:  This will have a fixed value of OUTGOING_EMAIL`_**&#xA;&#xA;The type of message conveyed such as alert, notification, reminder, instruction, etc." />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="example" />
        <valueSet value="http://health.gov.on.ca/sadie/fhir/ValueSet/FlexForms-CommunicationTypes" />
      </binding>
    </element>
    <element id="Communication.category.coding">
      <path value="Communication.category.coding" />
      <max value="0" />
    </element>
    <element id="Communication.category.coding.system">
      <path value="Communication.category.coding.system" />
      <max value="0" />
    </element>
    <element id="Communication.category.coding.version">
      <path value="Communication.category.coding.version" />
      <max value="0" />
    </element>
    <element id="Communication.category.coding.code">
      <path value="Communication.category.coding.code" />
      <definition value="#### **_` FOR SADIE USE:  This will have a fixed value of OUTGOING_EMAIL`_**&#xA;&#xA;A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)." />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="http://health.gov.on.ca/sadie/fhir/ValueSet/FlexForms-CommunicationTypes" />
      </binding>
    </element>
    <element id="Communication.category.coding.display">
      <path value="Communication.category.coding.display" />
      <max value="0" />
    </element>
    <element id="Communication.category.coding.userSelected">
      <path value="Communication.category.coding.userSelected" />
      <max value="0" />
    </element>
    <element id="Communication.category.text">
      <path value="Communication.category.text" />
      <max value="0" />
    </element>
    <element id="Communication.priority">
      <path value="Communication.priority" />
      <definition value="Characterizes how quickly the planned or in progress communication must be addressed. Includes concepts such as stat, urgent, routine.&#xA;&#xA;&#xA;#### **_` FOR SADIE USE:  This will have a fixed value of routine`_**" />
      <min value="1" />
      <fixedCode value="routine" />
    </element>
    <element id="Communication.medium">
      <path value="Communication.medium" />
      <definition value="#### **_` FOR SADIE USE:  This will have a fixed value of EMAILWRIT = email`_**&#xA;&#xA;A channel that was used for this communication (e.g. email, fax)." />
      <min value="1" />
      <max value="1" />
      <fixedCodeableConcept>
        <text value="EMAILWRIT" />
      </fixedCodeableConcept>
      <binding>
        <strength value="required" />
      </binding>
    </element>
    <element id="Communication.subject">
      <path value="Communication.subject" />
      <definition value="The patient or group that was the focus of this communication" />
      <max value="0" />
    </element>
    <element id="Communication.topic">
      <path value="Communication.topic" />
      <max value="0" />
    </element>
    <element id="Communication.about">
      <path value="Communication.about" />
      <definition value="Other resources that pertain to this communication and to which this communication should be associated.&#xA;&#xA;#### **_`FOR SADIE USE:  This will be a reference to a QuestionniareResponse or ServiceRequest`_**" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/ServiceRequest" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" />
      </type>
    </element>
    <element id="Communication.encounter">
      <path value="Communication.encounter" />
      <max value="0" />
    </element>
    <element id="Communication.sent">
      <path value="Communication.sent" />
      <definition value="The time when this communication was sent.&#xA;&#xA;#### **_` FOR SADIE USE:  When it was posted to kafka`_**" />
    </element>
    <element id="Communication.received">
      <path value="Communication.received" />
      <max value="0" />
    </element>
    <element id="Communication.recipient">
      <path value="Communication.recipient" />
      <definition value="#### **_`FOR SADIE USE:  These are the Requestor and their team members.  One email can have many recipients.  All the recipients are Practitioners or Practitionrer roles`_**&#xA;&#xA;The entity (e.g. person, organization, clinical information system, care team or device) which was the target of the communication. If receipts need to be tracked by an individual, a separate resource instance will need to be created for each recipient.  Multiple recipient communications are intended where either receipts are not tracked (e.g. a mass mail-out) or a receipt is captured in aggregate (all emails confirmed received by a particular time)." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
      </type>
    </element>
    <element id="Communication.sender">
      <path value="Communication.sender" />
      <max value="0" />
    </element>
    <element id="Communication.reasonCode">
      <path value="Communication.reasonCode" />
      <max value="0" />
    </element>
    <element id="Communication.reasonReference">
      <path value="Communication.reasonReference" />
      <max value="0" />
    </element>
    <element id="Communication.payload">
      <path value="Communication.payload" />
      <definition value="Text, attachment(s), or resource(s) that was communicated to the recipient.&#xA;&#xA;#### **_`FOR SADIE USE:  The email contents will be in the ContentString and ContentAttachment`_**" />
      <min value="1" />
    </element>
    <element id="Communication.note">
      <path value="Communication.note" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>