<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="006c324c-9715-4f7b-8862-b1e90c26c731" />
  <meta>
    <versionId value="1" />
    <lastUpdated value="2023-09-28T12:02:21.111+00:00" />
    <source value="#WazS1YQm4dXxp2Ri" />
  </meta>
  <url value="https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-DocumentReference" />
  <version value="1.0.0" />
  <name value="IDMSDocumentReference" />
  <status value="active" />
  <description value="This is for the Generated Submission PDFs, Generated Letters and later Consent documents" />
  <fhirVersion value="5.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="DocumentReference" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DocumentReference" />
  <derivation value="constraint" />
  <differential>
    <element id="DocumentReference.extension">
      <path value="DocumentReference.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="DocumentReference.extension:createdUser">
      <path value="DocumentReference.extension" />
      <sliceName value="createdUser" />
      <definition value="#### **_`IDMS:  Link to the user that created the record.`_**" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/CreatedUser" />
      </type>
    </element>
    <element id="DocumentReference.extension:createdDate">
      <path value="DocumentReference.extension" />
      <sliceName value="createdDate" />
      <definition value="#### **_`IDMS:  Date and Time the record was created.`_**" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/CreatedDate" />
      </type>
    </element>
    <element id="DocumentReference.extension:updatedUser">
      <path value="DocumentReference.extension" />
      <sliceName value="updatedUser" />
      <definition value="#### **_`IDMS:  Link to the user that last updated the record.`_**" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/UpdatedUser" />
      </type>
    </element>
    <element id="DocumentReference.extension:updatedDate">
      <path value="DocumentReference.extension" />
      <sliceName value="updatedDate" />
      <definition value="#### **_`IDMS:  Date and Time the record was last updated.`_**" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/UpdatedDate" />
      </type>
    </element>
    <element id="DocumentReference.identifier">
      <path value="DocumentReference.identifier" />
      <definition value="#### **_`IDMS:  This is a business identifier the given to this document.  This will only be populated for Consent Documents`_**" />
      <max value="1" />
    </element>
    <element id="DocumentReference.basedOn">
      <path value="DocumentReference.basedOn" />
      <definition value="#### **_`IDMS:  The ServiceRequest that the document is linked to.`_**" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-ServiceRequest-New" />
      </type>
    </element>
    <element id="DocumentReference.status">
      <path value="DocumentReference.status" />
      <definition value="#### **_`IDMS:  This is mandatory according to FHIR, it will should always be 'current'.`_**" />
    </element>
    <element id="DocumentReference.docStatus">
      <path value="DocumentReference.docStatus" />
      <max value="0" />
    </element>
    <element id="DocumentReference.modality">
      <path value="DocumentReference.modality" />
      <max value="0" />
    </element>
    <element id="DocumentReference.type">
      <path value="DocumentReference.type" />
      <definition value="#### **_`IDMS:  This is the type of document reference.  Example 'Submission PDF'.`_**" />
      <min value="1" />
    </element>
    <element id="DocumentReference.type.extension">
      <path value="DocumentReference.type.extension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.type.coding">
      <path value="DocumentReference.type.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="DocumentReference.type.coding.extension">
      <path value="DocumentReference.type.coding.extension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.type.coding.system">
      <path value="DocumentReference.type.coding.system" />
      <min value="1" />
      <fixedUri value="https://health.gov.on.ca/idms/fhir/CodeSystem/IDMS-Internal" />
    </element>
    <element id="DocumentReference.type.coding.version">
      <path value="DocumentReference.type.coding.version" />
      <max value="0" />
    </element>
    <element id="DocumentReference.type.coding.code">
      <path value="DocumentReference.type.coding.code" />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://health.gov.on.ca/idms/fhir/ValueSet/IDMS-DocumentReference-Types" />
      </binding>
    </element>
    <element id="DocumentReference.type.coding.display">
      <path value="DocumentReference.type.coding.display" />
    </element>
    <element id="DocumentReference.type.coding.userSelected">
      <path value="DocumentReference.type.coding.userSelected" />
      <max value="0" />
    </element>
    <element id="DocumentReference.type.text">
      <path value="DocumentReference.type.text" />
      <max value="0" />
    </element>
    <element id="DocumentReference.category">
      <path value="DocumentReference.category" />
      <max value="0" />
    </element>
    <element id="DocumentReference.subject">
      <path value="DocumentReference.subject" />
      <max value="0" />
    </element>
    <element id="DocumentReference.context">
      <path value="DocumentReference.context" />
      <max value="0" />
    </element>
    <element id="DocumentReference.event">
      <path value="DocumentReference.event" />
      <max value="0" />
    </element>
    <element id="DocumentReference.bodySite">
      <path value="DocumentReference.bodySite" />
      <max value="0" />
    </element>
    <element id="DocumentReference.facilityType">
      <path value="DocumentReference.facilityType" />
      <max value="0" />
    </element>
    <element id="DocumentReference.practiceSetting">
      <path value="DocumentReference.practiceSetting" />
      <max value="0" />
    </element>
    <element id="DocumentReference.period">
      <path value="DocumentReference.period" />
      <definition value="#### **_`IDMS:  For Reports this is the date range.`_**" />
    </element>
    <element id="DocumentReference.date">
      <path value="DocumentReference.date" />
      <definition value="#### **_`IDMS:  The document date from DSTS`_**" />
    </element>
    <element id="DocumentReference.author">
      <path value="DocumentReference.author" />
      <definition value="#### **_`IDMS:  The user that generated the letter or submission summary PDF..`_**" />
      <max value="0" />
      <type>
        <code value="Reference" />
        <profile value="https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-PractitionerRole-Employee" />
      </type>
    </element>
    <element id="DocumentReference.attester">
      <path value="DocumentReference.attester" />
      <max value="0" />
    </element>
    <element id="DocumentReference.custodian">
      <path value="DocumentReference.custodian" />
      <max value="0" />
    </element>
    <element id="DocumentReference.relatesTo">
      <path value="DocumentReference.relatesTo" />
      <max value="0" />
    </element>
    <element id="DocumentReference.description">
      <path value="DocumentReference.description" />
      <max value="0" />
    </element>
    <element id="DocumentReference.securityLabel">
      <path value="DocumentReference.securityLabel" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content">
      <path value="DocumentReference.content" />
      <definition value="#### **_`IDMS: For generated letters this the name, mime type and template. For submission summary this the link to the PDF.`_**" />
      <max value="1" />
    </element>
    <element id="DocumentReference.content.extension">
      <path value="DocumentReference.content.extension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.modifierExtension">
      <path value="DocumentReference.content.modifierExtension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment">
      <path value="DocumentReference.content.attachment" />
      <definition value="#### **_`IDMS:  For generated letters  attachment.title = the full path of the generated letter;  attachment.contentType  = 'application/msword' .`_**" />
      <max value="1" />
    </element>
    <element id="DocumentReference.content.profile">
      <path value="DocumentReference.content.profile" />
      <definition value="#### **_`IDMS:  For generated letters the template that was used to generate the letter. The 'valueCoding.display' element is populated with the template name. The valueURI element is populated with the unique identifier of the template.  DSTS migreated records will only have the display value.  `_**" />
      <max value="2" />
    </element>
    <element id="DocumentReference.content.profile.extension">
      <path value="DocumentReference.content.profile.extension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.profile.modifierExtension">
      <path value="DocumentReference.content.profile.modifierExtension" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>