<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ca-on-eReferral-profile-DocumentReference" />
  <url value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-DocumentReference" />
  <version value="1.1.0" />
  <name value="EReferralDocumentReference" />
  <title value="DocumentReference" />
  <status value="draft" />
  <description value="A DocumentReference resource is used to index a document, clinical note, and other binary objects to make them available to a healthcare system. A document is some sequence of bytes that is identifiable, establishes its own context (e.g., what subject, author, etc. can be displayed to the user), and has defined update management. The DocumentReference resource can be used with any document format that has a recognized mime type and that conforms to this definition" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="DocumentReference" />
  <baseDefinition value="http://fhir.infoway-inforoute.ca/io/CA-eReC/StructureDefinition/CA-eReC-DocumentReference" />
  <derivation value="constraint" />
  <differential>
    <element id="DocumentReference.meta">
      <path value="DocumentReference.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.meta.profile">
      <path value="DocumentReference.meta.profile" />
      <comment value="#### **_` FOR eREFERRAL USAGE: The meta.profile = http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-DocumentReference|1.1.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="DocumentReference.status">
      <path value="DocumentReference.status" />
      <fixedCode value="current" />
      <binding>
        <strength value="required" />
        <valueSet value="http://hl7.org/fhir/ValueSet/document-reference-status" />
      </binding>
    </element>
    <element id="DocumentReference.docStatus">
      <path value="DocumentReference.docStatus" />
      <binding>
        <strength value="required" />
        <valueSet value="http://hl7.org/fhir/ValueSet/composition-status" />
      </binding>
    </element>
    <element id="DocumentReference.type.coding">
      <path value="DocumentReference.type.coding" />
      <max value="1" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.type.coding.system">
      <path value="DocumentReference.type.coding.system" />
      <min value="1" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.type.coding.code">
      <path value="DocumentReference.type.coding.code" />
      <min value="1" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.type.coding.display">
      <path value="DocumentReference.type.coding.display" />
      <min value="1" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.type.text">
      <path value="DocumentReference.type.text" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.subject">
      <path value="DocumentReference.subject" />
      <comment value="#### **_`FOR EREFERRAL USAGE: The DocumentReference.subject must match the ServiceRequest.subject which is a reference to Patient resource. `_**&#xD;&#xA;&#xD;&#xA;References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-Patient" />
      </type>
    </element>
    <element id="DocumentReference.subject.reference">
      <path value="DocumentReference.subject.reference" />
      <min value="1" />
    </element>
    <element id="DocumentReference.author">
      <path value="DocumentReference.author" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-Practitioner" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-PractitionerRole" />
      </type>
    </element>
    <element id="DocumentReference.author.reference">
      <path value="DocumentReference.author.reference" />
      <min value="1" />
    </element>
    <element id="DocumentReference.relatesTo">
      <path value="DocumentReference.relatesTo" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.relatesTo.code">
      <path value="DocumentReference.relatesTo.code" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.relatesTo.target">
      <path value="DocumentReference.relatesTo.target" />
      <mustSupport value="false" />
    </element>
    <element id="DocumentReference.content">
      <path value="DocumentReference.content" />
      <max value="1" />
    </element>
    <element id="DocumentReference.content.attachment.contentType">
      <path value="DocumentReference.content.attachment.contentType" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.language">
      <path value="DocumentReference.content.attachment.language" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.data">
      <path value="DocumentReference.content.attachment.data" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.url">
      <path value="DocumentReference.content.attachment.url" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.size">
      <path value="DocumentReference.content.attachment.size" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.hash">
      <path value="DocumentReference.content.attachment.hash" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.title">
      <path value="DocumentReference.content.attachment.title" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.context.related">
      <path value="DocumentReference.context.related" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehealthontario.ca/fhir/StructureDefinition/ca-on-eReferral-profile-ServiceRequest" />
        <aggregation value="referenced" />
      </type>
    </element>
    <element id="DocumentReference.context.related.reference">
      <path value="DocumentReference.context.related.reference" />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>