feat(statistics): data-quality marker inputs for the deck (records skip unreliable days, per-bucket gap flag) #129
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral#129
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Route changes the statistics deck's data-quality marker needs. Decided with the maintainer on 2026-09-26 while settling the open points of the deck RFC (#80); the marker's design is in the RFC. The verdict rule itself (which verdict makes a day excluded or trusted) is #128; this issue builds on it.
Marker model (context, decided)
Each business day that is not a Closed Day is in one of five states:
gap_estimated)trusted=false, not excluded)has_data=falseand not closedThe marker ignores
min_data_trust(no trust-score threshold, as decided in #106). The field stays for admin use.Changes
Records skip unreliable days. In
get_statistics_summary_async(analytics_service.py), totals and averages keep including marked days, but the records never come from an unreliable (excluded or missing) day:peak(highest people inside);best_day(month) andbusiest_day(week).If every covered day is unreliable, return the record as absent (
null, omitted like the other optional sections) rather than quoting a broken day. Missing days already have no data, so in practice this is "skip excluded days".Per-bucket gap flag on the intraday route. Add
gap_estimated: booltoHourlyFlowBucket(app/schemas/statistics.py), using the same gap-overlap rule as the daily series'HourlyVisitors.gap_estimated, at the requestedbucket_minutes(15, 30 or 60). The Day view hatches those buckets on "visitors by hour" and "people inside over the day". The response-levelgap_estimatedstays.Tier counts on the period quality.
PeriodQualityhasgap_estimated_daysandexcluded_days. Add counts so the top-bar badge can show both tiers without fetching the daily series:unverified_days: no current verdict, or not trusted and not excluded;missing_days: no data, not closed.These must use the same day classification as the daily rows. A day in several states counts once, in its worst tier. Document the precedence: excluded > missing > unverified > estimated.
Gap intervals for the detail panel. The marker's detail panel (numpad
*) lists each marked day in plain language, e.g.TUE 15 · counter gap 14:00–15:10, estimated. Expose each estimated gap's start and end per daily row (e.g.gaps: [{start_epoch, end_epoch}], only whengap_estimated), reusing the gap records the gap rule already reads.Update
docs/api/README.mdfor the new fields and the records rule.Tests
bucket_minutes=15, exactly the overlapping buckets are flagged; at 60, only the 14:00 bucket.Depends on #128 (the ranked verdict defines "excluded" and "unverified"). Refs #80, #106.
🤖 Generated with Claude Code