Commit 8905b7b
feat: adaptive resolution algorithm for chart data
Replaces the fixed period-to-aggregate mapping with a data-driven algorithm
that calculates optimal resolution per sensor based on actual reading frequency:
- High frequency sensors (>30/h): uses continuous aggregates (hourly/daily/monthly)
- Low frequency sensors (<~4/h): returns raw data without aggregation
- Boolean devices (REGANDO, EN COLA): returns state transitions + on/off percentage
The algorithm preserves diurnal patterns (e.g. temperature 9°C night → 23°C day)
by using hourly resolution for WEEK/MONTH scales on sensors that have enough data.
New StatsDao methods: getReadingDensity(), getRawReadings()
New DTO fields: resolution, pointCount, isBooleanDevice, transitions, booleanStats
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent df1e789 commit 8905b7b
File tree
3 files changed
+295
-117
lines changed- src/main/kotlin/com/apptolast/invernaderos/features
- statistics
- dao
- telemetry/timescaledb/dto
3 files changed
+295
-117
lines changed
0 commit comments