Skip to main content

Module bucketing

Module bucketing 

Source
Expand description

Time-bucket conversions for analytics.

Converts between integer day_id / hour_id keys (as stored in SQLite rollup tables) and human-readable ISO date strings used in JSON output.

Functionsยง

day_id_to_iso
Format a day_id as an ISO date string (YYYY-MM-DD).
day_id_to_iso_week
Compute the ISO week key (YYYY-Www) from a day_id.
day_id_to_month
Compute the month key (YYYY-MM) from a day_id.
hour_id_to_iso
Format an hour_id as an ISO datetime string (YYYY-MM-DDTHH:00Z).
resolve_day_range
Resolve the time-range from AnalyticsFilter into an inclusive (min_day_id, max_day_id) range. Returns (None, None) when no time filter is active.
resolve_hour_range
Resolve the time-range from AnalyticsFilter into an inclusive (min_hour_id, max_hour_id) range.