refactor(occupancy): PR #54 review follow-ups — third copy of the counted-camera rule, window-end convention, test edges #66
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#66
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?
Code quality (Standards)
_COUNTED_CAMERA_JOIN/_COUNTED_CAMERA_FILTER(app/db/occupancy_repository.py:24-26) carry a comment saying every published figure goes through the one rule. But the top-entrances and top-exits lists re-apply it in Python (not c["is_excluded"] and c["is_active"], around:1061and:1084), so that copy can drift. Pre-existing. Either derive those lists from rows the SQL already filtered, or narrow the comment.get_hourly_flow_distribution_asyncnow ends at<= cycle_end, whileget_bucketed_cycle_flow_asyncstill uses< ?(:1608). Decide one convention for cycle windows. #58 moves trust onto the bucketed query, so it must keep parity (noted on #58).tests/test_trust_dataset_parity.py:27-30_insert_eventtakes bothhourandat, andatsilently overrideshour, so callers pass a dummyhour=0. Use oneepochargument, plus a helper that computes it from an hour.CONTEXT.mdCamera Group States → Multi-camera group: "…which ADR 0005's one-camera-per-group rule does not allow for. It is still counted…" reads as a contradiction. Use "violates" or "does not account for".Tests (Spec)
tests/test_trust_dataset_parity.py:15, :108-116setsCYCLE_END = CYCLE_START + 24*3600. Real callers passstart + 86400 - 0.001orreset - 0.001. With the test's value, the end-edge event lands in a 25th bucket (hour_idx = 24) that the volume-sum assertion can't see, and it pins a convention where a boundary event counts in two adjacent cycles. Test with the production edge (- 0.001), and assert the bucket indices as well as the volumes.Acceptance criteria
Related: #35, #58, PR #54.
Follow-ups from PR #54 review: third copy of the counted-camera rule, window-end convention, test edgesto refactor(occupancy): PR #54 review follow-ups — third copy of the counted-camera rule, window-end convention, test edges