ProtocolOverride

Introduction #

The ProtocolOverride model represents an instance of a protocol being snoozed for a patient.

Basic usage #

To get a protocol override by identifier, use the get method on the ProtocolOverride model manager:

from canvas_sdk.v1.data.protocol_override import ProtocolOverride

protocol_override = ProtocolOverride.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")

If you have a patient object, the protocol overrides for a patient can be accessed with the protocol_overrides attribute on a Patient object:

from canvas_sdk.v1.data.patient import Patient

patient = Patient.objects.get(id="1eed3ea2a8d546a1b681a2a45de1d790")
overrides = patient.protocol_overrides.all()

If you have a patient ID, you can get the protocol overrides for the patient with the for_patient method on the ProtocolOverride model manager:

from canvas_sdk.v1.data.protocol_override import ProtocolOverride

patient_id = "1eed3ea2a8d546a1b681a2a45de1d790"
override = ProtocolOverride.objects.for_patient(patient_id)

Filtering #

Protocol overrides can be filtered by any attribute that exists on the model.

By attribute #

Specify an attribute with filter to filter by that attribute:

from canvas_sdk.v1.data.protocol_override import ProtocolOverride

overrides = ProtocolOverride.objects.filter(status="active")

Convenience methods #

The ProtocolOverride model manager includes convenience methods for the filters plugins most often apply when working with protocol overrides.

active returns the overrides whose status is active:

from canvas_sdk.v1.data.protocol_override import ProtocolOverride

active_overrides = ProtocolOverride.objects.active()

adjustments returns the adjustment overrides (is_adjustment=True) for a given protocol key, and snoozes returns the snooze overrides (is_snooze=True) for a given protocol key:

from canvas_sdk.v1.data.protocol_override import ProtocolOverride

adjustments = ProtocolOverride.objects.adjustments("HCC001v1")
snoozes = ProtocolOverride.objects.snoozes("HCC001v1")

Each method returns a queryset, so you can chain them with for_patient, committed, and with one another. For example, to get the active adjustments for a given patient and protocol key:

from canvas_sdk.v1.data.protocol_override import ProtocolOverride

adjustments = (
    ProtocolOverride.objects
    .for_patient("1eed3ea2a8d546a1b681a2a45de1d790")
    .committed()
    .active()
    .adjustments("HCC001v1")
)

Attributes #

ProtocolOverride #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
deletedBoolean
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
protocol_keyString
is_adjustmentBoolean
reference_dateDateTime
cycle_in_daysInteger
is_snoozeBoolean
snooze_dateDate
snoozed_daysInteger
snooze_commentString
narrativeString
cycle_quantityInteger
cycle_unitIntervalUnit
statusStatus

Enumeration types #

IntervalUnit #

ValueLabel
daysdays
monthsmonths
yearsyears

Status #

ValueLabel
activeactive
inactiveinactive