A cutting-edge Anticipatory Action & Logistics Optimization Platform for food security in Kenya. Hungerless uses climate forecasts, historical yield data, and advanced AI to predict food deficits, optimize supply chains, and save lives through proactive humanitarian intervention.
- Overview
- Key Features
- Technology Stack
- Architecture
- Installation & Setup
- Quick Start
- Project Structure
- Core Modules
- Data Formats
- Configuration
- Usage Guide
- AI Integration
- Key Algorithms
- Contributing
- License
Hungerless addresses the critical challenge of food insecurity in East Africa by shifting from reactive humanitarian response to anticipatory action. The platform:
- Predicts food production deficits by analyzing climate patterns and historical yield data
- Optimizes logistics routes and vehicle allocation to minimize costs
- Estimates exact intervention budgets using real-world market and fuel prices
- Provides AI-powered strategic recommendations via DeepSeek reasoning models
In Kenya and across the Horn of Africa, droughts cause rapid food insecurity crises. Traditional humanitarian response is slow and reactive. Hungerless enables NGOs, government agencies, and donors to:
- Identify food deficit regions 3-6 months in advance
- Plan supply chains with precision
- Allocate budgets efficiently
- Reduce delivery time and food waste
- Analyzes historical climate and yield data (2015-2025)
- Compares rainfall forecasts against historical baselines
- Predicts county-level crop yields using non-linear climate-yield models
- Categorizes regions as Critical Deficit, Surplus, or Stable
- Real-time visualization of food security status across Kenyan counties
- Color-coded markers: 🔴 Deficit, 🟢 Surplus, 🔵 Stable
- Built with Folium for geographic intelligence
- AI-recommended routes matching surplus to deficit counties
- Manual route customization for operational flexibility
- Real-time distance calculation using Haversine formula
- Multi-fleet vehicle options (5-ton light trucks to 28-ton heavy trailers)
- Fuel costs: Based on March 2026 EPRA diesel rates (KSh 166.54/L)
- Food procurement: Real maize market prices (KSh 44,444/ton)
- Fleet optimization: Calculates minimum trucks needed for each route
- Exports detailed logistics plans as CSV
- Integrates Featherless AI's DeepSeek-V3.2 model
- Analyzes drought patterns, security risks, and alternative interventions
- Generates executive summaries for stakeholder briefings
- Provides ROI analysis and pastoral aid recommendations
- Upload historical climate, livestock, and forecast CSVs
- Real-time data validation and preprocessing
- Sample data generator for testing (2015-2025 historical records)
| Layer | Technology |
|---|---|
| Frontend | Streamlit (Python web framework) |
| Visualization | Folium (maps), Plotly (charts) |
| Data Processing | Pandas, NumPy |
| AI/ML | Featherless API (DeepSeek-V3.2) |
| APIs | OpenAI client (routed to Featherless) |
| Geospatial | Haversine formula, GPS coordinates |
| Backend | Python 3.8+ |
| Environment | Python venv or conda |
User Interface (Streamlit)
↓
┌─────────────────────────────┐
│ Data Upload & Validation │
│ (Climate, Livestock, Prep) │
└────────────┬────────────────┘
↓
┌─────────────────────────────┐
│ Prediction Engine │
│ (Yield Forecasting) │
└────────────┬────────────────┘
↓
┌─────────────────────────┐ ┌────────────────────────┐
│ Matching Engine │ │ Logistics Engine │
│ (Route Optimization) │←→─│ (Cost Calculation) │
└────────────┬────────────┘ └────────────────────────┘
↓
┌──────────────────────────────┐
│ Featherless AI Integration │
│ (DeepSeek Strategy Advisor) │
└──────────────────────────────┘
↓
Dashboard Output
- Upload → User uploads 3 CSV files (historical climate, livestock impact, seasonal forecast)
- Process →
prediction.pycompares forecasts to historical baselines - Optimize →
matching.pyidentifies surplus/deficit matches using GPS coordinates - Calculate →
logistics.pyestimates costs for each route with selected vehicles - Advise →
app.pyqueries Featherless AI for strategic recommendations - Visualize → Streamlit dashboard displays maps, metrics, and charts
- Python 3.8 or higher
- pip or conda package manager
- API key for Featherless AI (free tier available)
- Internet connection for API calls
cd c:\Users\zico\Desktop\relief_exchange# Using venv
python -m venv venv
venv\Scripts\activate # On Windows
# OR
source venv/bin/activate # On macOS/Linux
# OR using conda
conda create -n hungerless python=3.8
conda activate hungerlesspip install -r requirements.txtCreate a .env file in the project root:
FEATHERLESS_API_KEY=your_featherless_api_key_hereGet your free Featherless API key from: https://featherless.ai
To generate sample data for testing:
python utils/data_generator.pyThis creates CSV files in data/raw/:
historical_climate_yield.csv(2015-2025 records)historical_livestock_impact.csv(market prices & mortality rates)current_forecast.csv(upcoming season predictions)
streamlit run app.pyThe dashboard will open at http://localhost:8501
-
Upload Data
- In the left sidebar under "📁 Data Upload Center"
- Upload 3 CSV files in order:
- Historical Climate data
- Historical Livestock data
- Season Forecast data
-
View Risk Assessment
- Tab 1 " Risk Map" shows colored county markers
- Red = Critical Deficit, Green = Surplus, Gray = Stable
- Click "Generate AI Risk Briefing" for analysis
-
Plan Logistics
- Tab 2 " Dynamic Logistics Planner"
- Choose between AI-recommended or custom routes
- Select vehicle type (5-ton, 10-ton, or 28-ton trucks)
- View financial breakdown
- Download optimization plan as CSV
-
Consult AI Strategist
- Tab 4 " Featherless AI Strategist"
- Ask operational questions
- Preset buttons for ROI, security, and pastoral aid analysis
- Get DeepSeek reasoning in real-time
relief_exchange/
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── README.md # This file
├── .env # Environment variables (IGNORED in git)
│
├── engines/ # Core computation modules
│ ├── __init__.py
│ ├── prediction.py # Yield forecasting algorithm
│ ├── matching.py # Route optimization & GPS distance
│ └── logistics.py # Cost calculation & fleet management
│
├── components/ # UI components (placeholder structure)
│ ├── __init__.py
│ ├── maps.py # Map visualization library (empty)
│ └── stats.py # Statistics display (empty)
│
├── utils/ # Utility functions
│ ├── data_generator.py # Synthetic data creation for testing
│ └── helpers.py # General helper functions (empty)
│
└── data/ # Data directory
├── raw/ # Raw input CSV files
│ ├── historical_climate_yield.csv
│ ├── historical_livestock_impact.csv
│ └── current_forecast.csv
└── processed/ # Processed data outputs (generated)
Predicts food security outcomes by analyzing climate-yield relationships.
Main Function: run_risk_assessment(df_climate, df_forecast)
Algorithm:
- Calculate historical rainfall & yield averages per county
- Compute rainfall deviation:
(Forecast_Rain - Avg_Rain) / Avg_Rain - Apply yield prediction:
Predicted_Yield = Base_Yield × (1 + 1.2 × Rainfall_Deviation) - Categorize counties:
- Critical Deficit: Yield < 75% of historical average
- Surplus: Yield > 105% of historical average
- Stable: Between 75% and 105%
Output: DataFrame with columns: County, Alert Status, Predicted Yield, Historical Avg Yield
Matches surplus counties to deficit counties and calculates distances.
Key Components:
COUNTY_COORDS: GPS coordinates for 6 focus countiesget_distance(county1, county2): Haversine formula for great-circle distancegenerate_action_plan(risk_report): Creates optimized food transfer routes
Supported Counties:
- Uasin Gishu (0.5143°, 35.2698°)
- Trans Nzoia (1.0191°, 34.9367°)
- Machakos (-1.5177°, 37.2634°)
- Kitui (-1.3667°, 38.0167°)
- Marsabit (2.3333°, 37.9833°)
- Turkana (3.1167°, 35.6000°)
Output: DataFrame with routes, distances, and tons needed
Calculates exact financial costs for food interventions.
Fleet Options:
| Vehicle | Capacity | Fuel Efficiency |
|---|---|---|
| Isuzu NPR (Light) | 5 tons | 6.0 km/L |
| Isuzu FVR (Medium) | 10 tons | 4.5 km/L |
| Scania 6-Axle (Heavy) | 28 tons | 2.2 km/L |
Cost Components:
- Fuel Cost = (Round-trip Distance × Number of Trucks) / Fuel Efficiency × Diesel Price
- Food Cost = Tons Needed × Market Price per Ton
- Total Cost = Fuel Cost + Food Cost
Data Sources:
- Diesel Price: KSh 166.54/L (EPRA March 2026)
- Maize Price: KSh 44,444/ton (~KSh 4,000 per 90kg bag)
Main user interface with 4 tabs:
Tab 1: Risk Map
- Interactive Folium map with county status markers
- Alert status table
- AI Risk Briefing button
Tab 2: Dynamic Logistics Planner
- Route selector (AI-recommended or custom)
- Vehicle selection
- Financial breakdown metrics
- CSV export functionality
- Executive summary generator
Tab 3: Raw Data
- Display uploaded climate/forecast data
Tab 4: AI Strategist
- Free-form question input to DeepSeek
- Preset quick-prompts (ROI, security risks, pastoral aid)
- Contextual analysis with live data
Required Columns:
Year, County, Rainfall_mm, Temperature_C, Maize_Yield_Tons_Per_Hectare
2025, Machakos, 598.5, 26.3, 1.95
2025, Turkana, 180.2, 31.1, 0.08
Required Columns:
Year, County, Livestock_Mortality_Percent, Market_Price_KES_Per_90kg_Bag
2025, Marsabit, 12.5, 3850
2025, Kitui, 6.2, 4100
Required Columns:
County, Predicted_Rainfall_mm, Predicted_Min_Temp_C, Predicted_Max_Temp_C
Uasin Gishu, 1120.0, 18.5, 28.0
Trans Nzoia, 1050.5, 17.0, 27.5
# Featherless AI Configuration
FEATHERLESS_API_KEY=your_api_key_here
# Optional: Custom API endpoint (defaults to featherless.ai)
# FEATHERLESS_BASE_URL=https://api.featherless.ai/v1
# Optional: Model selection
# DEEPSEEK_MODEL=deepseek-ai/DeepSeek-V3.2Modify the yield prediction sensitivity:
# Beta factor (default: 1.2)
# Higher = more sensitive to rainfall changes
analysis['Predicted_Yield'] = analysis['Maize_Yield_Tons_Per_Hectare'] * (1 + BETA * rainfall_deviation)Adjust deficit/surplus thresholds:
# Deficit threshold (default: 75% of average)
if row['Predicted_Yield'] < (row['Maize_Yield_Tons_Per_Hectare'] * 0.75):
return " CRITICAL DEFICIT"
# Surplus threshold (default: 105% of average)
elif row['Predicted_Yield'] > (row['Maize_Yield_Tons_Per_Hectare'] * 1.05):
return "✅ SURPLUS"- Upload latest climate forecast and historical data
- Use "Dynamic Logistics Planner" to estimate budget needs
- Download action plan CSV for partnership coordination
- Use AI Strategist to validate assumptions with DeepSeek
- Review Risk Map for national food security assessment
- Use multi-route planning to coordinate regional responses
- Export data for official reports and cabinet briefings
- Consult AI for inter-county coordination strategies
- View financial breakdown to understand cost structure
- Get AI-generated executive summaries for board meetings
- Assess ROI of interventions through dedicated AI prompts
- Track intervention history through exported CSVs
Hungerless integrates DeepSeek-V3.2, an advanced reasoning model, via Featherless AI's infrastructure.
What DeepSeek Powers:
- Risk Briefing: Summarizes drought patterns and recommends priorities
- Executive Summaries: Drafts 3-sentence justifications for interventions
- Strategic Analysis: Answers free-form questions about:
- ROI of specific interventions
- Security risks in conflict zones
- Alternative pastoral/livestock aid
- Supply chain vulnerabilities
- Cross-border coordination needs
Integration Details:
client = OpenAI(
api_key=os.getenv("FEATHERLESS_API_KEY"),
base_url="https://api.featherless.ai/v1"
)
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V3.2",
messages=[
{"role": "system", "content": "You are an expert NGO logistics advisor in Kenya..."},
{"role": "user", "content": prompt}
]
)System Prompt:
"You are an expert NGO logistics advisor in Kenya. Keep responses professional, data-driven, and highly concise."
Purpose: Forecast maize production based on rainfall deviation
Input: Historical rainfall, historical yield, forecasted rainfall
Output: Predicted yield for upcoming season
Formula:
Rainfall_Deviation = (Forecast_Rain - Historical_Rain) / Historical_Rain
Predicted_Yield = Base_Yield × (1 + β × Rainfall_Deviation)
where β = 1.2 (rain sensitivity factor for maize)
Example:
Historical: 600mm rain → 2.0 tons/ha yield
Forecast: 450mm rain (25% below average)
Deviation: -0.25
Predicted: 2.0 × (1 + 1.2 × -0.25) = 2.0 × 0.7 = 1.4 tons/ha
Status: CRITICAL DEFICIT (below 75% threshold of 1.5 tons/ha)
Purpose: Calculate great-circle distance between two GPS coordinates
Input: Latitude & Longitude of two counties
Output: Distance in kilometers
Formula:
a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2)
c = 2 × atan2(√a, √(1-a))
d = R × c (where R = 6,371 km)
Example:
Source: Uasin Gishu (0.5143°, 35.2698°)
Dest: Machakos (-1.5177°, 37.2634°)
Distance: ~320 km
Purpose: Determine minimum vehicles needed and calculate total costs
Input: Tons to move, distance, vehicle type
Output: Fleet size, fuel cost, total cost
Algorithm:
1. Trucks_Needed = ⌈Tons_Needed / Truck_Capacity⌉
2. Fuel_Liters = (Round_Trip_Distance × Trucks_Needed) / Fuel_Efficiency
3. Fuel_Cost = Fuel_Liters × Diesel_Price
4. Food_Cost = Tons_Needed × Market_Price_Per_Ton
5. Total = Fuel_Cost + Food_Cost
Example:
Move 5,000 tons from Uasin Gishu to Machakos using 28-ton trucks
Trucks: ⌈5000/28⌉ = 179 trucks
Distance: 320 km × 2 (round trip) × 179 = 114,560 km
Fuel: 114,560 / 2.2 = 52,073 liters
Fuel Cost: 52,073 × 166.54 = KSh 8,673,261
Food Cost: 5,000 × 44,444 = KSh 222,220,000
Total: KSh 230,893,261
The downloadable "Action Plan" CSV includes:
Source (Surplus),Destination (Deficit),Tons Needed,Distance (km)
Uasin Gishu,Machakos,3500,320
Trans Nzoia,Kitui,2100,285
Uasin Gishu,Marsabit,1800,580
Used for:
- Partnership coordination between source/destination counties
- Integration with logistics management systems
- Historical documentation of interventions
- Data analysis and impact assessment
Solution:
- Create
.envfile in project root - Add
FEATHERLESS_API_KEY=your_key_here - Restart Streamlit app
Solution:
- Check internet connection
- Verify API key is valid (test at https://api.featherless.ai)
- Check rate limits (free tier: 50 requests/day)
Solution:
- Ensure all 3 CSV files are uploaded
- Check CSV format matches required columns
- Use data generator for sample data:
python utils/data_generator.py
Solution:
- Verify county names in CSV match COUNTY_COORDS dictionary
- Supported counties: Uasin Gishu, Trans Nzoia, Machakos, Kitui, Marsabit, Turkana
# Clone and install
git clone <repo-url>
cd relief_exchange
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
# Create feature branch
git checkout -b feature/your-feature-name
# Make changes and test
streamlit run app.py
# Commit and push
git add .
git commit -m "Add your feature"
git push origin feature/your-feature-name- Add more counties and GPS coordinates
- Implement seasonal adjustment factors
- Add livestock pricing predictions
- Create intervention impact dashboard
- Add multi-language support (Swahili, Somali)
- Integrate with actual climate APIs (NOAA, ECMWF)
- Build API layer for programmatic access
- Add user authentication for NGO organizations
- Implement real-time truck tracking
- Create mobile app version
For questions, issues, or feature requests:
- Email: (mosesszico@gmail.com)
- GitHub Issues: (zico-hubb)
- Documentation: See this README and code comments
This project is open-source and available under the MIT License. See LICENSE file for details.
- Featherless AI for providing DeepSeek-V3.2 reasoning model
- Streamlit for the rapid web framework
- Kenya meteorological institutes for climate data sources
- EPRA & KeNHA for vehicle and fuel data
- NGO partners for real-world logistics insights
- Yield-Rain Relationship: Non-linear crop response to precipitation (β=1.2 empirically determined for East African maize)
- Haversine Formula: Accurate distance calculation on Earth's surface
- EPRA Data: Kenya pump prices, March 2026
- Truck Specifications: Standard commercial vehicle profiles used in East African logistics
Last Updated: March 22, 2026
Version: 1.0.0
Status: Production Ready