{
  "resourceType": "StructureDefinition",
  "id": "profile-DwCarePlan",
  "url": "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwCarePlan",
  "version": "2.0.0",
  "name": "DwCarePlan",
  "status": "draft",
  "date": "2026-05-29",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "CarePlan",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/CarePlan",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "CarePlan.id",
        "path": "CarePlan.id",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "CarePlan.meta.lastUpdated",
        "path": "CarePlan.meta.lastUpdated",
        "min": 1
      },
      {
        "id": "CarePlan.meta.source",
        "path": "CarePlan.meta.source",
        "min": 1
      },
      {
        "id": "CarePlan.meta.profile",
        "path": "CarePlan.meta.profile",
        "max": "1"
      },
      {
        "id": "CarePlan.meta.security",
        "path": "CarePlan.meta.security",
        "comment": "CHR: Populated when the patient record is restricted."
      },
      {
        "id": "CarePlan.text",
        "path": "CarePlan.text",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "CarePlan.identifier",
        "path": "CarePlan.identifier",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "CarePlan.identifier.system",
        "path": "CarePlan.identifier.system",
        "comment": "CHR: urn:telus:emr:chr:{region}:{accountId}:carePlan",
        "min": 1
      },
      {
        "id": "CarePlan.identifier.value",
        "path": "CarePlan.identifier.value",
        "min": 1
      },
      {
        "id": "CarePlan.status",
        "path": "CarePlan.status",
        "comment": "CHR: Status derived from encounter locked state — completed when locked, draft when unlocked. Deleted encounters are excluded upstream, so entered-in-error is not currently produced.",
        "mustSupport": true
      },
      {
        "id": "CarePlan.intent",
        "path": "CarePlan.intent",
        "comment": "CHR: Hardcoded value \"plan\".",
        "mustSupport": true
      },
      {
        "id": "CarePlan.description",
        "path": "CarePlan.description",
        "comment": "Usage note: Reason for leaving it must support and not 1..1 cardinality as there might be visit notes where there is not plan documented.\r\n\r\nNote that FHIR strings SHALL NOT exceed 1MB in size",
        "mustSupport": true
      },
      {
        "id": "CarePlan.subject",
        "path": "CarePlan.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPatient",
              "http://hl7.org/fhir/StructureDefinition/Group"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "CarePlan.encounter",
        "path": "CarePlan.encounter",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwEncounter"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "CarePlan.created",
        "path": "CarePlan.created",
        "mustSupport": true
      },
      {
        "id": "CarePlan.contributor",
        "path": "CarePlan.contributor",
        "comment": "CHR: Unique practitioners who contributed actions on the encounter.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPatient",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitioner",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitionerRole",
              "http://hl7.org/fhir/StructureDefinition/Device",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwCareTeam"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "CarePlan.supportingInfo",
        "path": "CarePlan.supportingInfo",
        "comment": "CHR: References to DocumentReference resources built from attachments linked to the encounter.\nMA: Reference to the linked clinical note or consult report DocumentReference for the visit.\n\nUsage note: Provide reference to the documentReferenceClinicalNote associated with this plan.\r\nUse \"concern\" to identify specific conditions addressed by the care plan.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwDocumentReference",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwQuestionnaireResponse"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity",
        "path": "CarePlan.activity",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.outcomeCodeableConcept",
        "path": "CarePlan.activity.outcomeCodeableConcept",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.outcomeReference",
        "path": "CarePlan.activity.outcomeReference",
        "comment": "CHR: MedicationRequest (prescriptions), MedicationAdministration (injections)\nMA: MedicationRequest, ServiceRequest, Immunization, Observation",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwMedicationRequest",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwServiceRequest",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwImmunization",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwObservation",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwObservationVitals",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwObservationResults",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwMedicationAdministration"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.outcomeReference.display",
        "path": "CarePlan.activity.outcomeReference.display",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.reference",
        "path": "CarePlan.activity.reference",
        "comment": "CHR: Referral records created within the encounter (ServiceRequest).\nMA: Referral tasks (category Investigation/Lab/Consult/Consultation) not yet complete (ServiceRequest).\n\nUsage note - Planned activities with  FHIR profile will be referenced here for example Immunization prescribed but not given during that visit use MedicationRequest, serviceRequest for referrals etc\r\r\nStandard extension exists ([resource-pertainsToGoal](extension-resource-pertainstogoal.html)) that allows goals to be referenced from any of the referenced resources in CarePlan.activity.reference.  \rThe goal should be visible when the resource referenced by CarePlan.activity.reference is viewed independently from the CarePlan.  Requests that are pointed to by a CarePlan using this element should *not* point to this CarePlan using the \"basedOn\" element.  i.e. Requests that are part of a CarePlan are not \"based on\" the CarePlan.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwAppointment",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwMedicationRequest",
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwServiceRequest"
            ]
          }
        ]
      },
      {
        "id": "CarePlan.activity.reference.display",
        "path": "CarePlan.activity.reference.display",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.detail.kind",
        "path": "CarePlan.activity.detail.kind",
        "comment": "CHR: Hardcoded value \"Task\".\nMA: Hardcoded value \"Task\".\n\nUsage note - Most of the time it will be 'Task'\r\nNote that FHIR strings SHALL NOT exceed 1MB in size",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.detail.code",
        "path": "CarePlan.activity.detail.code",
        "comment": "CHR: Text-only value — no coded value populated.\nMA: Text-only value (task category) — no coded value populated.\n\nUsage note - Provide the category of the planned activity/task under code.text eg immunization, Recall etc\r\nTends to be less relevant for activities involving particular products.  Codes should not convey negation - use \"prohibited\" instead.",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.detail.code.text",
        "path": "CarePlan.activity.detail.code.text",
        "comment": "CHR: Form template name (Attachments → Add Form) or follow-up questionnaire name (Follow-up Qnaires → Add Follow-up Qnaire).\nMA: Task category (e.g. Recall, Callback) for tasks that are not a completed/in-progress referral or completed immunization.\n\nUsage Note - Provide the category of the planned activity/task under code.text eg immunization, Recall etc\r\nVery often the text is the same as a displayName of one of the codings.",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.detail.status",
        "path": "CarePlan.activity.detail.status",
        "comment": "CHR: Hardcoded value \"unknown\" — the actual completion state of the activity is not tracked.\nMA: Mapped from the underlying task's status.\n\nUsage Note - Identifies what progress is being made for the specific activity.",
        "mustSupport": true
      },
      {
        "id": "CarePlan.activity.detail.description",
        "path": "CarePlan.activity.detail.description",
        "comment": "MA: Task description field.\n\nUsage Note - Name and details of the planned activity ex, immunization name flu shot etc\r\nNote that FHIR strings SHALL NOT exceed 1MB in size",
        "mustSupport": true
      }
    ]
  }
}