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 NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
noteNote
lifecycle_statusGoalLifecycleStatus
achievement_statusGoalAchievementStatus
priorityGoalPriority
due_dateDate
start_dateDate
progressString
goal_statementString
updatesQuerySet[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 NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
noteNote
goalGoal
lifecycle_statusGoalLifecycleStatus
achievement_statusGoalAchievementStatus
priorityGoalPriority
due_dateDate
progressString

Enumeration types #

GoalLifecycleStatus #

NameValue
PROPOSEDproposed
PLANNEDplanned
ACCEPTEDaccepted
ACTIVEactive
ON_HOLDon-hold
COMPLETEDcompleted
CANCELLEDcancelled
REJECTEDrejected

GoalAchievementStatus #

NameValue
IN_PROGRESSin-progress
IMPROVINGimproving
WORSENINGworsening
NO_CHANGEno-change
ACHIEVEDachieved
SUSTAININGsustaining
NOT_ACHIEVEDnot-achieved
NO_PROGRESSno-progress
NOT_ATTAINABLEnot-attainable

GoalPriority #

NameValue
HIGHhigh-priority
MEDIUMmedium-priority
LOWlow-priority