<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ca-on-eReferral-profile-MessageHeader" />
  <url value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-MessageHeader" />
  <version value="1.2.0" />
  <name value="EReferralMessageHeader" />
  <title value="MessageHeader" />
  <status value="draft" />
  <description value="The header for a message exchange that is either requesting or responding to an action. The reference(s) that are the subject of the action as well as other information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.&#xD;&#xA;To enable sending system insert its own identifiers into API submitted eReferral, and have that returned with subsequent messages, an extension is created on the MessageHeader.identifier element for referral id." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="MessageHeader" />
  <baseDefinition value="http://fhir.infoway-inforoute.ca/io/CA-eReC/StructureDefinition/CA-eReC-MessageHeader" />
  <derivation value="constraint" />
  <differential>
    <element id="MessageHeader.meta">
      <path value="MessageHeader.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.meta.profile">
      <path value="MessageHeader.meta.profile" />
      <comment value="#### **_` FOR eREFERRAL USAGE: The meta.profile = http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-MessageHeader|1.2.0 `_**&#xD;&#xA;&#xD;&#xA;It is up to the server and/or other infrastructure of policy to determine whether/how these claims are verified and/or updated over time.  The list of profile URLs is a set." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.extension:routingOptions">
      <path value="MessageHeader.extension" />
      <sliceName value="routingOptions" />
      <type>
        <code value="Extension" />
        <profile value="http://fhir.infoway-inforoute.ca/io/CA-eReC/StructureDefinition/Routing-Options-EXT" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="MessageHeader.extension:routingOptions.url">
      <path value="MessageHeader.extension.url" />
      <fixedUri value="http://fhir.infoway-inforoute.ca/io/CA-eReC/StructureDefinition/Routing-Options-EXT" />
    </element>
    <element id="MessageHeader.extension:contentType">
      <path value="MessageHeader.extension" />
      <sliceName value="contentType" />
      <type>
        <code value="Extension" />
        <profile value="http://ehealthontario.ca/fhir/StructureDefinition/ext-content-type" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="MessageHeader.extension:contentType.url">
      <path value="MessageHeader.extension.url" />
      <fixedUri value="http://ehealthontario.ca/fhir/StructureDefinition/ext-content-type" />
    </element>
    <element id="MessageHeader.event[x]">
      <path value="MessageHeader.event[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <ordered value="false" />
        <rules value="closed" />
      </slicing>
    </element>
    <element id="MessageHeader.event[x]:eventCoding">
      <path value="MessageHeader.event[x]" />
      <sliceName value="eventCoding" />
      <binding>
        <strength value="extensible" />
        <valueSet value="http://ehealthontario.ca/fhir/ValueSet/message-event-code" />
      </binding>
    </element>
    <element id="MessageHeader.event[x]:eventCoding.system">
      <path value="MessageHeader.event[x].system" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.event[x]:eventCoding.code">
      <path value="MessageHeader.event[x].code" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.event[x]:eventCoding.display">
      <path value="MessageHeader.event[x].display" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.destination">
      <path value="MessageHeader.destination" />
      <min value="1" />
    </element>
    <element id="MessageHeader.destination.name">
      <path value="MessageHeader.destination.name" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.destination.target">
      <path value="MessageHeader.destination.target" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.destination.endpoint.extension:HTTPHeaderDestination">
      <path value="MessageHeader.destination.endpoint.extension" />
      <sliceName value="HTTPHeaderDestination" />
      <type>
        <code value="Extension" />
        <profile value="http://ehealthontario.ca/fhir/StructureDefinition/ext-http-header-destination" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="MessageHeader.destination.receiver">
      <path value="MessageHeader.destination.receiver" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-PractitionerRole" />
        <aggregation value="referenced" />
      </type>
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.author">
      <path value="MessageHeader.author" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-PractitionerRole" />
      </type>
    </element>
    <element id="MessageHeader.source.name">
      <path value="MessageHeader.source.name" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.software">
      <path value="MessageHeader.source.software" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.version">
      <path value="MessageHeader.source.version" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.contact">
      <path value="MessageHeader.source.contact" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.contact.system">
      <path value="MessageHeader.source.contact.system" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.contact.value">
      <path value="MessageHeader.source.contact.value" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.contact.use">
      <path value="MessageHeader.source.contact.use" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.contact.rank">
      <path value="MessageHeader.source.contact.rank" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.source.endpoint.extension:HTTPHeaderSource">
      <path value="MessageHeader.source.endpoint.extension" />
      <sliceName value="HTTPHeaderSource" />
      <type>
        <code value="Extension" />
        <profile value="http://ehealthontario.ca/fhir/StructureDefinition/ext-http-header-source" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="MessageHeader.reason.coding">
      <path value="MessageHeader.reason.coding" />
      <mustSupport value="false" />
    </element>
    <element id="MessageHeader.reason.coding.system">
      <path value="MessageHeader.reason.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.reason.coding.code">
      <path value="MessageHeader.reason.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.reason.coding.display">
      <path value="MessageHeader.reason.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.reason.text">
      <path value="MessageHeader.reason.text" />
      <mustSupport value="true" />
    </element>
    <element id="MessageHeader.focus">
      <path value="MessageHeader.focus" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-ServiceRequest" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-Task" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-Appointment" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-Communication" />
        <aggregation value="referenced" />
      </type>
    </element>
  </differential>
</StructureDefinition>