Logo Lanfrica

DonOmbisi/agrisignal

Domaine:

agriculture

Type de record:

software
Créateur:
Don
Hôte:
Weather-Driven Agricultural Market Intelligence for Kenya's export crop sector. AgriSignal combines hyperlocal weather forecasts, statistical Z-score risk modeling, and econometric price signals to deliver actionable intelligence for tea, coffee, cut flowers, avocado, French beans, and macadamia markets. # AgriSignal **Weather-Driven Agricultural Market Intelligence** for Kenya's export crop sector. AgriSignal combines hyperlocal weather forecasts, statistical Z-score risk modeling, and econometric price signals to deliver actionable intelligence for tea, coffee, cut flowers, avocado, French beans, and macadamia markets. --- ## Architecture ``` Next.js 14 (Vercel) -> FastAPI Backend (Railway) -> WeatherAI API (server-side only) -> Open-Meteo Archive (30d baseline) -> Supabase PostgreSQL ``` Three-tier architecture: 1. **Frontend** - Next.js 14 App Router, Tailwind, Recharts (Vercel) 2. **Backend** - FastAPI quant engine with APScheduler jobs (Railway) 3. **Database** - Supabase PostgreSQL tables with date/county/crop indexes The frontend **never** calls WeatherAI directly. All weather and tree analysis requests are proxied through the FastAPI backend. --- ## Risk Model Summary AgriSignal computes a multi-factor Supply Risk Index (SRI) by normalizing drought, temperature, wind, and flood factors as Z-scores against a 30-day Open-Meteo historical baseline, then weighting by crop-specific sensitivities. Logistics Risk Index (LRI) uses hourly precipitation intensity and wind disruption. Price Pressure Signal comes from weekly OLS regression of lagged SRI against 7-day-forward commodity price changes. ### Walk-Forward Validation **Why walk-forward validation replaced in-sample R²:** The original implementation reported in-sample R² as "confidence," which measures how well the model fits historical data but does not indicate predictive skill. With limited weekly observations per county-crop pair, in-sample R² can appear deceptively good while having no real forecasting value. **Current approach:** - **Expanding-window cross-validation**: Fit on weeks 1..N (minimum 8 weeks), predict week N+1, slide forward, repeat - **Out-of-sample metrics**: Directional hit rate (primary judge-legible metric), out-of-sample R², MAE - **Reliability threshold**: Models w …