4.0 KiB
4.0 KiB
phase, plan, subsystem, tags, requires, provides, affects, tech-stack, key-files, key-decisions, patterns-established, requirements-completed, duration, completed
| phase | plan | subsystem | tags | requires | provides | affects | tech-stack | key-files | key-decisions | patterns-established | requirements-completed | duration | completed | |||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 15-signal-trending-site-alerting | 02 | api |
|
|
|
|
|
|
|
|
|
3min | 2026-03-19 |
Phase 15 Plan 02: Signal Trending & Alert Evaluation Summary
Hourly trend detection comparing 7d/14d signal averages plus 5-minute alert rule evaluation with hysteresis across 4 rule types, with TypeScript API clients for Plan 03 UI
Performance
- Duration: 3 min
- Started: 2026-03-19T12:14:19Z
- Completed: 2026-03-19T12:17:00Z
- Tasks: 2
- Files modified: 4
Accomplishments
- Trend detector scans active/degraded wireless links hourly, creates signal_degradation alerts when 7d avg drops 5+ dB from 14d baseline
- Alert evaluator checks all enabled rules every 5 minutes with hysteresis (2 consecutive hits before confirming)
- Both tasks wired into lifespan with non-fatal startup and graceful cancel on shutdown
- Three frontend API clients (signalHistoryApi, alertRulesApi, alertEventsApi) ready for Plan 03 UI components
Task Commits
Each task was committed atomically:
- Task 1: Create trend detection and alert evaluation scheduled tasks -
c3ae48e(feat) - Task 2: Add frontend TypeScript API clients -
b9a92f3(feat)
Files Created/Modified
backend/app/services/trend_detector.py- Hourly signal trend detection loopbackend/app/services/alert_evaluator_site.py- 5-minute alert rule evaluation with hysteresisbackend/app/main.py- Wired both tasks into lifespan startup/shutdownfrontend/src/lib/api.ts- Added signalHistoryApi, alertRulesApi, alertEventsApi clients
Decisions Made
- Used getattr with fallback for config settings so services work before Plan 01 adds settings to the Settings class
- Derived site_id via JOIN on devices table since wireless_links has no direct site_id FK
- Alert events created immediately with consecutive_hits=1; confirmed when hits reach 2
- Auto-assigned severity: critical for device_offline rules, warning for sector-scoped rules
Deviations from Plan
None - plan executed exactly as written.
Issues Encountered
None.
User Setup Required
None - no external service configuration required.
Next Phase Readiness
- Backend scheduled tasks ready for signal degradation detection and alert evaluation
- Frontend API clients ready for Plan 03 UI components (signal charts, alert rules tab, notification bell)
- Depends on Plan 01 completing first (database tables, config settings, router endpoints)
Phase: 15-signal-trending-site-alerting Completed: 2026-03-19