<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="DocumentReferenceMERT" />
  <url value="https://intrahealth.com/fhir/mert/StructureDefinition/DocumentReferenceMERT" />
  <name value="DocumentReferenceMERT" />
  <title value="DocumentReference (MERT)" />
  <status value="draft" />
  <description value="This profile describes the DocumentReference constraints for MERT." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="DocumentReference" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DocumentReference" />
  <derivation value="constraint" />
  <differential>
    <element id="DocumentReference">
      <path value="DocumentReference" />
      <constraint>
        <key value="DocumentReferenceAttachmentHasUrlOrData" />
        <severity value="error" />
        <human value="Attachment SHALL have at least one of url or data." />
        <expression value="content.attachment.url.exists() or content.attachment.data.exists()" />
        <source value="https://intrahealth.com/fhir/mert/StructureDefinition/DocumentReferenceMERT" />
      </constraint>
    </element>
    <element id="DocumentReference.status">
      <path value="DocumentReference.status" />
      <short value="current" />
      <comment value="MERT only supports 'current' DocumentReference instances; superseded/previous versions are not supported." />
      <patternCode value="current" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.category">
      <path value="DocumentReference.category" />
      <comment value="Senders SHALL populate category.text with a human-readable document category label. Senders MAY populate category.coding using local code systems. Receivers MUST accept and persist category.text and any provided codings. Cross-system interpretation of coded categories is not guaranteed." />
      <constraint>
        <key value="DocumentReferenceCategoryHasText" />
        <severity value="error" />
        <human value="DocumentReference.category SHALL have a text value." />
        <expression value="text.exists()" />
        <source value="https://intrahealth.com/fhir/mert/StructureDefinition/DocumentReferenceMERT" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.subject">
      <path value="DocumentReference.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://intrahealth.com/fhir/mert/StructureDefinition/PatientMERT" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.author">
      <path value="DocumentReference.author" />
      <comment value="Who and/or what authored the document. For MERT, this is who it is assigned to." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://intrahealth.com/fhir/mert/StructureDefinition/PractitionerMERT" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.authenticator">
      <path value="DocumentReference.authenticator" />
      <comment value="Who/what authenticated the document. For MERT, this is who signed this document." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://intrahealth.com/fhir/mert/StructureDefinition/PractitionerMERT" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.description">
      <path value="DocumentReference.description" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content">
      <path value="DocumentReference.content" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment">
      <path value="DocumentReference.content.attachment" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.content.attachment.contentType">
      <path value="DocumentReference.content.attachment.contentType" />
      <min value="1" />
      <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.context">
      <path value="DocumentReference.context" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.context.period">
      <path value="DocumentReference.context.period" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DocumentReference.context.period.start">
      <path value="DocumentReference.context.period.start" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>