aicctv
Find a file
유창욱 d8b8e1f381 feat(analytics): weekday-hour pattern, precursor-spike alert, period trends
The accumulated data starts predicting instead of just recording:

- Time pattern (weekday x hour density grid): WHEN the site is dangerous, on
  one card - shift-change, post-lunch, Thursday-afternoon hotspots become
  visible. Bucketing runs in PHP on the server-local clock (site timezone)
  so the SQL stays portable (the sqlite harness has no FROM_UNIXTIME).
- Precursor-spike alert: last-7-days count of precursor signals (near-miss,
  zone entries, occupancy violations - signals, not injuries) vs the prior
  4-week weekly baseline. Ratio >= 1.5 with at least 5 samples raises a
  banner above the KPIs: an alarm on the PRECURSOR of an accident, with a
  concrete suggestion (staffing/route/rest review). Below the sample floor
  it never fires - a ratio over 2 events is noise, not statistics.
- Period-over-period trends on every KPI: reportSummary gained an optional
  upper bound so the identical aggregation runs over the preceding window.
  Worsening turns red, improving turns accent - except the near-miss count,
  which stays NEUTRAL: more near-misses may mean better detection, not more
  danger, and the report must not editorialize that.

Verified: PHPUnit 140 pass (2 new: window separation + pattern bucketing,
spike ratio + sample floor) + Chrome real-render (alert banner, KPI trend
lines, Thursday-afternoon hotspot readable in the grid).
2026-08-07 07:35:30 +09:00
deploy docs(deploy): fix MySQL/runbook/secret guidance; offline camera probe 2026-07-25 19:21:01 +09:00
docs feat(evidence): pre-event snapshot timeline + 24h catch-up brief 2026-08-07 07:25:25 +09:00
edge feat(evidence): pre-event snapshot timeline + 24h catch-up brief 2026-08-07 07:25:25 +09:00
server feat(analytics): weekday-hour pattern, precursor-spike alert, period trends 2026-08-07 07:35:30 +09:00
tests feat(evidence): pre-event snapshot timeline + 24h catch-up brief 2026-08-07 07:25:25 +09:00
.gitattributes feat(delivery): install-path fixes + cafe24 package + delivery-audit hardening 2026-07-17 09:07:33 +09:00
.gitignore feat(deploy): read pre-provisioned values from deploy/device.env 2026-07-20 23:06:39 +09:00
CLAUDE.md docs: add CLAUDE.md + PROJECT_MAP/INDEX for session continuity 2026-08-06 17:02:39 +09:00
pyproject.toml feat(edge): runnable daemon loop (step + periodic sync/heartbeat/flush) 2026-07-12 11:00:08 +09:00