{
  "resourceType": "StructureDefinition",
  "id": "profile-DwDocumentReference",
  "url": "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwDocumentReference",
  "version": "2.0.0",
  "name": "DwDocumentReference",
  "status": "draft",
  "date": "2026-05-29",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "DocumentReference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DocumentReference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DocumentReference.id",
        "path": "DocumentReference.id",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.meta.lastUpdated",
        "path": "DocumentReference.meta.lastUpdated",
        "min": 1
      },
      {
        "id": "DocumentReference.meta.source",
        "path": "DocumentReference.meta.source",
        "min": 1
      },
      {
        "id": "DocumentReference.meta.security",
        "path": "DocumentReference.meta.security",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.text",
        "path": "DocumentReference.text",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.extension",
        "path": "DocumentReference.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "DocumentReference.extension:ClinicianAnnotation",
        "path": "DocumentReference.extension",
        "sliceName": "ClinicianAnnotation",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/ext-ClinicianAnnotation"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier",
        "path": "DocumentReference.identifier",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.status",
        "path": "DocumentReference.status",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.docStatus",
        "path": "DocumentReference.docStatus",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.type",
        "path": "DocumentReference.type",
        "comment": "Conformance Rule: This must be specified when known. Set type to the best, most precise LOINC code corresponding to the concept of the document in the source system.",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.category",
        "path": "DocumentReference.category",
        "comment": "Usage note: A category will typically pertain to the specialty, eg Chemotherapy, Cardiology.",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.category.text",
        "path": "DocumentReference.category.text",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.subject",
        "path": "DocumentReference.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPatient",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitioner"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.date",
        "path": "DocumentReference.date",
        "comment": "Usage note: When the attachment was created into the documentReference.",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author",
        "path": "DocumentReference.author",
        "comment": "Conformance rule: If the consultation has been sent internally then provide practitioner as a reference for the specialist. For external providers provide the display only.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitioner",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitionerRole",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPatient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author.reference",
        "path": "DocumentReference.author.reference",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author.display",
        "path": "DocumentReference.author.display",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content",
        "path": "DocumentReference.content",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.contentType",
        "path": "DocumentReference.content.attachment.contentType",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.data",
        "path": "DocumentReference.content.attachment.data",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.url",
        "path": "DocumentReference.content.attachment.url",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.size",
        "path": "DocumentReference.content.attachment.size",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.hash",
        "path": "DocumentReference.content.attachment.hash",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.title",
        "path": "DocumentReference.content.attachment.title",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.creation",
        "path": "DocumentReference.content.attachment.creation",
        "comment": "Usage note: the date the document was created by the source EMR where there is an attachment. Not required for URLs",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.encounter",
        "path": "DocumentReference.context.encounter",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwEncounter"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.period",
        "path": "DocumentReference.context.period",
        "comment": "Usage note: Context around the attachment itself, used to capture received date of the document by the source EMR.",
        "mustSupport": true
      }
    ]
  }
}