How EarthSight actually works
Nine real stages, each with a real input, a real process, and a real output. No stage here is decorative.
1. Citizen Evidence
Input
A photo taken with a phone camera.
Process
Client-side compression: resized to a max 1600px edge and re-encoded as JPEG.
Output
A compact image payload ready for real analysis, sized to fit storage and API limits.
2. AI Hazard Analysis
Input
The compressed image, sent to a server-only route.
Process
Google Gemini's vision model analyzes the actual image and returns structured JSON: hazard type, material, severity, confidence, indicators, reasoning.
Output
A real HazardAnalysis object — no lookup table, no fabricated confidence.
3. Location
Input
Browser GPS coordinates, or a typed address.
Process
GPS is used directly. A typed address is forward-geocoded via Open-Meteo's Geocoding API. Neither path falls back to a default coordinate — geocoding failure blocks the pipeline with an explicit error.
Output
Real latitude/longitude, tagged with their source (gps / geocoded).
4. Weather
Input
The real coordinates from step 3.
Process
Open-Meteo's Forecast API returns current precipitation and an hourly forecast, scanned for the first hour crossing a meaningful rain threshold.
Output
Current rainfall, forecast rainfall, rain probability, hours until rain.
5. Terrain
Input
81 real elevation samples across a 9×9 grid (≈480m window) centered on the hazard.
Process
D8 steepest-descent flow routing, then flow accumulation processed highest-to-lowest elevation — computed locally, not an API call.
Output
Depression depth, upslope catchment size, mean slope, and a 0-1 flood exposure score.
6. Risk Engine
Input
AI severity, weather, terrain, and the reporter's hazard category.
Process
A deterministic weighted sum, with every contribution logged as a RiskFactor. Forecast-driven escalation is only added when rainfall or probability clears a real significance threshold.
Output
Current risk, projected risk, and the full factor list behind both.
7. Cascade Detection
Input
Every hazard with real terrain data.
Process
Pairwise haversine distance, elevation drop, and gradient checks build a directed graph; connected components become hazard chains.
Output
Which hazards share a drainage path, in what order, and the outlet's compounded risk.
8. Intervention Simulation
Input
The report's real RiskFactor list and a category-scoped intervention.
Process
Matched factor contributions are reduced by a fixed, documented fraction and the same clamp/combine logic the risk engine uses is re-run.
Output
A real simulated current/projected risk if the intervention were taken.
9. Priority Action
Input
Projected risk, rainfall urgency, AI confidence, and cascade involvement.
Process
A transparent point formula (documented in lib/actionPriority.ts) — every point is named, not a black-box score.
Output
Low / Medium / High / Urgent, with the reasons listed alongside it.