Predicts quality of soil for any coordinate in Africa and recommends fertiliser to maximise yield
# SoilIntelligence
Precision agriculture decision support system. Analyses soil nutrient levels, predicts crop yield with uncertainty quantification, and prescribes exact fertiliser quantities — all backed by 244,000+ global soil samples and real-time market data.
## What it does
1. **Soil analysis** — Assesses N, P, K, Ca, Mg, pH, organic carbon and gives an overall quality score
2. **Yield prediction** — Monte Carlo forecasting using Liebig's Law (limiting factor) with 90% confidence intervals
3. **Fertiliser recommendations** — Exact product quantities (DAP, Urea, MOP) with cost and ROI
4. **Regional benchmarking** — Compares your soil against 49k real African + 195k global reference samples
5. **Risk assessment** — Probability statements ("82% chance of positive ROI") with LOW/MODERATE/HIGH tiers
## How it works
```
Soil test results or GPS coordinates
↓
Nutrient analysis + quality scoring
↓
Monte Carlo yield prediction (1000 simulations, 90% CI)
↓
Fertiliser prescription + ROI calculation
↓
PDF report for farmer
```
## Data sources
| Source | Coverage | Size |
|--------|----------|------|
| iSDA Africa | 49,225 field samples with measured nutrients | 10 MB |
| WoSIS Global | 195,000+ modelled samples worldwide | 14 MB |
| SoilGrids API | 250m resolution soil properties (ISRIC) | Live |
| Open-Meteo | Weather forecasts and soil moisture | Live |
| FAO GIEWS | Crop price data | Live |
| World Bank | Fertiliser commodity prices | Live |
## Running locally
```bash
pip install -r requirements.txt
python web.py
```
Open
127.0.0.1.
## Tech stack
- **Backend**: Flask, pandas, numpy, scipy
- **Frontend**: HTML/CSS/JS, Leaflet.js maps
- **ML**: Random forest benchmarking, Liebig's Law yield model, Monte Carlo uncertainty
- **Reports**: fpdf for PDF generation
## License
MIT