The Reverse Drought Engine is a Kenyan drought decision-support MVP that combines Conduit weather data, local drought signatures, Machakos climate analogues, resource-aware recommendations, trusted delivery, and a three-view demo dashboard.
-
Copy
.env.exampleto.env. LeaveRDE_DATA_SOURCE=fixtureuntil the authenticated Conduit endpoint and field contract are confirmed. -
Create a backend environment and install its dependencies:
python3 -m venv .venv . .venv/bin/activate python -m pip install -e 'backend[dev]'
-
Start the API from the repository root:
uvicorn app.main:app --app-dir backend --reload
-
In another terminal, install and start the frontend:
cd frontend npm install npm run dev
For the reproducible deployment path, build the two-container stack instead:
docker compose up --buildOpen http://localhost:8080; the frontend proxies API calls to the healthy
backend container. The compose stack defaults to the normal fixture profile.
Set RDE_DATA_SOURCE=recorded before docker compose up --build to replay the
checked-in Conduit-shaped response at
backend/app/data/conduit_recorded_normal.json, or set it to conduit only
after the authenticated API contract is confirmed.
The API health check is available at
http://localhost:8000/healthz. The normalized fixture reading is available
at http://localhost:8000/api/v1/readings/current. The complete data-to-impact
chain is available at http://localhost:8000/api/v1/pipeline/current.
GET /api/v1/pipeline/currentruns the live/fixture reading through ET0, water-deficit, Mode 1, Mode 2, feasibility, delivery, and trust services. Query parameters includeresource_tier,land_size_ha,distance_to_water_km,channel, andlanguage.POST /api/v1/pipeline/what-ifacceptsoverridesfor rainfall, temperature, humidity, wind, or solar values and recalculates in memory without writing to the source.GET /api/v1/explanation/currentreturns the same complete response for the Why view, including assumptions, evidence URLs, and warnings.GET /api/v1/trust/summaryandGET /api/v1/trust/recordsexpose the visible recommendation track record. The seeded records are explicitly illustrative and should be replaced with farmer confirmations or follow-up satellite evidence.
The browser UI provides Now, Why, and What-if views. The default
fixture profiles (dry, normal, and wet) make the demo reproducible
without a live station.
To print a deterministic recorded-response pipeline result without starting containers:
PYTHONPATH=backend .venv/bin/python scripts/replay_recorded_demo.pyThe replay source preserves the captured timestamp, so the response can correctly report stale data when the configured freshness window is exceeded.
The repository includes a Render Blueprint for the FastAPI backend at
render.yaml and a Vercel configuration for the frontend at
frontend/vercel.json.
- In Render, create a Blueprint from this repository. Render will detect
render.yaml, builddeploy/backend.Dockerfile, and expose the API health check at/healthz. The Blueprint uses the normal fixture profile for a reproducible demo. - Copy the deployed Render service URL, for example
https://reverse-drought-engine-api.onrender.com. - In Vercel, import the repository and set Root Directory to
frontend. Vercel will use the Vite build configuration. AddVITE_API_BASE_URLwith the Render service URL, then deploy. - Open the Vercel URL. The browser calls the Render API for
/healthz,/api/v1/pipeline/current, and the What-if endpoint.
The Render Blueprint allows all origins for the public hackathon demo
(RDE_CORS_ORIGINS=["*"]). Restrict that variable to the final Vercel URL
before using the service beyond a demo. Live Conduit mode remains opt-in and
requires the confirmed endpoint and credentials to be added as Render
environment variables.
The ET0 implementation is a deterministic Hargreaves-style approximation. It uses a configurable extraterrestrial-radiation proxy and treats SI1145 visible irradiance as a relative multiplier until Conduit units are confirmed. Rainfall is reduced by a configurable effective-infiltration factor; maize Kc, rolling-window length, rainfall baseline, soil-water buffer, and analogue thresholds are environment-backed settings. Every response includes these assumptions and any missing/stale-field warnings.
The public Conduit station page documents field labels but does not publish the
authenticated API endpoint, historical range, or request limits. Configure
RDE_CONDUIT_CURRENT_ENDPOINT and the appropriate auth variables only after
those details are confirmed. The adapter supports none, api_key, bearer,
and basic transport authentication; it does not pretend that the public
HTML login form is an API session.
See docs/conduit.md for the confirmed fields, normalization rules, and
explicitly unresolved integration questions.
See docs/demo-rehearsal.md for the three-minute presentation flow and the
validation checklist used before showing the demo.