Patient

Introduction #

The Patient model represents an individual receiving care or other health-related services.

Basic usage #

To get a patient by identifier, use the get method on the Patient model manager:

from canvas_sdk.v1.data.patient import Patient

patient = Patient.objects.get(id="b80b1cdc2e6a4aca90ccebc02e683f35")

Filtering #

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

Filtering for patients is done with the filter method on the Patient model manager.

By attribute #

Specify attributes with filter to filter by those attributes:

from canvas_sdk.v1.data.patient import Patient

patients = Patient.objects.filter(first_name="Bob", last_name="Loblaw", birth_date="1960-09-22")

Attributes #

Patient #

Field NameType
idString
dbidInteger
first_nameString
last_nameString
birth_dateDate
sex_at_birthSexAtBirth
createdDateTime
modifiedDateTime
prefixString
suffixString
middle_nameString
maiden_nameString
nicknameString
sexual_orientation_termString
sexual_orientation_codeString
gender_identity_termString
gender_identity_codeString
preferred_pronounsString
biological_race_codesArray[String]
last_known_timezoneString
mrnString
activeBoolean
deceasedBoolean
deceased_datetimeDateTime
deceased_causeString
deceased_commentString
other_gender_descriptionString
social_security_numberString
administrative_noteString
clinical_noteString
mothers_maiden_nameString
multiple_birth_indicatorBoolean
birth_orderInteger
default_location_idInteger
default_provider_idInteger
addressesPatientAddress[]
allergy_intolerancesAllergyIntolerance[]
billing_line_itemsBillingLineItem
business_lineBusinessLine
care_team_membershipsCareTeamMembership[]
conditionsCondition[]
coveragesCoverage[]
dependent_coveragesCoverage[]
detected_issuesDetectedIssue[]
devicesDevice[]
external_identifiersPatientExternalIdentifier[]
imaging_ordersImagingOrder[]
imaging_reportsImagingReport[]
imaging_reviewsImagingReview[]
interviewsInterview[]
lab_ordersLabOrder[]
lab_reportsLabReport[]
lab_reviewsLabReview[]
medicationsMedication[]
metadataPatientMetadata[]
observationsObservation[]
preferred_pharmacyJSON
protocol_overridesProtocolOverride[]
settingsPatientSetting
subscribed_coveragesCoverage[]
tasksTask[]
telecomPatientContactPoint[]
userCanvasUser[]

PatientAddress #

Field NameType
idUUID
dbidInteger
line1String
line2String
cityString
districtString
state_codeString
postal_codeString
useAddressUse
typeAddressType
longitudeFloat
latitudeFloat
startDate
endDate
countryString
stateString
patientPatient
from canvas_sdk.v1.data.patient import Patient
from logger import log

patient_id = "d7af3e356368446c85b40a5d6ff7288e"
patient = Patient.objects.get(id=patient_id)
patient_addresses = patient.addresses.all()

for addr in patient_addresses:
  log.info(f"Patient address: {addr.city}, {addr.state_code}, {addr.postal_code}") # Seattle, WA, 98118

PatientContactPoint #

Field NameType
idUUID
dbidInteger
systemContactPointSystem
valueString
useString
use_notesString
rankInteger
stateContactPointState
patientPatient
has_consentBoolean
last_verifiedDateTime
verification_tokenString
opted_outBoolean
from canvas_sdk.v1.data.patient import Patient
from logger import log

patient_id = "d7af3e356368446c85b40a5d6ff7288e"
patient = Patient.objects.get(id=patient_id)
patient_contacts = patient.telecom.all()

for contact in patient_contacts:
   log.info(f"Patient contact: {contact.system} - {contact.value}") # phone - 5555555555

PatientExternalIdentifier #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
patientPatient
useString
identifier_typeString
systemString
valueString
issued_dateDate
expiration_dateDate
from canvas_sdk.v1.data.patient import Patient
from logger import log

patient_id = "d7af3e356368446c85b40a5d6ff7288e"
patient = Patient.objects.get(id=patient_id)
patient_external_identifiers = patient.external_identifiers.all()

for identifier in patient_external_identifiers:
   log.info(f"Patient external identifier: {identifier.system}, {identifier.value}")  # https://www.example.com - abc123

PatientSetting #

Field NameType
dbidInteger
createdDateTime
modifiedDateTime
patientPatient
nameString
valueJSON

PatientMetadata #

Field NameType
dbidInteger
patientPatient
keyString
valueString
from canvas_sdk.v1.data.patient import Patient
from logger import log

patient_id = "d7af3e356368446c85b40a5d6ff7288e"
patient = Patient.objects.get(id=patient_id)
patient_metadata = patient.metadata.all()

for metadata in patient_metadata:
   log.info(f"Patient metadata: {metadata.key}, {metadata.value}") # favorite_color - red

PatientFacilityAddress #

Field NameType
patientaddressPatientAddress
facilityFacility
room_numberString

Enumeration types #

SexAtBirth #

ValueLabel
Ffemale
Mmale
Oother
UNKunknown
”” (empty string)””

Computed Properties #

Patient #

  • full_name: The full name of the patient, combining first, middle, and last names.
  • preferred_pharmacy: The patient’s preferred pharmacy for medication fulfillment.
  • preferred_full_name: The patient’s preferred full name, if different from the legal name.
  • preferred_first_name: The patient’s preferred first name, if different from the legal first name.
  • primary_phone_number: The patient’s primary contact number.