Skip to content

Conversation

@ashenfad
Copy link
Owner

@ashenfad ashenfad commented Jan 1, 2026

No description provided.

@ashenfad ashenfad requested a review from Copilot January 1, 2026 08:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for hourly period aggregation to metric functions, with datetime-labeled keys instead of date keys for hour periods.

  • Adds "hour" as a valid period option for metric functions
  • Returns datetime keys for hourly periods (instead of date keys used by other periods)
  • Updates documentation to clarify return type variations based on period and group_by parameters

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/API.md Documents the new "hour" period option and explains how return key types vary by period/group_by
calgebra/metrics.py Updates _period_windows to return datetime labels for hourly periods while keeping date labels for other periods
calgebra/docs/API.md Duplicate documentation update (identical to docs/API.md)
Comments suppressed due to low confidence (1)

calgebra/metrics.py:128

  • The conversion logic on line 126 checks isinstance(dt, datetime) even though _period_windows_with_dt always returns datetime objects for all periods. This conditional is unnecessary and can be simplified to always call .date() for non-hourly periods.
    if period == "hour":
        return [(dt, ws, we) for dt, ws, we in windows]
    return [
        (dt.date() if isinstance(dt, datetime) else dt, ws, we)
        for dt, ws, we in windows
    ]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ashenfad ashenfad merged commit c9fbd60 into main Jan 1, 2026
5 checks passed
@ashenfad ashenfad deleted the polish branch January 1, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants