Staff
Introduction #
The Staff model represents a staff member in a Canvas instance.
To get a Staff object by it’s identifier, use the get method:
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
To list every staff member, use Staff.objects.all(). When you need a stable cross-system mapping, prefer the immutable dbid (integer) and id (UUID) attributes over names, which can change:
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.all()
staff_dbids = [s.dbid for s in staff]
staff_ids = [s.id for s in staff]
A command’s committer is a CanvasUser, not a Staff record, so its dbid is the user’s dbid — not the staff dbid. To resolve a committer back to the Staff record, look it up by user, not dbid:
from canvas_sdk.v1.data.staff import Staff
# command_instance.committer is a CanvasUser
staff = Staff.objects.get(user=command_instance.committer)
Staff objects are commonly used in related models, for example the Task model. To see all of a staff member’s assigned or created tasks, the following code can be used:
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
staff.assignee_tasks.all()
# <QuerySet [<Task: Task object (3)>]>
staff.creator_tasks.all()
# <QuerySet [<Task: Task object (7)>]>
To show a Staff member’s contact points (email, phone, etc.), the telecom attribute can be used. For example:
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
[(t.system, t.value,) for t in staff.telecom.all()]
# [('phone', '8005551416'), ('email', 'support@canvasmedical.com')]
To show a Staff full name, credentialed name, the topmost clinical role or top role abbreviation use the properties full_name, credentialed_name, top_clinical_role or top_role_abbreviation.
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
staff.full_name
# Larry Weed
staff.credentialed_name
# Larry Weed MD
staff.top_clinical_role.name
# Physician
staff.top_role_abbreviation
# MD
When a staff member holds more than one role, top_clinical_role looks only at roles in a clinical domain — those whose domain is CLINICAL or HYBRID — and returns the one with the highest domain_privilege_level. Administrative roles are never selected, even if they carry a higher privilege level. If the staff member has no clinical or hybrid roles, both top_clinical_role and top_role_abbreviation are None. Because credentialed_name appends top_role_abbreviation, it reflects the same highest-privilege clinical role.
To get Staff licenses.
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
staff.licenses.all()
# <QuerySet [<StaffLicense: CA License for Larry Weed>]>
Finding staff who can e-prescribe #
Canvas treats a staff member as able to e-prescribe when all three are true:
- Active:
activeisTrue. - Set up with Surescripts:
spi_numberis set. This is the staff member’s Surescripts prescriber ID. - A prescriber role: the
internal_codeof theirtop_clinical_roleis one of your instance’s prescriber roles. The organization’sPRESCRIBER_STAFF_ROLESsetting lists them, and they default toMD,DO,NP, andPA.
The same rule decides who can be assigned a refill request. To list these staff members:
from canvas_sdk.v1.data.organization import Organization
from canvas_sdk.v1.data.staff import Staff
roles_setting = (
Organization.objects.first().settings.filter(name="PRESCRIBER_STAFF_ROLES").first()
)
PRESCRIBER_ROLES = set(roles_setting.value) if roles_setting else {"MD", "DO", "NP", "PA"}
def can_eprescribe(staff: Staff) -> bool:
role = staff.top_clinical_role
return bool(
staff.active
and staff.spi_number
and role is not None
and role.internal_code in PRESCRIBER_ROLES
)
prescribers = [
staff
for staff in Staff.objects.filter(active=True)
.exclude(spi_number="")
.prefetch_related("roles")
if can_eprescribe(staff)
]
prefetch_related("roles") loads every staff member’s roles in one query, since top_clinical_role reads them.
Accessing the staff signature #
The signature_url property returns a presigned S3 URL for securely accessing the staff member’s signature file, when one is on file. If no signature has been uploaded, the property returns None.
from canvas_sdk.v1.data.staff import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
# Returns a presigned S3 URL (valid for 1 hour) or None
url = staff.signature_url
Reading the auth groups a role assigns #
A Role is a role defined on your instance, such as a registered nurse or a physician. Each role can have role groups, and each RoleGroup lists the auth groups Canvas adds a new staff member to when they are created with that role. Those auth groups set the staff member’s initial permissions. Changing a role’s groups later doesn’t change the groups of staff who already hold the role.
Each of a staff member’s StaffRole records links to the Role it holds through role. To list the auth groups behind each of a staff member’s roles:
from canvas_sdk.v1.data import Staff
staff = Staff.objects.get(id="4150cd20de8a470aa570a852859ac87e")
staff_roles = staff.roles.select_related("role").prefetch_related("role__role_groups__groups")
for staff_role in staff_roles:
for role_group in staff_role.role.role_groups.all():
print(staff_role.role.name, [group.name for group in role_group.groups.all()])
To find the roles that assign a given auth group, start from the AuthGroup:
from canvas_sdk.v1.data import AuthGroup
group = AuthGroup.objects.get(name="Nurses")
roles = {role_group.role.name for role_group in group.role_groups.select_related("role")}
Attributes #
Staff #
| Field Name | Type | Description |
|---|---|---|
| id | UUID | |
| dbid | Integer | |
| created | DateTime | |
| modified | DateTime | |
| prefix | String | |
| suffix | String | |
| first_name | String | |
| middle_name | String | |
| last_name | String | |
| maiden_name | String | |
| nickname | String | |
| previous_names | JSON | |
| birth_date | Date | |
| sex_at_birth | PersonSex | |
| sexual_orientation_term | String | |
| sexual_orientation_code | String | |
| gender_identity_term | String | |
| gender_identity_code | String | |
| preferred_pronouns | String | |
| biological_race_codes | Array[String] | |
| biological_race_terms | Array[String] | |
| cultural_ethnicity_codes | Array[String] | |
| cultural_ethnicity_terms | Array[String] | |
| last_known_timezone | TimeZone | |
| active | Boolean | |
| primary_practice_location | PracticeLocation | |
| npi_number | String | |
| nadean_number | String | |
| group_npi_number | String | |
| bill_through_organization | Boolean | |
| tax_id | String | |
| tax_id_type | TaxIDType | |
| spi_number | String | |
| personal_meeting_room_link | URL | |
| language | Language | |
| language_secondary | Language | |
| schedule_column_ordering | Integer | |
| state | JSON | |
| user | CanvasUser | |
| signature | File (S3 key) | |
| supervising_team | Staff[] | |
| default_supervising_provider | Staff | |
| notes | Note[] | |
| supervised_notes | Note[] | |
| creator_tasks | Task[] | |
| assignee_tasks | Task[] | |
| comments | TaskComment[] | |
| care_team_memberships | CareTeamMembership[] | |
| teams | Team[] | |
| telecom | StaffContactPoint[] | |
| external_identifiers | StaffExternalIdentifier[] | |
| metadata | StaffMetadata[] | |
| addresses | StaffAddress[] | |
| photos | StaffPhoto[] | |
| roles | StaffRole[] | |
| licenses | StaffLicense[] | |
| lab_account_numbers | StaffLabAccountNumber[] | The staff lab account numbers linked to this staff member. Doesn’t include those set to apply to all staff at a location |
| letters | Letter[] | |
| interventions | Intervention[] | |
| imaging_orders | ImagingOrder[] | |
| service_requests | ServiceRequest[] | The service requests this staff member requested |
| dme_orders | DmeOrder[] | |
| detected_issue_mitigations | DetectedIssueMitigation[] | |
| immunizations_given | Immunization[] | |
| consolidated_immunizations_given | ConsolidatedImmunization[] | |
| supervising_prescriptions | Prescription[] | |
| refill_requests | RefillRequest[] | |
| default_patients | Patient[] | |
| medication_history_responses | MedicationHistoryResponse[] | |
| transmissions_delivered | MessageTransmission[] | |
| integration_task_reviews | IntegrationTaskReview[] | |
| document_annotations | DocumentAnnotation[] | The document annotations the staff member saved |
| signed_document_annotations | DocumentAnnotation[] | The document annotations that carry the staff member’s signature |
| assignee_note_tasks | NoteTask[] | |
| assigned_claims | Claim[] | |
| appointment_set | Appointment[] | |
| prescription_set | Prescription[] | |
| note_set | Note[] | |
| prescription_change_requests | PrescriptionChangeRequest[] | |
| google_calendar_busy_blocks | GoogleCalendarBusyBlock[] | |
| google_calendar_connection | GoogleCalendarConnection | |
| full_name | String (computed) | The staff member’s first and last name, for example Larry Weed |
| credentialed_name | String (computed) | The staff member’s full name suffixed with their topmost credential abbreviation, for example Larry Weed MD |
| top_clinical_role | StaffRole (computed) | The staff member’s highest-ranking clinical role, selected by privilege level when they hold more than one, or None if they have no clinical role |
| top_role_abbreviation | String (computed) | The public credential abbreviation of top_clinical_role, for example MD, or None if there is no clinical role |
| photo_url | String (computed) | The URL of the staff member’s photo, or a placeholder image URL |
| signature_url | String (computed) | A presigned S3 URL for the staff member’s signature file, valid for 1 hour, or None if no signature is on file |
StaffContactPoint #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| system | ContactPointSystem |
| value | String |
| use | String |
| use_notes | String |
| rank | Integer |
| state | ContactPointState |
| staff | Staff |
StaffAddress #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| line1 | String |
| line2 | String |
| city | String |
| district | String |
| state_code | String |
| postal_code | String |
| use | AddressUse |
| type | AddressType |
| longitude | Float |
| latitude | Float |
| start | Date |
| end | Date |
| country | String |
| state | String |
| staff | Staff |
StaffLicense #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| staff | Staff |
| issuing_authority_long_name | String |
| issuing_authority_url | URL |
| license_or_certification_identifier | String |
| issuance_date | Date |
| expiration_date | Date |
| license_type | LicenseType |
| primary | Boolean |
| state | String |
StaffPhoto #
| Field Name | Type |
|---|---|
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| staff | Staff |
| url | String |
| title | String |
StaffRole #
| Field Name | Type |
|---|---|
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| staff | Staff |
| role | Role |
| internal_code | String |
| public_abbreviation | String |
| domain | RoleDomain |
| name | String |
| domain_privilege_level | Integer |
| permissions | JSON |
| role_type | RoleType |
Role #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| internal_code | String |
| public_abbreviation | String |
| domain | RoleDomain |
| name | String |
| domain_privilege_level | Integer |
| permissions | JSON |
| role_type | RoleType |
| role_groups | QuerySet[RoleGroup] |
| staff_roles | QuerySet[StaffRole] |
RoleGroup #
The auth groups a Role assigns to staff created with it.
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| role | Role |
| groups | QuerySet[AuthGroup] |
AuthGroup #
A named group of permissions that staff users belong to.
| Field Name | Type |
|---|---|
| dbid | Integer |
| name | String |
| role_groups | QuerySet[RoleGroup] |
RoleGroupGroup #
The join between a RoleGroup and an AuthGroup. Reach the auth groups through the role group’s groups attribute rather than querying this model.
| Field Name | Type |
|---|---|
| dbid | Integer |
| role_group | RoleGroup |
| group | AuthGroup |
StaffExternalIdentifier #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| staff | Staff |
| use | String |
| identifier_type | String |
| system | String |
| value | String |
| issued_date | Date |
| expiration_date | Date |
from canvas_sdk.v1.data.staff import Staff
from logger import log
staff_id = "4150cd20de8a470aa570a852859ac87e"
staff = Staff.objects.get(id=staff_id)
for identifier in staff.external_identifiers.all():
log.info(f"Staff external identifier: {identifier.system}, {identifier.value}")
# https://www.example.com - employee-001
StaffExternalIdentifier is the supported way to store and read an external system’s ID on a Staff/Practitioner record (the equivalent of PatientExternalIdentifier for staff). Plugins read it from this data module and write to it with the CreateStaffExternalIdentifier effect. The FHIR Practitioner.identifier field carries only the NPI: Canvas stores the first identifier’s value as the practitioner’s NPI and ignores the rest, so an external ID sent there would replace the NPI. Use StaffExternalIdentifier instead.
StaffMetadata #
| Field Name | Type |
|---|---|
| id | UUID |
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| staff | Staff |
| key | String |
| value | String |
from canvas_sdk.v1.data.staff import Staff
from logger import log
staff_id = "4150cd20de8a470aa570a852859ac87e"
staff = Staff.objects.get(id=staff_id)
for metadata in staff.metadata.all():
log.info(f"{metadata.key}={metadata.value}")
StaffMetadata is a free-form key/value store on a staff member, mirroring PatientMetadata. The (staff, key) pair is unique, so a given key has at most one value per staff member; use the StaffMetadata effect to upsert it from a plugin.
Enumeration types #
License Type #
| Value | Description |
|---|---|
| CLIA | CLIA |
| DEA | DEA |
| PTAN | PTAN |
| STATE_LICENSE | State License |
| TAXONOMY | Taxonomy |
| SPI | SPI |
| OTHER | Other |
Role Domain #
| Value | Abbreviation | Description |
|---|---|---|
| CLINICAL | CLI | Clinical |
| ADMINISTRATIVE | ADM | Administrative |
| HYBRID | HYB | Hybrid |
Role Type #
| Value | Description |
|---|---|
| NON_LICENSED | Non-Licensed |
| LICENSED | Licensed |
| PROVIDER | Provider |