Skip to content

FetchTimeseries: a series cadence, and range pickers that step at it - #579

Merged
BhattaraiSijan merged 1 commit into
developmentfrom
feat/timeseries-cadence
Oct 19, 2026
Merged

BhattaraiSijan merged 1 commit into
developmentfrom
feat/timeseries-cadence

Conversation

@BhattaraiSijan

@BhattaraiSijan BhattaraiSijan commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A layer's time series does not always run at the layer's own cadence. On Air4US every AQS layer declares time.interval: PT1H for its hourly map tables, while its time series is drawn from the daily tables. The range card's pickers were hardcoded to the hour for everyone, so a daily series offered a clock that meant nothing (the Air4US review asked for the hour to go).

The timeseries block now declares its own Cadence: hour (the default, today's behavior), day, month or year, authored in Configure's Timeseries row next to Default Range. The card's Start and End pickers step at it, using the Timeline DateSelector's matching mode. A picked Start opens its step and a picked End closes it, so a day runs T00:00:00 to T23:59:59, a month its first to its last day, a year Jan 1 to Dec 31; End never passes its ceiling (today). Hour mode is unchanged: picks to the minute, …:00 and …:59. An unreadable value warns and keeps the hour picker, as an unreadable Default Range does.

This is the first of two slices. The second carries the cadence in the chart-series payload so the chart's tooltip and zoom-window labels print at the same precision, replacing the date-only tooltip from #569.

What's in the diff

  • FetchTimeseries/lib/timeseries.ts: cadence? on TimeseriesConfig; parseCadence, cadenceStart, cadenceEnd, DEFAULT_TIME_MODE.
  • FetchTimeseries/FetchTimeseriesTool.tsx: the mode is read where the range is seeded for a layer and handed to the card.
  • FetchTimeseries/lib/components/RangeCard.tsx: timeMode prop, passed to both pickers; picks open and close their step.
  • configure/src/metaconfigs/layer-vector-config.json, layer-vectortile-config.json: a "Cadence" dropdown after "Default Range".
  • FetchTimeseries/README.md.
  • Tests: fetchTimeseries.spec.js (parseCadence, step open and close for the four modes, year end), fetchTimeseriesTool.spec.js (day cadence shows days and runs picks over whole days; month cadence runs 1st to last and caps at today; unreadable cadence warns and keeps the hour picker).

Testing

  • npm run test:unit green (210 files, 3600 tests) and tsc --noEmit clean.
  • Manual, on the Air4US mission: in Configure, open the PM2.5 layer's Time tab and set Cadence to "day" in the Timeseries row; save. On the map, click a site and press the time series action. Expect Start and End as days only (Sep 25, 2025, no clock). Pick a Start day: the request filter reads datetime >= '<day>T00:00:00'. Pick an End day: datetime <= '<day>T23:59:59'. Set Cadence to "month": the pickers show September 2026, and End picked as the current month stops at today.

Not in this PR

  • Slice 2: the payload carries the cadence and the chart follows it.
  • The seeded range is not aligned to the cadence: a month cadence seeds Start at 2025-09-25, shown as Sep 2025, until the first pick.
  • Hour mode still picks to the minute; whether an hourly series should snap to the hour is open.
  • The mission config: the five AQS layers need cadence: day.

🤖 Generated with Claude Code

@BhattaraiSijan BhattaraiSijan changed the title SeriesChart: CSV download named after the site and the variable FetchTimeseries: a series cadence, and range pickers that step at it Oct 19, 2026
@BhattaraiSijan
BhattaraiSijan merged commit 7b2e585 into development Oct 19, 2026
4 checks passed
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.

2 participants