Goal
Introduction #
The Goal model represents a patient Goal in Canvas, which is always associated with a Note and a Patient.
This page also documents UpdateGoal, the record of a goal’s updates and closures, created by committing an UpdateGoal command or CloseGoal command.
Basic usage #
To get a goal by identifier, use the get method on the Goal model manager:
from canvas_sdk.v1.data.goal import Goal
goal = Goal.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
If you have a patient object, or note object, the goals for a patient or note can be accessed with the goals attribute on a Patient or Note object:
from canvas_sdk.v1.data.patient import Patient
from canvas_sdk.v1.data.note import Note
patient = Patient.objects.get(id="1eed3ea2a8d546a1b681a2a45de1d790")
goals = patient.goals.all()
note = Note.objects.get(id="89992c23-c298-4118-864a-26cb3e1ae822")
goals = note.goals.all()
UpdateGoal records can be queried the same way, and each one links back to the goal it updates with the goal attribute:
from canvas_sdk.v1.data.goal import UpdateGoal
update = UpdateGoal.objects.get(id="61a1853f-168f-4ed3-80d2-44e5d144bcf3")
goal = update.goal
committed_updates = UpdateGoal.objects.committed()
Filtering #
Goals can be filtered by any attribute that exists on the model.
Filtering for goals is done with the filter method on the Goal model manager.
By attribute #
Specify an attribute with filter to filter by that attribute:
from canvas_sdk.v1.data.goal import Goal, GoalAchievementStatus
goals = Goal.objects.filter(achievement_status=GoalAchievementStatus.IN_PROGRESS)
Committed goals #
The committed method returns goals that have been committed and not entered in error:
from canvas_sdk.v1.data.goal import Goal
committed_goals = Goal.objects.committed()
Goal updates and closures #
Each change to a goal — via the UpdateGoal or CloseGoal command — is recorded as an UpdateGoal. Update actions revise the goal while leaving it active; close actions also move it to a closed lifecycle_status (e.g. completed, cancelled, rejected). A goal’s updates are reachable through its updates accessor:
from canvas_sdk.v1.data.goal import Goal
goal = Goal.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
# Every update or close recorded against this goal.
updates = goal.updates.all()
# The most recent committed update — the goal's current state — or None.
latest = goal.updates.committed().order_by("dbid").last()
UpdateGoal carries the same status, priority, and progress fields as Goal (without goal_statement / start_date), plus a goal foreign key back to the goal it updates. Like Goal, its manager supports committed() to filter to committed, non-entered-in-error records.
Attributes #
Goal #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| originator | CanvasUser |
| committer | CanvasUser |
| entered_in_error | CanvasUser |
| patient | Patient |
| note | Note |
| lifecycle_status | GoalLifecycleStatus |
| achievement_status | GoalAchievementStatus |
| priority | GoalPriority |
| due_date | Date |
| start_date | Date |
| progress | String |
| goal_statement | String |
| updates | QuerySet[UpdateGoal] |
UpdateGoal #
An update or close action recorded against a Goal, reachable from a goal via goal.updates. Written by the UpdateGoal and CloseGoal commands.
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| originator | CanvasUser |
| committer | CanvasUser |
| entered_in_error | CanvasUser |
| patient | Patient |
| note | Note |
| goal | Goal |
| lifecycle_status | GoalLifecycleStatus |
| achievement_status | GoalAchievementStatus |
| priority | GoalPriority |
| due_date | Date |
| progress | String |
Enumeration types #
GoalLifecycleStatus #
| Name | Value |
|---|---|
| PROPOSED | proposed |
| PLANNED | planned |
| ACCEPTED | accepted |
| ACTIVE | active |
| ON_HOLD | on-hold |
| COMPLETED | completed |
| CANCELLED | cancelled |
| REJECTED | rejected |
GoalAchievementStatus #
| Name | Value |
|---|---|
| IN_PROGRESS | in-progress |
| IMPROVING | improving |
| WORSENING | worsening |
| NO_CHANGE | no-change |
| ACHIEVED | achieved |
| SUSTAINING | sustaining |
| NOT_ACHIEVED | not-achieved |
| NO_PROGRESS | no-progress |
| NOT_ATTAINABLE | not-attainable |
GoalPriority #
| Name | Value |
|---|---|
| HIGH | high-priority |
| MEDIUM | medium-priority |
| LOW | low-priority |