{
  "resourceType": "StructureDefinition",
  "id": "profile-documentreference",
  "url": "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-documentreference",
  "version": "0.1.2",
  "name": "DocumentReferenceProfile",
  "title": "DocumentReference Profile for metadata about the document",
  "status": "draft",
  "date": "2026-01-09",
  "publisher": "HL7 Canada - FHIR Implementation Work Group",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "https://infocentral.infoway-inforoute.ca/en/collaboration/wg/fhir-implementations"
        }
      ]
    }
  ],
  "description": "Proposed constraints on the DocumentReference resource for the minimal set of data required to reference to a document of any kind for any purpose.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "urn:iso:std:iso:3166",
          "code": "CA"
        }
      ]
    }
  ],
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "workflow",
      "uri": "http://hl7.org/fhir/workflow",
      "name": "Workflow Pattern"
    },
    {
      "identity": "fhircomposition",
      "uri": "http://hl7.org/fhir/composition",
      "name": "FHIR Composition"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "cda",
      "uri": "http://hl7.org/v3/cda",
      "name": "CDA (R2)"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    },
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    },
    {
      "identity": "xds",
      "uri": "http://ihe.net/xds",
      "name": "XDS metadata equivalent"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "DocumentReference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DocumentReference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DocumentReference",
        "path": "DocumentReference",
        "short": "DocumentReference Profile",
        "definition": "The DocumentReference Profile is based upon the core FHIR DocumentReference resource and created to define the minimal set of the document metadata required to discoverer and manage any kind of documents."
      },
      {
        "id": "DocumentReference.subject",
        "path": "DocumentReference.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitioner",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-device"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.author",
        "path": "DocumentReference.author",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitioner",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitionerrole",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-organization",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-device",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.authenticator",
        "path": "DocumentReference.authenticator",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitioner",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitionerrole",
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-organization"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.custodian",
        "path": "DocumentReference.custodian",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-organization"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.content.attachment",
        "path": "DocumentReference.content.attachment",
        "constraint": [
          {
            "key": "ca-baseline-documentreference-1",
            "severity": "error",
            "human": "DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present.",
            "expression": "url.exists() or data.exists()",
            "xpath": "f:url or f:content"
          }
        ]
      },
      {
        "id": "DocumentReference.context.encounter",
        "path": "DocumentReference.context.encounter",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-encounter"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.context.practiceSetting",
        "path": "DocumentReference.context.practiceSetting",
        "short": "PractitionerSpecialty",
        "comment": "The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the PractitionerSpecialty code system for interoperability purposes but are not required to do so to be considered conformant.",
        "binding": {
          "strength": "preferred",
          "description": "Defines the clinical, medical, surgical or other healthcare-related service specialty of a practitioner who interacts, treats or provides such services to or for a patient.",
          "valueSet": "https://fhir.infoway-inforoute.ca/ValueSet/practitionerspecialty"
        }
      },
      {
        "id": "DocumentReference.context.sourcePatientInfo",
        "path": "DocumentReference.context.sourcePatientInfo",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient"
            ]
          }
        ]
      }
    ]
  }
}