# Iteration Log - 2026-07-22-1905-adhoc ## Request & Scope - **Request**: Resolve telemetry bandwidth mismatch between main dashboard and detail modals by implementing time range-based summation. - **Affected Components**: Proxy Collector, Backend routes (`/summary`, `/app-details`, `/device-details`). ## Steps Taken 1. **Analysis**: Verified that MongoDB stored 24h cumulative snapshots periodically, which the backend then incorrectly `$sum`med across multiple periods, causing Terabyte multiplication. 2. **Proxy Redesign**: Changed the collection interval parameter from `1440` (24h) to `5` (5m) in all `netify` queries inside `proxy/collector.js`, `proxy/collectorHelper.js`, and `proxy/collectorHelperDpi2.js`. 3. **Backend Refactoring**: - `/summary`: Grouped and summed `bandwidth_down` and `bandwidth_up` over the timeRange filter. - `/app-details` and `/device-details`: Rewrote manual latest-timestamp deduplication logic into standard dynamic aggregation summation. 4. **Cleanup & Verification**: - Cleared existing contaminated data using `wipe_telemetry_collections.js`. - Executed a fresh collector run with `clean_and_recollect.js`. - Successfully verified endpoints with signed mock JWT credentials. ## Outcome - Real-time data is now stored in clean 5-minute delta slices. - Dashboard queries dynamically scale their sums to the active `timeRange` filter, outputting realistic MB/GB scales instead of erroneous TB values.