Care Teams

Retrieving Care Team Resources

Overview

The getCareTeams method in the b.well SDK retrieves Care Team resources representing the individuals and organizations involved in a patient's care. Care teams typically include healthcare providers, care coordinators, family members, and other participants in a patient's healthcare journey.

Method Signature

suspend fun getCareTeams(request: CareTeamsRequest?): BWellResult<CareTeam>
  • request: An object specifying the search criteria for retrieving the CareTeam resource
  • BWellResult<CareTeam>: Represents the list of Care Teams retrieved.

Data Class: CareTeam

  • id: The unique identifier for this CareTeam resource (required String)
  • resourceType: The type of FHIR resource (String, value: "CareTeam")
  • name: The human-readable name of the care team (nullable String)
  • status: The current status of the CareTeam (nullable String)
    • Common values: ACTIVE, INACTIVE, SUSPENDED, ENTERED_IN_ERROR
  • meta: Meta information about the CareTeam, like version, tags, etc (nullable Meta type)
  • identifier: Business identifiers assigned to this care team (nullable List of Identifier)
  • category: Categories or types of care teams (nullable List of CodeableConcept)
    • Examples: "Longitudinal Care-Coordination", "Episode care team", "Condition-specific care team"
  • participant: Members of the care team (nullable List of CareTeamParticipant)
    • Contains information about each participant's role, member reference, and organization

Example Usage

The following example retrieves care teams for a patient, demonstrating pagination and participant iteration:

val careTeamsResult = BWellSdk.health.getCareTeams(careTeamsRequest)
    
    if (careTeamsResult.success()) {
        careTeamsResult.resources.forEach { careTeam ->
            println("Care Team: ${careTeam.name}")
            
            careTeam.participant?.forEach { participant ->
                println("  Member: ${participant.member?.display}")
            }
        }
    } else {
        // Handle error
        println("Failed to retrieve care teams: ${careTeamsResult.error?.message}")
    }

Additional Filtering Options

You can filter Care Teams using various criteria:

val categoryRequest = CareTeamsRequest.Builder()
    .category("clinical-research")
    .page(0)
    .pageSize(20)
    .build()

Best Practices

  • Pagination: Set appropriate page and pageSize values to manage large result sets efficiently.
  • Participant Details: The participant list contains valuable information about care team members – iterate through it to display provider and organization details.
  • Error Handling: Implement robust error handling to manage potential failures in the response.