PatientConsent

Introduction #

The PatientConsent model represents documented patient consents in Canvas that ensure legal compliance and protect patient rights. Each PatientConsent is linked to a Patient, has a category (which is a PatientConsentCoding), and optionally a rejection reason (which is a PatientConsentRejectionCoding).

Usage #

The PatientConsent model can be used to find all of the patient consents for a given patient and organization:

>>> from canvas_sdk.v1.data import PatientConsent, Patient, Organization
>>> patient_1 = Patient.objects.get(id="aebe4d3f5d18410388dc69c4b5169fc3")
>>> organization_1 = Organization.objects.first()
>>> patient_1_consents = PatientConsent.objects.filter(patient=patient_1, organization=organization_1)
>>> print([consent.category.display for consent in patient_1_consents])
['Surgical Consent Form', 'Telehealth', 'HIPAA']

You can also access a patient’s consents from the Patient model:

>>> from canvas_sdk.v1.data import PatientConsent, Patient
>>> patient_1 = Patient.objects.get(id="aebe4d3f5d18410388dc69c4b5169fc3")
>>> patient_1_consents = patient_1.patient_consent.all()
>>> print([consent.category.display for consent in patient_1_consents])
['Surgical Consent Form', 'Telehealth', 'HIPAA']

And you can also access all of the PatientConsents for a given PatientConsentCoding (aka category):

>>> from canvas_sdk.v1.data import PatientConsentCoding
>>> coding = PatientConsentCoding.objects.get(code='59284-0', system='LOINC')
>>> consents = coding.patient_consent.all()
>>> print([consent.state for consent in consents])
['accepted', 'accepted_via_patient_portal', 'rejected']

Each PatientConsentCoding has a document field containing the URL to the consent template document:

>>> from canvas_sdk.v1.data import PatientConsentCoding
>>> coding = PatientConsentCoding.objects.first()
>>> print(coding.document)
'consent_templates/hipaa_consent.pdf'

Accessing Document Files #

The document_url property returns a presigned S3 URL for securely accessing the blank consent template — the form you send to a patient to collect their consent. The copy the patient signs and returns is a separate record; see Signed consent documents.

from canvas_sdk.v1.data import PatientConsentCoding

consent_coding = PatientConsentCoding.objects.first()

# Returns a presigned S3 URL (valid for 1 hour)
url = consent_coding.document_url

Signed consent documents #

The PatientConsentCoding.document above is the blank template sent to the patient. The signed documents the patient completes and returns are PatientAdministrativeDocument records, reachable from the consent through the documents relation:

from canvas_sdk.v1.data import PatientConsent

consent = PatientConsent.objects.get(id="8a2b1c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d")

# Every signed document attached to this consent.
signed_documents = consent.documents.all()

# The current signed document (the most recent non-junked one), or None.
current = consent.active_document

Each signed document’s FHIR DocumentReference is reachable through document_references, so a plugin can read the reference (and its related_object) in-process without a FHIR call:

from canvas_sdk.v1.data import PatientConsent

consent = PatientConsent.objects.get(id="8a2b1c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d")

for reference in consent.document_references:
    url = reference.document_url

Attributes #

PatientConsent #

Field NameType
idUUID
dbidInteger
patientPatient
categoryPatientConsentCoding
statePatientConsentStatus
effective_dateDateTime
expired_dateDateTime
rejection_reasonPatientConsentRejectionCoding
originatorCanvasUser
documentsQuerySet[PatientAdministrativeDocument] — the signed consent documents
active_documentPatientAdministrativeDocument (property) — the current signed document, or None
document_referencesQuerySet[DocumentReference] (property) — references for the signed documents

PatientConsentCoding #

Field NameType
dbidInteger
systemString
versionString
codeString
displayString
user_selectedBoolean
expiration_rulePatientConsentExpirationRule
is_mandatoryBoolean
is_proof_requiredBoolean
show_in_patient_portalBoolean
summaryString
documentString
document_urlString (property) — presigned S3 URL
patient_consentQuerySet[PatientConsent]

PatientConsentRejectionCoding #

Field NameType
dbidInteger
systemString
versionString
codeString
displayString
user_selectedBoolean
patient_consentsQuerySet[PatientConsent]

Enumeration types #

PatientConsentStatus #

ValueLabel
acceptedAccepted
accepted_via_patient_portalAccepted Via Patient Portal
rejectedRejected
rejected_via_patient_portalRejected Via Patient Portal

PatientConsentExpirationRule #

ValueLabel
neverNever
in_one_yearIn one year
end_of_yearEnd of year