Prescription

Introduction #

The Prescription model represents a prescription for a medication that has been written for a patient. Prescriptions track the full lifecycle of a medication order, including dosage details, pharmacy information, and electronic prescribing status.

Basic usage #

To get a prescription by identifier, use the get method on the Prescription model manager:

from canvas_sdk.v1.data.prescription import Prescription

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

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

from canvas_sdk.v1.data.patient import Patient

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

If you have a patient ID, you can get the prescriptions for the patient with the for_patient method on the Prescription model manager:

from canvas_sdk.v1.data.prescription import Prescription

patient_id = "1eed3ea2a8d546a1b681a2a45de1d790"
prescriptions = Prescription.objects.for_patient(patient_id)

Filtering #

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

Filtering for prescriptions is done with the filter method on the Prescription model manager.

By attribute #

Specify an attribute with filter to filter by that attribute:

from canvas_sdk.v1.data.prescription import Prescription, PrescriptionStatus

prescriptions = Prescription.objects.filter(status=PrescriptionStatus.OPEN)
from canvas_sdk.v1.data.prescription import Prescription, PrescriptionResponse

approved_prescriptions = Prescription.objects.filter(response_type=PrescriptionResponse.APPROVED)

Active prescriptions #

The active method returns committed prescriptions that have not been denied:

from canvas_sdk.v1.data.prescription import Prescription

active_prescriptions = Prescription.objects.active()

Committed prescriptions #

The committed method returns prescriptions that have been committed and not entered in error:

from canvas_sdk.v1.data.prescription import Prescription

committed_prescriptions = Prescription.objects.committed()

Combined sig #

The combined_sig property returns a prescription’s sig — its directions for use — as a string. It returns sig_original_input, and when maximum_daily_dose is set, combined_sig appends . Maximum Daily Dose: {maximum_daily_dose} to the sig. For example, a prescription with the sig 1 tab bid and a maximum daily dose of 2 tabs returns 1 tab bid. Maximum Daily Dose: 2 tabs. When maximum_daily_dose is not set, combined_sig returns sig_original_input unchanged. When the prescription has no sig, combined_sig returns an empty string. Because combined_sig is a property computed in Python, it is read from each Prescription object and is not available to a queryset .filter() or .order_by().

from canvas_sdk.v1.data.prescription import Prescription

prescription = Prescription.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
sig = prescription.combined_sig  # "" when the prescription has no sig

An active prescription’s combined_sig is one of the sources a medication’s latest_sig draws on, alongside its change medications and medication statements. To get the most recent sig for the medication, read latest_sig from the referenced medication:

from canvas_sdk.v1.data.prescription import Prescription

prescription = Prescription.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
sig = prescription.medication.latest_sig

Attributes #

Prescription #

Field NameTypeDescription
idUUID 
dbidInteger 
patientPatient 
noteNote 
prescriberStaff 
supervising_providerStaff 
medicationMedication 
compound_medicationCompoundMedication 
previous_medicationMedication 
indicationsAssessment[] 
related_refillPrescription 
refill_requestRefillRequest 
statusPrescriptionStatus 
response_typePrescriptionResponse 
is_refillBoolean 
is_adjustmentBoolean 
is_epcsBoolean 
generic_substitutions_allowedBoolean 
written_dateDateTime 
dispensed_dateDateTime 
end_dateDate 
end_date_original_inputString 
sig_original_inputString 
dose_formString 
dose_routeString 
dose_quantityFloat 
dose_frequencyFloat 
dose_frequency_intervalString 
maximum_daily_doseString 
combined_sigString (computed)See Combined sig
potency_quantityFloat 
dispense_quantityFloat 
duration_in_daysInteger 
count_of_refills_allowedInteger 
note_to_pharmacistString 
pharmacy_nameString 
pharmacy_ncpdp_idString 
pharmacy_addressString 
pharmacy_phone_numberString 
pharmacy_fax_numberString 
pharmacy_is_read_onlyBoolean 
message_idString 
prescription_order_numberString 
reason_codeString 
error_messageString 
entered_in_errorCanvasUser 
committerCanvasUser 
originatorCanvasUser 
createdDateTime 
modifiedDateTime 
cancel_prescriptionsCancelPrescription[] 
change_requestsPrescriptionChangeRequest[] 

Enumeration types #

PrescriptionStatus #

EnumValueLabel
OPENopenOpen
PENDINGpendingPending
ACCEPTEDultimately-acceptedUltimately Accepted
ERRORerrorError
CANCEL_REQUESTEDcancel-requestedCancel Requested
CANCELEDcanceledCanceled
CANCEL_DENIEDcancel-deniedCancel Denied
RECEIVEDreceivedReceived by DrFirst
SIGNEDsignedSigned
INQUEUEinqueueIn Queue
TRANSMITTEDtransmittedTransmitted
DELIVEREDdeliveredDelivered

PrescriptionResponse #

EnumValueLabel
APPROVEDAApproved
APPROVED_WITH_CHANGESCApproved with changes
DENIEDDDenied
DENIED_PRESCRIPTION_TO_FOLLOWNDenied, new prescription to follow