Skip to content

Pin the four demo questions and prewarm their popups - #54

Closed
prayaslashkari wants to merge 4 commits into
developmentfrom
feat/demo-questions-prewarmed
Closed

prayaslashkari wants to merge 4 commits into
developmentfrom
feat/demo-questions-prewarmed

Conversation

@prayaslashkari

Copy link
Copy Markdown
Collaborator

For the Proto-OKN close-out demo.

What

  • The four demo questions are pinned to the top of PREBUILT_QUERIES, so they are the four landing-page cards:

    1. Samples Near Airport Facilities in Indiana (~2 mi) — matches shared page p_26aba422
    2. Surface Water Bodies Near Airport Facilities in Indiana (~1 mi) — p_87619f3e
    3. Facilities Upstream from PFOS Samples in York and Cumberland Counties
    4. Indiana Samples Downstream of Airports & Air Transportation Sites — p_15e83a0c

    The first two and the fourth carry the exact question JSON from the shared pages, so they hit the same cache keys. Thumbnails rebuilt from live runs (all four return data).

  • Sample popups can now be served from the cache. useSampleDetails reads GET /api/results/s:<hash> first and falls back to the live SPARQL query on any miss or error, so nothing changes for questions that were never warmed. The s: namespace reuses the existing query_results table; PUT still requires CACHE_WRITE_TOKEN.

  • npm run warm-sample-details fills those entries for the demo questions (defaults to the three sample-bearing ones).

Checks

check-cache-key grew five assertions for sampleDetailKey (stability, distinct points, filters in the key, emptied filter still hits, s: namespace). All four check scripts pass; npm run build clean; npm run lint unchanged (30 pre-existing errors on both sides).

After merge

Run against the development API with the write token:

CACHE_WRITE_TOKEN=... API_BASE=https://sawgraph-explorer-api-development.up.railway.app npm run warm-cache
CACHE_WRITE_TOKEN=... API_BASE=... npm run warm-sample-details

@railway-app
railway-app Bot temporarily deployed to sawgraph-explorer / explorer-app-pr-54 September 18, 2026 03:19 Destroyed
@railway-app

railway-app Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the explorer-app-pr-54 environment in sawgraph-explorer

Service Status Web Updated
sawgraph-web ✅ Success (View Logs) Web Sep 20, 2026 at 3:12 pm UTC
sawgraph-api ✅ Success (View Logs) Web Sep 20, 2026 at 3:12 pm UTC

@railway-app
railway-app Bot temporarily deployed to sawgraph-explorer / explorer-app-pr-54 September 18, 2026 03:26 Destroyed
@railway-app
railway-app Bot temporarily deployed to sawgraph-explorer / explorer-app-pr-54 September 18, 2026 04:22 Destroyed
Puts the Proto-OKN close-out demo set at the top of PREBUILT_QUERIES so they
are the four landing-page cards, with thumbnails built from live runs.

Sample popups previously hit the SPARQL endpoints on every click. Adds an
`s:` key namespace in the existing result cache, a read-through in
useSampleDetails (any miss or error falls back to the live query, as before),
and scripts/warm-sample-details.mts to fill it for the demo questions.
The Indiana water-bodies-near-airports demo question serialises to 26.6MB of
polygon geometry and was rejected by the route body limit (a bare 413 from
express, before our own size check).
Leaflet measures a popup when it opens; react-leaflet calls update() on
popupopen and never again. The observation rows arrive after that, so the
first open kept the placeholder's size and anchor and the content spilled out
of the box. The second open looked right only because React Query already had
the rows.
…uestion

The demo question asked for facilities in York and Cumberland that are
upstream of PFOS samples in those same counties. An upstream source can
sit outside the county its sample is in, so the county scope belongs to
the samples alone.

Both this and samples-downstream-airports-indiana now lead with the
target under development's narrowness ranking; check-query-joins expects
that. Thumbnail rebuilt from a live run (8670 points, 3925 lines).
@prayaslashkari

Copy link
Copy Markdown
Collaborator Author

Superseded by #59, which is the same work rebased onto current development and cut to the demo branch, plus a duplicate-script-entry cleanup. Closing so there is only one demo PR to review and no risk of merging the older head.

This branch was successfully deployed

No deployments
sawgraph-explorer / explorer-app-pr-54 — e9d255ca Deployed Sep 20, 2026 by railway-app[bot]
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