feat(occupancy): publish reviewed historical flow without calibrating #164

Open
opened 2026-09-27 23:30:05 +00:00 by gabogg · 1 comment
Owner

Part of #160.
Blocked by: #163.

Result

An admin can approve a reviewed month in one database transaction. Approved HikCentral camera-hour aggregates enter durable working storage with provenance and day-quality state, but never masquerade as passage events or teach the occupancy multiplier. Publication creates the source of truth that presentation routes can consume in #160's statistics child.

Acceptance

  • Require completed-month status, validated day reviews, historical schedule/context, and reasons for unresolved days. Publish counts, source revision, day status, provenance and approved context atomically; a failed write leaves the previous published month intact. Permit Partial/Missing days with recorded reasons, never silently converting missing intervals to zero.
  • Keep approved source-attributed hourly aggregates separate from live event rows and from staging. For each camera-hour, preserve local observations as authoritative; use imported counts only where local observation is wholly absent. Leave partially observed hours unresolved. Re-approval of changed HikCentral data replaces the published revision atomically while retaining prior snapshots and actor/time/reason audit records.
  • Maintain long-lived, source-attributed local daily/hourly rollups so year-over-year comparisons survive the existing 180-day raw-event pruning. Approved imported aggregates and the staging audit are also retained outside that pruning policy.
  • Establish an independent quality result using checks meaningful for hourly aggregates. Admin coverage approval does not itself assert sensor trust. A Complete imported day can be eligible for count/hourly-flow comparisons after quality checks; a Partial day retains its gap state. No automatic nocturnal audit should be fabricated solely from imported aggregates.
  • Add an explicit imported-or-mixed-source calibration exclusion that covers the immediate nightly multiplier update and later EWMA/variance/sample-history selection, regardless of a trusted statistical quality verdict. Revisions and context corrections may change future statistics/baseline eligibility but do not rewrite already-applied calibration.
  • Test atomic rollback, repeated approval, upstream revision, local precedence, retention and source-aware quality; prove imported/mixed days cannot change active k or enter calibration history.

The presentation routes and deck are handled by #160's statistics child. Preserve existing controller/service/repository seams and the calibration/window rules in ADR 0006.

Part of #160. Blocked by: #163. ## Result An admin can approve a reviewed month in one database transaction. Approved HikCentral camera-hour aggregates enter durable working storage with provenance and day-quality state, but never masquerade as passage events or teach the occupancy multiplier. Publication creates the source of truth that presentation routes can consume in #160's statistics child. ## Acceptance - Require completed-month status, validated day reviews, historical schedule/context, and reasons for unresolved days. Publish counts, source revision, day status, provenance and approved context atomically; a failed write leaves the previous published month intact. Permit Partial/Missing days with recorded reasons, never silently converting missing intervals to zero. - Keep approved source-attributed hourly aggregates separate from live event rows and from staging. For each camera-hour, preserve local observations as authoritative; use imported counts only where local observation is wholly absent. Leave partially observed hours unresolved. Re-approval of changed HikCentral data replaces the published revision atomically while retaining prior snapshots and actor/time/reason audit records. - Maintain long-lived, source-attributed local daily/hourly rollups so year-over-year comparisons survive the existing 180-day raw-event pruning. Approved imported aggregates and the staging audit are also retained outside that pruning policy. - Establish an independent quality result using checks meaningful for hourly aggregates. Admin coverage approval does not itself assert sensor trust. A Complete imported day can be eligible for count/hourly-flow comparisons after quality checks; a Partial day retains its gap state. No automatic nocturnal audit should be fabricated solely from imported aggregates. - Add an explicit imported-or-mixed-source calibration exclusion that covers the immediate nightly multiplier update and later EWMA/variance/sample-history selection, regardless of a trusted statistical quality verdict. Revisions and context corrections may change future statistics/baseline eligibility but do not rewrite already-applied calibration. - Test atomic rollback, repeated approval, upstream revision, local precedence, retention and source-aware quality; prove imported/mixed days cannot change active k or enter calibration history. The presentation routes and deck are handled by #160's statistics child. Preserve existing controller/service/repository seams and the calibration/window rules in ADR 0006.
Author
Owner

Unblocked: #178 merged (b64e805). The implementation is PR #171, stacked on #170.

Unblocked: #178 merged (`b64e805`). The implementation is PR #171, stacked on #170.
Sign in to join this conversation.
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#164
No description provided.