Skip to content

Scorecard Operations

Operations for managing scorecard and scorecard-related data.

API Reference

ScorecardOperations

ScorecardOperations(client: Client)

Bases: BaseOperations

Class to handle all operations related to scorecards.

Note

This class is already initialized via the client and usable as client.scorecard.method

Methods:

  • current_week

    Retrieve the current week details.

  • list

    Retrieve the scorecards for a user or a meeting.

  • score

    Update the score for a measurable item for a specific week.

Functions

current_week
current_week() -> ScorecardWeek

Retrieve the current week details.

Returns:

  • ScorecardWeek

    A ScorecardWeek model instance containing current week details

Example
client.scorecard.current_week()
# Returns: ScorecardWeek(id=123, week_number=24, week_start='2024-06-10',
#                       week_end='2024-06-16')
list
list(user_id: int | None = None, meeting_id: int | None = None, show_empty: bool = False, week_offset: int | None = None) -> list[ScorecardItem]

Retrieve the scorecards for a user or a meeting.

Parameters:

  • user_id (int | None, default: None ) –

    The ID of the user (defaults to initialized user_id)

  • meeting_id (int | None, default: None ) –

    The ID of the meeting

  • show_empty (bool, default: False ) –

    Whether to include scores with None values (default: False)

  • week_offset (int | None, default: None ) –

    Offset for the week number to filter scores

Returns:

  • list[ScorecardItem]

    A list of ScorecardItem model instances

Raises:

  • ValueError

    If both user_id and meeting_id are provided

Example
# Fetch scorecards for the current user
client.scorecard.list()

# Fetch scorecards for a specific user
client.scorecard.list(user_id=42)

# Fetch scorecards for a specific meeting
client.scorecard.list(meeting_id=99)
Note

The week_offset parameter is useful when fetching scores for previous or future weeks. For example, to fetch scores for the previous week, you can set week_offset to -1. To fetch scores for a future week, you can set week_offset to a positive value.

score
score(measurable_id: int, score: float, week_offset: int = 0) -> bool

Update the score for a measurable item for a specific week.

Parameters:

  • measurable_id (int) –

    The ID of the measurable item

  • score (float) –

    The score to be assigned to the measurable item

  • week_offset (int, default: 0 ) –

    The number of weeks to offset from the current week (default: 0)

Returns:

  • bool

    True if the score was successfully updated

Example
client.scorecard.score(measurable_id=123, score=5)
# Returns: True

Async Version

The async version AsyncScorecardOperations provides the same methods as above, but with async/await support:

AsyncScorecardOperations

AsyncScorecardOperations(client: AsyncClient)

Async class to handle all operations related to scorecards.

Initialize the async scorecard operations.

Parameters:

  • client (AsyncClient) –

    The async HTTP client to use for API requests.

Async Usage

All methods have the same parameters and return types as their sync counterparts. Simply add await before each method call.

Usage Examples

from bloomy import Client

with Client(api_key="your-api-key") as client:
    # Get current week information
    week = client.scorecard.current_week()
    print(f"Week {week.week_number}: {week.week_start} to {week.week_end}")

    # List scorecards for current user
    scorecards = client.scorecard.list()
    for s in scorecards:
        print(f"{s.title}: {s.value}/{s.target}")

    # List scorecards for a specific meeting
    meeting_scorecards = client.scorecard.list(meeting_id=123)

    # Include empty values
    all_scorecards = client.scorecard.list(show_empty=True)

    # Get scorecards for previous week
    last_week = client.scorecard.list(week_offset=-1)

    # Update a score for current week
    client.scorecard.score(measurable_id=301, score=95.5)

    # Update score for next week
    client.scorecard.score(
        measurable_id=301,
        score=100,
        week_offset=1
    )
import asyncio
from bloomy import AsyncClient

async def main():
    async with AsyncClient(api_key="your-api-key") as client:
        # Get current week information
        week = await client.scorecard.current_week()
        print(f"Week {week.week_number}: {week.week_start} to {week.week_end}")

        # List scorecards for current user
        scorecards = await client.scorecard.list()
        for s in scorecards:
            print(f"{s.title}: {s.value}/{s.target}")

        # List scorecards for a specific meeting
        meeting_scorecards = await client.scorecard.list(meeting_id=123)

        # Include empty values
        all_scorecards = await client.scorecard.list(show_empty=True)

        # Get scorecards for previous week
        last_week = await client.scorecard.list(week_offset=-1)

        # Update a score for current week
        await client.scorecard.score(measurable_id=301, score=95.5)

        # Update score for next week
        await client.scorecard.score(
            measurable_id=301,
            score=100,
            week_offset=1
        )

asyncio.run(main())

Available Methods

Method Description Parameters
current_week() Get current week details -
list() Get scorecards user_id, meeting_id, show_empty, week_offset
score() Update a scorecard value measurable_id, score, week_offset

Week Offsets

Use week_offset to access past or future weeks: - Negative values go back in time (e.g., -1 for last week) - Positive values go forward (e.g., 1 for next week) - 0 or omitted means current week