Skip to content

Add NWAC weather station data pages#1145

Draft
rchlfryn wants to merge 22 commits into
mainfrom
feat/weather-station-tables
Draft

Add NWAC weather station data pages#1145
rchlfryn wants to merge 22 commits into
mainfrom
feat/weather-station-tables

Conversation

@rchlfryn

@rchlfryn rchlfryn commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds native weather-station data pages to AvyWeb for NWAC, recreating the nwac.us /weatherdata/<station>/now/ tables (currently a WordPress plugin). Data-first React tables backed by SnowObs, fetched server-side so the API token never reaches the browser.

Related Issues

Part of #1106

Key Changes

  • SnowObs service (src/services/snowobs): server-side wx/v1/station/data/timeseries fetch (token via SNOWOBS_TOKEN env), zod-validated response, and a pure transform → render-ready tables — cumulative precip, cross-station full-outer-join on timestamp, UTC→America/Vancouver, short sensor/unit labels. Unit-tested.
  • Station registry (src/constants/weatherStations.ts): 32 station groups ported from the legacy station_group_tables_configslug, legacySlug (for future redirects), region, stids, columns. Integrity-tested.
  • Detail route /weather/stations/[station]: ISR (10-min revalidate), 24h / 7-day range toggle, latest-observation timestamp + stale flag (>2h), per-station error isolation, notFound() for centers without the stations platform.
  • Index /weather/stations: region-grouped directory (up to 4 columns) + station picker.
  • StationNowTable: shadcn table — zebra rows, sticky time column, tightened/centered columns, stacked label/unit/elevation headers.
  • NWAC-only "Weather Data" nav item in the Weather dropdown (seed + provisioning + migration).

How to test

  • pnpm dev, then load nwac.localhost:3000/weather/stations and /weather/stations/hurricane-ridge.
  • Toggle Last 24 Hours / Last 7 Days; spot-check values against nwac.us.
  • Confirm other centers (dvac/sac/snfac) 404 on these routes.
  • pnpm test — covers the SnowObs transform and the registry.

Screenshots / Demo video

Kapture.2026-07-10.at.10.06.26.mp4

Migration Explanation

None needed - can add page via Built In Pages

Future enhancements / Questions

  • SnowObs token: currently read from env with a public fallback token committed (the same one nwac.us already serves in client HTML). Consider dropping the fallback and requiring the env var to keep secret scanners happy.
  • Region "area" pages with historical date-range browsing (prototyped separately, deferred).
  • Data Portal graphs (legacy D3 → React charts).
  • nwac.us cutover: redirects from /weatherdata/<slug>/now/ → new URLs (deferred; legacySlug is stored for this).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Preview deployment: https://featxweather-station-tables.preview.avy-fx.org

@rchlfryn rchlfryn marked this pull request as draft July 8, 2026 22:11
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