Skip to content

feat(dashboard): peak-time timestamps on daily extremes#166

Merged
cnighswonger merged 1 commit into
mainfrom
feature/daily-extremes-timestamps
May 25, 2026
Merged

feat(dashboard): peak-time timestamps on daily extremes#166
cnighswonger merged 1 commit into
mainfrom
feature/daily-extremes-timestamps

Conversation

@kanfei-code-agent
Copy link
Copy Markdown
Contributor

Summary

  • Each daily extreme on the dashboard now carries an at ISO-8601 UTC timestamp; the dashboard renders the time underneath the value so a user can tell whether "Peak 38 mph" happened at 3 AM in a storm or five minutes ago.
  • Covers wind peak, rain rate peak, and the H/L pair on every temperature, humidity, and barometer tile. Solar/UV has no daily extreme today and is out of scope.
  • Mobile CompactCard rendering deliberately unchanged — secondary line already shows H/L values.

Implementation

  • backend/app/services/daily_extremes.py: keep the single aggregate query for the 12 extremum values; add one MIN(timestamp) follow-up per non-null extreme, filtered column == raw_value AND timestamp >= midnight_utc. Earliest occurrence wins for ties. _val() now emits {"value", "unit", "at"}; naive SQLite UTC datetimes are re-stamped to UTC and serialised with a Z suffix so new Date(iso) on the frontend parses correctly.
  • frontend/src/api/types.ts: new ExtremeReading type ({ value, unit, at: string | null }); DailyExtremes fields swap from ValueWithUnit | null to ExtremeReading | null.
  • TileRenderer plumbs highAt / lowAt / peakAt / peakRateAt into each gauge. Each gauge calls the existing formatTimestamp helper to render either "at HH:MM AM/PM" (wind peak, rain peak) or "H 2:45 PM · L 11:30 PM" (Temp / Humidity / Barometer).

Review

  • qwen3:30b: APPROVE
  • Codex (final): APPROVE — non-blocking notes: per-column index could speed the _at scans (timestamp index alone bounds them to today's ~8.6K rows, ~12 scans per request), and tests cover tied maxima but not tied minima symmetrically.

Test plan

  • cd backend && python -m pytest ../tests/backend/ -q — 426 pass (was 421; +5 from new test_daily_extremes.py)
  • cd frontend && npx tsc --noEmit — clean
  • cd frontend && npm run build — clean
  • py_compile on changed Python files — clean
  • Manual: load the dashboard, confirm Wind tile shows "Peak X mph / at HH:MM" and Temperature/Humidity/Barometer tiles show "H .. · L .." times. Reset DB → confirm no timestamp lines render before the first reading.

🤖 Generated with Claude Code

Each daily extreme (wind peak, rain rate peak, temperature/humidity/
barometer hi & lo) now carries an ``at`` ISO-8601 timestamp marking
when today's high or low was first reached.  The dashboard renders
the time underneath the extreme value so a user can tell whether
"Peak 38 mph" happened at 3 AM during a storm or five minutes ago.

* ``get_daily_extremes`` adds ``at`` to each returned dict via small
  follow-up ``MIN(timestamp)`` queries against the same column =
  value the aggregate returned (tied extrema resolve to the earliest).
* Each gauge accepts optional ``highAt``/``lowAt``/``peakAt`` props;
  desktop tiles render ``H 2:45 PM · L 11:30 PM`` (or "at HH:MM AM/PM"
  for single-extreme tiles).  Mobile ``CompactCard`` paths unchanged.
* Solar/UV has no daily extreme today; out of scope.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cnighswonger cnighswonger merged commit a6eb6cc into main May 25, 2026
3 checks passed
@cnighswonger cnighswonger deleted the feature/daily-extremes-timestamps branch May 25, 2026 15:55
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