Skip to content

feat(stats): 24-hour hourly traffic histogram with duty-cycle estimate#69

Open
iceice400 wants to merge 1 commit into
KMX415:mainfrom
iceice400:feat/traffic-histograms
Open

feat(stats): 24-hour hourly traffic histogram with duty-cycle estimate#69
iceice400 wants to merge 1 commit into
KMX415:mainfrom
iceice400:feat/traffic-histograms

Conversation

@iceice400
Copy link
Copy Markdown
Contributor

Summary

  • Add GET /api/stats/hourly?hours=24 — SQL-backed hourly Meshtastic/MeshCore packet counts with estimated time-on-air and duty-cycle %
  • New src/analytics/toa_estimate.py helper (shared with future PR 7 duty-cycle work)
  • Stats tab: Traffic (24h) stacked bar chart + duty-cycle line; EU868 shows dashed 1% reference limit

Why

The existing 60-minute timeline scans only the last 2000 in-memory packets. Backbone nodes need accurate 24h history from SQLite (idx_packets_timestamp).

Type

  • Bug fix
  • Feature
  • Docs
  • Refactor
  • UI
  • Installer
  • Region support
  • Hardware change

Testing

  • Local unit tests
  • Tested on hardware
  • Dashboard tested on device
python -m unittest tests.test_traffic_hourly -v

Manual checklist (on gateway):

  1. Stats tab → Traffic (24h) chart appears below 60-min chart
  2. Stacked bars show Meshtastic + MeshCore per hour; empty hours show zero height
  3. Duty cycle line labelled (est.) on secondary axis
  4. radio.region: EU_868 → dashed 1% limit line; US → no limit line
  5. Leave Stats tab open 5+ min → chart updates without flicker (data patch, not recreate)
  6. Compare one hour bucket to manual SQL on packets table

Hardware: RAK7248 or Pi + HAT · US915 / EU868

Impact

  • Parsing
  • Relay
  • TX
  • Radio driver
  • Region logic
  • UI + read-only API
  • Installer only

Risks: Low — read-only SQL aggregation; ToA is an estimate only (does not drive TX throttle). No schema migration.

AI-assisted?

  • Yes

Add SQL-backed GET /api/stats/hourly with Meshtastic/MeshCore hourly buckets and estimated duty cycle from per-modem ToA math. Stats tab shows a stacked 24h chart with EU868 1% reference line when applicable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant