Cooperative Harvest Dispatch & Risk Advisory Engine
An end-to-end, high-fidelity machine learning system and digital ops control board designed for village farming cooperatives. It predicts monsoon-related transport delays, models temperature-moisture crop spoilage indices, and uses risk-attribution curves to optimize routing and truck allocation.
Smallholder agricultural co-ops across South Asia lose up to 45% of crop value during monsoonal deluges. Heavy precipitation floods vital transport lanes (e.g., National Highway corridors), causing extensive vehicle pickup delays. For temperature-sensitive produce (like tomatoes and onions), delay exposure under high ambient humidity accelerates cellular rot, trapping farmers in severe cycles of financial hardship.
AgroPulse AI solves this with an end-to-end Machine Learning Pipeline and a tactile administrative console that:
- Predicts pickup delay timeline (Hours) and binary Delay Warnings using physical telemetry features.
- Models crop-wise spoilage hazard (%) and Spoilage Incidents via multi-variable decay curves.
- Automatically computes local attribution feature importance (SHAP-inspired) to explain predictions.
- Generates optimized logistical plans (recommending ideal vehicles, detour routes, and safe time-windows).
The AgroPulse AI ecosystem blends client-side interactive React components, full-stack Express API endpoints, generative Gemini briefings, and a production-ready scikit-learn machine learning engine.
┌───────────────────────────────────────┐
│ AgroPulse React UI │
│ (Interactive Neo-Brutalist Board) │
└──────────────────┬────────────────────┘
│
┌────────────────────┴────────────────────┐
▼ ▼
[ Express REST Gateway ] [ Open-Meteo Weather API ]
(server.ts API proxy) (Real Noida Telemetry Feed)
│ │
┌─────────┴─────────┐ ▼
▼ ▼ ┌───────────────────────────┐
[ Gemini Gen AI SDK ] [ ML Pipeline Class ] │ Noida Atmosphere Vectors │
(gemini-3.5-flash) (inference_pipeline.py) │ (Temp, Moisture, Rain mm) │
│ │ └─────────────┬─────────────┘
▼ ▼ │
[ Executive Advisor ] [ Risk Probabilities ] ◄────────────────┘
(Dynamic text brief) (Optimized Logis Plan)
AgroPulse-AI/
├── research/ # Machine Learning Core Pipeline Assets
│ ├── synthetic_data_generator.py # Spawns 5k heavy, multi-variable logistical records
│ ├── train_models.py # Preprocesses, trains, and saves Scikit-Learn pipelines
│ ├── inference_pipeline.py # Production pipeline executing predictions & optimizers
│ ├── cooperative_harvest_logistics.csv # Highly-structured historical dataset
│ ├── pickup_delay_classifier.pkl # Binary Random Forest classifier (Delay > 3 hours)
│ ├── spoil_risk_classifier.pkl # Binary Random Forest classifier (Spoilage > 40%)
│ └── pickup_delay_regressor.pkl # Continuous random forest regression model
├── server.ts # express full-stack server serving static resources and Gemini APIs
├── src/
│ ├── main.tsx # Client DOM entry point
│ ├── App.tsx # Master orchestration controller & state hooks
│ ├── types.ts # Strict type guidelines (WeatherInfo, DispatchRequest, etc.)
│ ├── index.css # Global styles & Tailwind CSS configuration
│ └── components/ # Modular building blocks:
│ ├── Navbar.tsx # Author header credits (Atharv Singh Negi) & repo links
│ ├── Hero.tsx # Dashboard main intro & active monsoon simulator trigger
│ ├── AnalyticsPanel.tsx # Live Noida weather API cards and crop risk meters
│ ├── IntakeForm.tsx # Cargo registration forms with immediate validation
│ ├── DispatchQueue.tsx # Dynamic dispatch scheduling, driver logs, & assignments
│ ├── FleetPlanner.tsx # Interactive SVG routing map and truck status sliders
│ ├── AdvisoryPanel.tsx # Drawer pulling Gemini executive briefs
│ ├── ActivityLogs.tsx # Ledger keeping audit coordinates and timeline events
│ └── DataSummaryExport.tsx # Direct CSV download and clipboard report compilers
The dataset contains 5,000 historical records modeling physical atmospheric metrics, logistics parameters, and crop properties:
| Column Name | Type | Description |
|---|---|---|
record_id |
String |
Unique alphanumeric identifier (REC-100001...) |
farmer_village |
Categorical |
Cooperative hub origin point |
crop_type |
Categorical |
Commodity class (Tomatoes, Onions, Basmati Rice, Cotton) |
quantity_tons |
Float |
Bulk shipping payload size (metric tons) |
distance_km |
Float |
Physical driving distance from hub to concrete silo center (10km - 75km) |
temperature_c |
Float |
Ambience air heat level in Celsius |
humidity_percent |
Float |
Relative atmosphere humidity sensor percentage |
precipitation_mm |
Float |
Active rainfall rate (0mm to 150mm+ peak deluge) |
road_accessibility_score |
Float |
Flooding index score (0.00 completely blocked to 1.00 fully clear) |
vehicle_type |
Categorical |
Allocated transport truck profile |
historical_delay_rate |
Float |
Driver/Truck traditional delay rate multiplier |
actual_pickup_delay_hours |
Float (Target) |
Regression Target: Real delay of pickup cycle (Hours) |
is_pickup_delayed |
Binary (Target) |
Classification Target: Flag indicating delay exceeds 3.0h (1 or 0) |
spoilage_risk_probability |
Float (Target) |
Regression Target: Calibrated probability of thermal decay (%) |
has_spoilage_incident |
Binary (Target) |
Classification Target: Flag indicating spoilage damage exceeded 40% (1 or 0) |
We train parallel robust Scikit-Learn pipelines to handle categorical encoding, numeric scaling, classification, and regression.
- Categorical Columns (
crop_type,vehicle_type) are encoded on-the-fly viaOneHotEncoder(handle_unknown='ignore'). - Numeric Columns (
distance_km,temperature_c, etc.) are scaled usingStandardScaler()to maintain balanced visual distributions. - Integrated together into a unified
ColumnTransformerpipe, avoiding leakage into the validation folds.
- Model A: Pickup Delay Binary Classifier (Random Forest)
- Macro F1-Score:
~0.914 - ROC-AUC Score:
~0.957 - Baseline Comparison: Outperforms random selection models (
F1: ~0.261) by +65.3%, proving our weather-routing feature importances are heavily correlative.
- Macro F1-Score:
- Model B: Spoilage Incident Classifier (Random Forest)
- Macro F1-Score:
~0.923 - ROC-AUC Score:
~0.971
- Macro F1-Score:
- Model C: Co-op Pickup Delay Regressor (Random Forest Regressor)
- Mean Absolute Error (MAE):
~0.38 hours(predictions hover within 23 minutes of raw validation delay schedules).
- Mean Absolute Error (MAE):
Attributions outputted from tree classifiers represent correlation weights:
- Monsoon Precipitation:
+0.413weight (Highest impact on delays) - Road Accessibility Score:
-0.312weight (Inversely proportional; blocked pathways extend delays) - Distance to Silo Centre:
+0.145weight (Positive correlate) - Historical Delay Rate:
+0.098weight (Driver/Truck reliability index)
git clone https://github.com/Nub-programmer/AgroPulse-AI.git
cd AgroPulse-AIConfigure Node.js packages and establish Python dependencies:
# Install NodeJS dependencies
npm install
# (Optional ML Research) Configure standard python environments
pip install numpy pandas scikit-learn joblibAll ML work is fully partitioned and scripted cleanly:
# 1. Generate 5,000 record historic dataset
python research/synthetic_data_generator.py
# 2. Preprocess, Train, Evaluate, and export final serialized model files (.pkl)
python research/train_models.py
# 3. Test dynamic inference capabilities
python research/inference_pipeline.pyThis initializes our Express server backend running with active Vite middlewares. Any Gemini calls or local model predictions are routed and handled properly.
npm run devOpen http://localhost:3000 to inspect.
- Author: Atharv
- Repository Location: https://github.com/Nub-programmer/AgroPulse-AI
- Release Version: Version 1.0.4 (Regional Operations Matrix)
- License: MIT Open-Source Sandbox License
Autonomous environmental logistics telemetry coordinated under Noida Central Logistics Corridor Directives.