Repository navigation
Phase 6: the page of a Comune with Docker, notebooks, riuso - #41
Conversation
- compose.yaml (name firms-client): api, ui on 127.0.0.1:3005, notebook (8890) and mcp (8769) profiles, cli; Dockerfile; ports and volumes from .env, complete .env.example. The MAP_KEY only from .env or a mounted file, never in an image, a log or an answer (tested). - demo/api.py: facts answers for the area of the Comune (season, last days with a MAP_KEY, per year, trust at a point); not measured is null. - demo/web: Next.js standalone, Bootstrap Italia and Leaflet from npm, Italian and English, iframe frame-ancestors, «Non è un'allerta» in view. - firms-mcp --http PORT --host HOST. - Four notebooks (#21), executed; make notebooks, notebooks-offline in CI. - CI: the Docker stack starts without a key and answers. - docs/riuso.md: installing the page for a Comune. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VFEUmXwmaxtB7PF8sSP1d4
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97ae30569a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| mask = api.store.mask | ||
| labelled = mask.label(rows) if mask is not None else rows |
There was a problem hiding this comment.
Wait for the static mask before caching recent fire classifications
When a visitor opens the page while archives are downloading, Fires.tsx requests recent data as soon as health responds, before the static mask exists. This branch then classifies untyped NRT detections without the mask, so industrial sources can appear as vegetation fires. The resulting answer remains cached for ten minutes even after the mask becomes available, and the page never requests it again during that session. Gate classification on mask readiness, or invalidate and refresh these answers when preparation completes.
Useful? React with 👍 / 👎.
| setSilent(failed(h)); | ||
| if (!failed(h)) { | ||
| setHealth(h); | ||
| if (h.data.state === "ready" || h.data.state === "failed") return; |
There was a problem hiding this comment.
Continue polling until land-cover preparation finishes
On the first startup with land cover enabled, Api.prepare() sets the archive state to ready before downloading WorldCover tiles. Stopping health polling here means the page never observes land-cover readiness: its initial season and URL-point trust requests run without land data and are not refreshed when the download finishes. A visitor who leaves the page open therefore misses the promised land classifications and receives incomplete trust results until reloading or interacting again. Track land-cover readiness and refresh the affected answers when it changes.
Useful? React with 👍 / 👎.
|
|
||
| useEffect(() => { | ||
| if (!ready || year === null) return; | ||
| ask<FireAnswer>("season", { year }).then((a) => setSeason(failed(a) ? null : a)); |
There was a problem hiding this comment.
Discard season responses for previously selected years
If a visitor selects another year before the previous season request finishes, both callbacks can update season, and the older request can finish last. The heading and active history bar then show the newly selected year while the counts and map show a different year's fires. This is particularly plausible when requests include threaded land-cover sampling. Cancel superseded requests or guard their callbacks with an effect cleanup or request identifier before updating state.
Useful? React with 👍 / 👎.
| FIRMS_MAP_KEY: ${FIRMS_MAP_KEY:-} | ||
| FIRMS_MAP_KEY_FILE: /run/secrets/firms/${FIRMS_MAP_KEY_NAME:-map_key} |
There was a problem hiding this comment.
Make the mounted key file usable by the MCP and CLI services
When deployment uses the documented secrets/map_key alternative and leaves FIRMS_MAP_KEY empty, only the demo API reads FIRMS_MAP_KEY_FILE. The MCP server's _map_key() and the CLI both use client.map_key_from_env(), which reads only FIRMS_MAP_KEY or the working directory's .env; that file is excluded from the image. Consequently, the MCP area tools and CLI operations requiring a key fail despite inheriting this mounted secret configuration. Resolve the file-backed key for those services as well.
Useful? React with 👍 / 👎.
Parte di #26. Closes #21.
What is in it
compose.yaml(name: firms-client) withfirms-client-api,firms-client-ui(127.0.0.1:3005),firms-client-notebook(profilenotebook, 8890),firms-client-mcp(profilemcp, 8769) and acli(profiletools). Ports, volume and settings from.env;.env.examplecomplete. Data in the volume atDATA_ROOT=/data..env(FIRMS_MAP_KEY) or a file in./secretsmounted read-only;.dockerignorekeeps.envandsecretsout of the images. httpx URL logging is silenced and every error message is redacted.tests/test_demo_api.pyruns the API with a fake key against a FIRMS that echoes it back, and checks the key is in no answer and no log./api/health,/api/season?year=,/api/recent?days=,/api/history,/api/trust?lat=&lon=. The numbers arefirms_client.factsanswers; without a key the last days aremeasured: falsewithnot_measured_because: no_map_key, never 0.?lat=&lon=&place=&zoom=&lang=&embed=1),frame-ancestorsfromFIRMS_UI_FRAME_ANCESTORS. The last 7 days, each archive year with its largest fires and the land under them, a bar per year, trust at a clicked point, «Non è un'allerta» always in view, presence-only note, NASA and (when used) ESA WorldCover credits.make notebooks;make notebooks-offline(03, 04, no network) runs in CI.dockerjob (build, start without a key,/api/healthand/must answer) andnotebooksjob; the check job installs thedemogroup (mypy coversdemo/).Checked
make check(208 passed, 99.1 %),make test-core,make bench(34 of 41, no change),make faithful,make docs,make notebooks-offline; webtscandnext build.docker compose build && up -dlocally: page 200 with the CSP header; archives of 14 years and WorldCover of the Palermo area downloaded; season 2023 measured (268 fires, largest events "wildfire"), trust at the 2023 fire 1.0, history per year. Without a key/api/recentis not measured; with the real key (never printed) it is measured, and the key appears in no answer, no container log and not in the image.🤖 Generated with Claude Code
https://claude.ai/code/session_01VFEUmXwmaxtB7PF8sSP1d4