Team

Introduction #

The Team model represents a team of staff members in a Canvas instance.

Basic usage #

To get an team by identifier, use the get method on the Team model manager:

from canvas_sdk.v1.data.team import Team

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

If you have a staff object, the teams that a staff is a member of can be accessed with the teams attribute on a Staff object:

from canvas_sdk.v1.data.staff import Staff

staff = Staff.objects.get(id="1eed3ea2a8d546a1b681a2a45de1d790")
teams = staff.teams.all()

Team Members #

The members of a team can be access with the members attribute on a Team object:

from canvas_sdk.v1.data.team import Team
from logger import log

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

for member in team.members.all():
    log.info(f"first_name: {member.first_name}")
    log.info(f"last_name: {member.last_name}")

Reconciling with FHIR #

A team’s group_id is the same identifier used to represent the team in the FHIR Group endpoint. Use it to cross-reference a Team between the SDK and FHIR.

Given a Team, you can use its group_id with the Canvas FHIR client to fetch the corresponding FHIR Group payload:

from canvas_sdk.clients.canvas_fhir import CanvasFhir
from canvas_sdk.v1.data.team import Team

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

# Declare these secrets in the CANVAS_MANIFEST.json and set the values on the
# plugin configuration page.
client = CanvasFhir(
    self.secrets["CANVAS_FHIR_CLIENT_ID"],
    self.secrets["CANVAS_FHIR_CLIENT_SECRET"],
)

# Use the team's group_id to read the corresponding FHIR Group resource.
group = client.read("Group", str(team.group_id))

Filtering #

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

Filtering for teams is done with the filter method on the Team model manager.

By attribute #

Specify an attribute with filter to filter by that attribute:

from canvas_sdk.v1.data.team import Team

teams = Team.objects.filter(created__gt="2025-01-01")

Attributes #

Team #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
nameString
responsibilitiesArray[TeamResponsibility]
membersStaff[]
group_idUUID

TeamContactPoint #

Field NameType
idUUID
dbidInteger
systemContactPointSystem
valueString
useContactPointUse
use_notesString
rankInteger
stateContactPointState
teamTeam

Enumeration types #

TeamResponsibility #

Field NameType
COLLECT_SPECIMENS_FROM_PATIENTCollect specimens from a patient
COMMUNICATE_DIAGNOSTIC_RESULTS_TO_PATIENTCommunicate diagnostic results to patient
COORDINATE_REFERRALS_FOR_PATIENTCoordinate referrals for a patient
PROCESS_REFILL_REQUESTSProcess refill requests from a pharmacy
PROCESS_CHANGE_REQUESTSProcess change requests from a pharmacy
SCHEDULE_LAB_VISITS_FOR_PATIENTSchedule lab visits for a patient
POPULATION_HEALTH_CAMPAIGN_OUTREACHPopulation health campaign outreach
COLLECT_PATIENT_PAYMENTSCollect patient payments
COMPLETE_OPEN_LAB_ORDERSComplete open lab orders
REVIEW_ERA_POSTING_EXCEPTIONSReview electronic remittance posting exceptions
REVIEW_COVERAGESReview incomplete patient coverages