feat(statistics): compare partial periods by daily average above a coverage threshold #104

Closed
opened 2026-09-25 17:29:04 +00:00 by gabogg · 0 comments
Owner

Step 2 of the pre-deck work agreed on 2026-09-25. Decisions are settled. Replaces the "suppress on any partial period" rule from #92 and resolves #100.

Problem

Production has one full-day outage (Sun 13 Sep 2026). Under the current rule it hides "vs previous week" for two weeks and "vs previous month" for September and all of October.

Decisions

  • New config key statistics_min_comparison_coverage (default 0.80, validated to 0.5–1.0), stored and editable with the other occupancy settings. No magic number in code.
  • Coverage = covered business days / business days (Closed Days excluded, see step 1).
  • Both periods complete: compare totals (as today).
  • Either period partial but both at or above the threshold: compare daily averages over covered days; the response says so (e.g. basis: DAILY_AVERAGE) and the partial badge shows.
  • Either period below the threshold: change_percent: null, reason PARTIAL_PERIOD (as today).
  • Applies to the summary comparisons and the entrance comparisons.
  • Glossary: no new term; Partial Period keeps meaning "data is missing".

🤖 Generated with Claude Code

Step 2 of the pre-deck work agreed on 2026-09-25. Decisions are settled. Replaces the "suppress on any partial period" rule from #92 and resolves #100. ## Problem Production has one full-day outage (Sun 13 Sep 2026). Under the current rule it hides "vs previous week" for two weeks and "vs previous month" for September and all of October. ## Decisions - New config key `statistics_min_comparison_coverage` (default `0.80`, validated to 0.5–1.0), stored and editable with the other occupancy settings. No magic number in code. - Coverage = covered business days / business days (Closed Days excluded, see step 1). - Both periods complete: compare totals (as today). - Either period partial but both at or above the threshold: compare **daily averages** over covered days; the response says so (e.g. `basis: DAILY_AVERAGE`) and the partial badge shows. - Either period below the threshold: `change_percent: null`, reason `PARTIAL_PERIOD` (as today). - Applies to the summary comparisons and the entrance comparisons. - Glossary: no new term; Partial Period keeps meaning "data is missing". 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#104
No description provided.