AI pipeline for elephant movement prediction and village early warning in Botswana
# Elephant Tracking & Early Warning System 🐘🛰️
A professional, real-time prediction and monitoring dashboard for elephant movement and human-elephant conflict mitigation in Southern Africa.
## 🌟 Key Features
* **Live LSTM Predictions:** Uses a dual-layer Recurrent Neural Network (PyTorch) to predict movement paths 48 hours in advance based on historical kinematics and environmental data.
* **GPS Drift Correction:** Implements an anchor-based snapping algorithm to ensure high-precision trajectory visualization.
* **Environmental Context:** Real-time integration of Satellite data (NDVI, Rainfall) via Google Earth Engine and OpenStreetMap settlement data.
* **Interactive Dashboard:** React-based UI with interactive Leaflet maps, satellite/dark basemaps, and predictive probability zones.
* **Predictive Reasoning:** NEW! Transparent "Drivers" for every prediction (e.g., Vegetation Density, Human Proximity) to explain model decisions.
* **Early Warning Scenarios:** Includes 5 professionally staged demo scenarios (Crop Raid, Poaching Threat, Village Proximity) for client presentations.
## ⚙️ Model Compatibility
> [!IMPORTANT]
> The models were trained in a cutting-edge environment. For successful deployment (avoiding `Pickle` or `KeyError`), ensure your environment matches these versions:
> - **Python:** 3.14+
> - **PyTorch:** 2.10.0+
> - **Scikit-Learn:** 1.8.0+
> - **Joblib:** 1.5.3+
> - **Pandas:** 2.3.3+
> - **Numpy:** 2.4.2+
## 🏗️ Technical Architecture
```text
[ Data Sources ] -> [ Feature Engine ] -> [ LSTM Predictor ] -> [ FastAPI Backend ] -> [ React Dashboard ]
(Dryad, GEE) (OSM, Rainfall) (PyTorch Weights) (REST Service) (Vite/Shadcn)
```
### 0. Git LFS (Required for Models & Data)
This project uses **Git Large File Storage (LFS)** to manage weights and CSV datasets.
```powershell
# Install LFS and pull the actual binary data
git lfs install
git lfs pull
```
### 1. Backend (FastAPI)
```powershell
cd early_warning_pipeline
p …