Add NWAC weather station data pages#1145
Draft
rchlfryn wants to merge 18 commits into
Draft
Conversation
Contributor
Migration Safety CheckFound 1 potential issue: 20260707_180000_add_nwac_weather_data_nav.ts Warning (line 96): DELETE keyword detected - review for data loss await db.run(sql`DELETE FROM _navigations_v WHERE parent_id = ${navId}`)Review these patterns and add backup/restore logic if needed. See |
da29ce3 to
2b84ab5
Compare
2b84ab5 to
6990abf
Compare
Contributor
|
Preview deployment: https://featxweather-station-tables.preview.avy-fx.org |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
N/A
Key Changes
src/services/snowobs): server-sidewx/v1/station/data/timeseriesfetch (token viaSNOWOBS_TOKENenv), 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.src/constants/weatherStations.ts): 32 station groups ported from the legacystation_group_tables_config—slug,legacySlug(for future redirects),region,stids,columns. Integrity-tested./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./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.How to test
pnpm dev, then loadnwac.localhost:3000/weather/stationsand/weather/stations/hurricane-ridge.404on these routes.pnpm test— covers the SnowObs transform and the registry.Screenshots / Demo video
TODO: add a screenshot of the Hurricane Ridge table.
Migration Explanation
src/migrations/20260707_180000_add_nwac_weather_data_nav.tsadds the NWAC-only "Weather Data" built-in page (/weather/stations) and a Weather-dropdown nav item to the existing NWAC tenant. It is scoped to NWAC (no-op for other tenants), idempotent, and uses raw SQL for the nav update, mirroring the existingbackfill_nav_builtin_pagesmigration.Future enhancements / Questions
/weatherdata/<slug>/now/→ new URLs (deferred;legacySlugis stored for this).🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.