app.routers._helpers¶
_helpers ¶
Shared helpers for the dashboard routers.
add_cache_headers ¶
Long cache for fully-historical queries; short cache for recent.
Source code in dashboard/backend/app/routers/_helpers.py
auto_resolution ¶
Pick a sane bucket size from the requested range.
Source code in dashboard/backend/app/routers/_helpers.py
end_exclusive ¶
Promote an inclusive 'YYYY-MM-DD' end date to the next-day bound.
API end params mean "include this whole calendar day". Comparing
col <= '2026-03-25' against a timestamp column resolves the bare date
to midnight and silently drops every intra-day row of the final day, so
query with col < end_exclusive(end) instead. Non-date strings pass
through unchanged.
Source code in dashboard/backend/app/routers/_helpers.py
nan_to_none ¶
Convert NaN/NA pandas values to None for JSON serialization.
iso_utc ¶
Emit a strict ISO-8601 UTC datetime string: 'T' separator + offset.
Space-separated datetimes are rejected by JavaScriptCore's new Date()
(Safari), and naive strings get parsed as local time, which collapses
two distinct UTC instants at DST transitions. Accepts datetime-likes
(uses .isoformat()) and strings; idempotent for already-conformant
input. Date-only strings pass through without a bogus offset.