Inspiration
Pakistan loses up to 40% of fresh produce annually to post-harvest spoilage. Most of that loss happens not in the field but in transit and storage — where a warehouse manager in Karachi has no data-driven tool to tell them when heat is about to breach safe limits for their potatoes, tomatoes, or onions. We wanted to build something a real person could open on their phone and actually use to make a better decision today.
What it does
ColdChain Watch is a live decision-support system for cold-store managers in Pakistan. It fetches hourly weather data from two independent sources, runs it through a Bronze → Silver → Gold data warehouse with automated quality checks, and produces three outputs:
Heat alerts — when external temperature exceeds FAO safe storage thresholds per crop Temperature forecasts — 1h, 6h, and 24h ahead, beating the declared baseline by up to 80% Cited AI answers — a RAG-powered Insight Agent that answers questions like "should I dispatch tonight?" using only retrieved evidence, never invented facts Every number on the dashboard traces back to a specific Gold table row ID.
How we built it
We built a full end-to-end data pipeline in Python using DuckDB as a three-layer warehouse (Bronze/Silver/Gold). Open-Meteo and NASA POWER APIs feed hourly weather data into the Bronze layer. A Data Quality Agent runs 6 validation checks — fix, fill, or flag — and logs every decision with a reason and row count. The Gold layer engineers 59 features including rolling stats, lag features, humidex, and heat alert flags.
A Random Forest regressor trained on 2 years of hourly Karachi data forecasts temperature at three horizons. The Insight Agent uses TF-IDF retrieval over FAO, PMD, and WFP reference documents plus live Gold rows, feeding evidence into Gemini 3.8 Flash with a strict grounding prompt. The Streamlit dashboard is deployed on Streamlit Community Cloud and auto-updates via GitHub Actions running the full pipeline every hour.
Challenges we ran into
The biggest technical challenge was deployment compatibility. ChromaDB required a C++ compiler unavailable on our machines. sentence-transformers pulled in PyTorch DLLs that crashed on Python 3.14 (Streamlit Cloud). The Gemini API timed out via raw HTTP requests due to Streamlit Cloud's firewall. We solved each by going simpler: TF-IDF over semantic embeddings, pure numpy for query embedding (zero native dependencies), and the official SDK instead of raw HTTP.
Prefect's temporary server also hung in GitHub Actions due to a FastAPI version conflict. We resolved this by writing a CI-safe pipeline runner that calls each step directly without Prefect.
Accomplishments that we're proud of
A fully reproducible pipeline where make data rebuilds everything from scratch with SHA-256 verification — no manual steps A Data Quality Agent that never drops data silently — every decision is logged with its rule, action, and reason, readable by the jury All three forecast horizons beating the declared baseline by 50–80% on a locked test set that was never touched during training A grounded AI agent that genuinely says "I don't know" when it has no evidence — we verified this with a golden evaluation set The full pipeline running end-to-end in under 35 seconds per hourly run, automatically pushing fresh data to GitHub and updating the live dashboard What we learned Deployment is harder than modelling. We spent more time making the system work reliably across Python versions and cloud environments than we spent on the Random Forest. Simpler, dependency-free implementations — TF-IDF instead of vector embeddings, JSON instead of pickle — are not just acceptable trade-offs; they are often the right engineering choice.
We also learned that honesty in AI outputs is a design decision, not a default. Making the agent say "I don't know" required explicit system prompt rules, a fallback check, and a golden evaluation set. Without all three, it would have hallucinated confidently.
What's next for ColdChain Watch
Multi-city expansion — Lahore, Multan, Okara, Peshawar with city-specific models Price model — integrate WFP/PBS weekly price data for hold-or-sell recommendations based on both heat risk and market conditions
WhatsApp alerts — most Pakistani warehouse managers use WhatsApp; push notifications when a heat threshold is about to be breached
Urdu dashboard — full Urdu language support for managers who are more comfortable in their native language
Load-shedding integration — combine with NEPRA outage schedules so managers know when backup power will be needed
Semantic embeddings — once deployment constraints are resolved, replace TF-IDF with multilingual sentence embeddings for better Urdu/English retrieval
Built With
- agritech
- dataengineering
- datapipeline
- duckdb
- etl
- gemini
- generativeai
- githubactions
- machine-learning
- mlops
- nasapower
- numpy
- openmeteo
- pakistan
- pandas
- prefect
- python
- rag
- randomforest
- scikit-learn
- streamlit
Log in or sign up for Devpost to join the conversation.