<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Profile-Communication-External" />
  <url value="https://health.gov.on.ca/idms/fhir/StructureDefinition/Communication-External" />
  <version value="1.0.0" />
  <name value="ClientCommunication" />
  <title value="Communication External" />
  <status value="active" />
  <description value="Communications between the IDMS system and the External Companies." />
  <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" />
      <definition value="#### **_`IDMS:  This is used to record data exchanges between IDMS and Client Systems.  This includes sending submission data and the client sending status updates and files`_**&#xA;&#xA;&#xA;An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public health agency that was notified about a reportable condition." />
    </element>
    <element id="Communication.extension">
      <path value="Communication.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="Communication.extension:externalIndicator">
      <path value="Communication.extension" />
      <sliceName value="externalIndicator" />
      <definition value="#### **_`IDMS: Indicates this is was created by external user.`_**" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/Extension-External-Indicator" />
      </type>
    </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" />
      <definition value="#### **_`IDMS:  This is a reference to the Request.`_**&#xA;&#xA;An order, proposal or plan fulfilled in whole or in part by this Communication." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-ServiceRequest-New" />
      </type>
    </element>
    <element id="Communication.partOf">
      <path value="Communication.partOf" />
      <definition value="#### **_`IDMS:  If this is an Additional Information Submission communication this is a reference to that Child Request.`_**" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-ServiceRequest-Child-Submission" />
      </type>
    </element>
    <element id="Communication.inResponseTo">
      <path value="Communication.inResponseTo" />
      <max value="0" />
    </element>
    <element id="Communication.status">
      <path value="Communication.status" />
      <definition value="#### **_`IDMS: Use 'completed' if it was sucessful and 'entered-in-error' for errors.`_**&#xA;&#xA;The status of the transmission." />
    </element>
    <element id="Communication.statusReason">
      <path value="Communication.statusReason" />
      <definition value="#### **_`IDMS: This is the code for the IDMS error message.`_**&#xA;&#xA;The status of the transmission." />
      <max value="0" />
      <binding>
        <strength value="required" />
        <valueSet value="http://health.gov.on.ca/sadie/fhir/ValueSet/FlexForms-ClientCommunication-Errors" />
      </binding>
    </element>
    <element id="Communication.category">
      <path value="Communication.category" />
      <definition value="#### **_`SUBMISSION`_**&#xA; #### **_`code:COMMUNICATION-TYPE-SUBMISSION  ; system:https://health.gov.on.ca/idms/fhir/CodeSystem/IDMS-Internal ; display:Request Submitted  `_**&#xA;&#xA; #### **_`ADDITIONAL INFORMATION`_**&#xA; #### **_`code:  COMMUNICATION-TYPE-ADDITIONAL-INFO; system:https://health.gov.on.ca/idms/fhir/CodeSystem/IDMS-Internal ; display:Additional Information Submitted `_**" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="http://health.gov.on.ca/sadie/fhir/ValueSet/FlexForms-CommunicationTypes" />
      </binding>
    </element>
    <element id="Communication.priority">
      <path value="Communication.priority" />
      <max value="0" />
    </element>
    <element id="Communication.medium">
      <path value="Communication.medium" />
      <max value="0" />
    </element>
    <element id="Communication.subject">
      <path value="Communication.subject" />
      <max value="0" />
    </element>
    <element id="Communication.subject.reference">
      <path value="Communication.subject.reference" />
      <max value="0" />
    </element>
    <element id="Communication.subject.type">
      <path value="Communication.subject.type" />
      <max value="0" />
    </element>
    <element id="Communication.subject.identifier">
      <path value="Communication.subject.identifier" />
      <max value="0" />
    </element>
    <element id="Communication.subject.display">
      <path value="Communication.subject.display" />
      <max value="0" />
    </element>
    <element id="Communication.topic">
      <path value="Communication.topic" />
      <max value="0" />
    </element>
    <element id="Communication.about">
      <path value="Communication.about" />
      <max value="0" />
    </element>
    <element id="Communication.about.reference">
      <path value="Communication.about.reference" />
      <max value="0" />
    </element>
    <element id="Communication.about.type">
      <path value="Communication.about.type" />
      <max value="0" />
    </element>
    <element id="Communication.about.identifier">
      <path value="Communication.about.identifier" />
      <max value="0" />
    </element>
    <element id="Communication.about.display">
      <path value="Communication.about.display" />
      <max value="0" />
    </element>
    <element id="Communication.encounter">
      <path value="Communication.encounter" />
      <max value="0" />
    </element>
    <element id="Communication.sent">
      <path value="Communication.sent" />
      <definition value="#### **_`IDMS:  If DIRECT is doing the sending then this is populated otherwise it is null`_**&#xA;&#xA;The time when this communication was sent." />
    </element>
    <element id="Communication.received">
      <path value="Communication.received" />
      <definition value="#### **_`IDMS:  If DIRECT is doing the receiving then this is populated otherwise it is null`_**&#xA;&#xA;The time when this communication arrived at the destination." />
    </element>
    <element id="Communication.recipient">
      <path value="Communication.recipient" />
      <definition value="#### **_`IDMS:  If DIRECT is doing the sending then the reference will be populated with a reference to the Organization and display will be populated with the Organization Name.   If DIRECT is receiving then the reference is null and the display = DIRECT`_**&#xA;&#xA;&#xA;." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
    </element>
    <element id="Communication.recipient.type">
      <path value="Communication.recipient.type" />
      <max value="0" />
    </element>
    <element id="Communication.recipient.identifier">
      <path value="Communication.recipient.identifier" />
      <max value="0" />
    </element>
    <element id="Communication.sender">
      <path value="Communication.sender" />
      <definition value="#### **_`IDMS:  If DIRECT is doing the receiving then the reference will be populated with a reference to the Organization and display will be populated with the Organization Namee.   If DIRECT is sending then the reference is null and the display = DIRECT`_**" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
    </element>
    <element id="Communication.sender.type">
      <path value="Communication.sender.type" />
      <max value="0" />
    </element>
    <element id="Communication.sender.identifier">
      <path value="Communication.sender.identifier" />
      <max value="0" />
    </element>
    <element id="Communication.reason">
      <path value="Communication.reason" />
      <max value="0" />
    </element>
    <element id="Communication.payload">
      <path value="Communication.payload" />
      <definition value="#### **_`IDMS:  There are two types of payloads, the attachment stored in the BINARY and the attachment stored in SHAREPOINT.`_**" />
    </element>
    <element id="Communication.payload.contentCodeableConcept">
      <path value="Communication.payload.contentCodeableConcept" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment">
      <path value="Communication.payload.contentAttachment" />
    </element>
    <element id="Communication.payload.contentAttachment.extension">
      <path value="Communication.payload.contentAttachment.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Communication.payload.contentAttachment.extension:documentManagmentLocation">
      <path value="Communication.payload.contentAttachment.extension" />
      <sliceName value="documentManagmentLocation" />
      <definition value="#### **_`SHAREPOINT: 'SharePoint'. BINARY: It is not populated.`_**" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/DocumentManagmentLocation" />
      </type>
    </element>
    <element id="Communication.payload.contentAttachment.contentType">
      <path value="Communication.payload.contentAttachment.contentType" />
      <definition value="#### **_`SHAREPOINT and BINARY: 'application/pdf'`_**" />
      <min value="1" />
    </element>
    <element id="Communication.payload.contentAttachment.language">
      <path value="Communication.payload.contentAttachment.language" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.data">
      <path value="Communication.payload.contentAttachment.data" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.url">
      <path value="Communication.payload.contentAttachment.url" />
      <definition value="#### **_`SHAREPOINT: The name of the file. BINARY: The Binary resource id.`_**" />
      <min value="1" />
    </element>
    <element id="Communication.payload.contentAttachment.size">
      <path value="Communication.payload.contentAttachment.size" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.hash">
      <path value="Communication.payload.contentAttachment.hash" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.title">
      <path value="Communication.payload.contentAttachment.title" />
      <definition value="#### **_`SHAREPOINT and BINARY: 'Submission Summary'`_**" />
      <min value="1" />
    </element>
    <element id="Communication.payload.contentAttachment.creation">
      <path value="Communication.payload.contentAttachment.creation" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.height">
      <path value="Communication.payload.contentAttachment.height" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.width">
      <path value="Communication.payload.contentAttachment.width" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.frames">
      <path value="Communication.payload.contentAttachment.frames" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.duration">
      <path value="Communication.payload.contentAttachment.duration" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentAttachment.pages">
      <path value="Communication.payload.contentAttachment.pages" />
      <max value="0" />
    </element>
    <element id="Communication.payload.contentReference">
      <path value="Communication.payload.contentReference" />
      <max value="0" />
    </element>
    <element id="Communication.note">
      <path value="Communication.note" />
      <definition value="#### **_`IDMS:  This is a description of what the client asked to be changed. Example: (Custom Status = 'Processed',   Request Status = 'Completed')  This will appear on the UI under Communication History`_**&#xA;&#xA;Additional notes or commentary about the communication by the sender, receiver or other interested parties." />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>