# AgriTech Chad
Pipeline de prédiction du rendement agricole pour le Tchad — **production-ready**.
## Stack technique
- **Backend** : FastAPI + SQLAlchemy (SQLite local, bascule PostgreSQL via `AGRITECH_DATABASE_URL`)
- **Frontend** : React + Vite + Tailwind + Recharts
- **ML** : scikit-learn, XGBoost, LightGBM, CatBoost, Optuna, SHAP, Evidently AI
- **Sécurité** : JWT (python-jose), bcrypt (passlib), rate limiting (slowapi)
- **Orchestration** : Prefect (ré-entraînement périodique)
- **CI/CD** : GitHub Actions + déploiement Render
## Structure du projet
```
agritech_chad/
├── backend/
│ ├── app.py # API FastAPI (v2.0.0)
│ ├── security.py # Authentification JWT
│ ├── database.py # SQLite/SQLAlchemy
│ ├── models.py # ORM (User, Prediction)
│ ├── schemas.py # Pydantic v2
│ ├── schema_validation.py # Validation CSV stricte
│ └── logging_config.py # Logs structurés JSON
├── frontend/
│ └── src/
│ ├── App.jsx # Interface principale
│ ├── predictionApi.js # Client API
│ └── components/ # Footer, StatCard, etc.
├── src/
│ ├── prediction_service.py # Service de prédiction (conformal + SHAP)
│ ├── interpretability.py # SHAP (explication des prédictions)
│ ├── conformal_prediction.py # Intervalles de confiance calibrés
│ ├── drift_monitoring.py # Evidently AI (data/model drift)
│ ├── train_model_advanced.py # Pipeline avancé (4 modèles + stacking)
│ └── pipeline_orchestrator.py # Prefect flows
├── models/ # Modèles entraînés (.joblib)
├── data/ # Données (train.csv, test.csv)
├── outputs/ # Soumissions générées
├── tests/ # Tests unitaires
├── .github/workflows/ci.yml # CI/CD
├── render.yaml # Déploiement Render
└── requirements.txt # Dépendances Python
```
## Installation
```bash
# Backend
python -m venv .venv
source .venv/b …