ZiwaClear: Transforming Early Warning into Early Action on Lake Victoria

The Problem

Lake Victoria's Winam Gulf is trapped in a climate-driven feedback loop:

  • 17,000 hectares choked by water hyacinth — stagnant-mat habitat that breeds malaria mosquitoes and bilharzia-host snails, and blocks clean water points.
  • 66% collapse in fish catch in the Winam Gulf, a market millions depend on directly or indirectly.
  • 61% youth unemployment in Kisumu County.
  • A proven health correlation between hyacinth coverage and cholera incidence in Nyanza (r = 0.83, P = 0.0010; Feikin et al., AJTMH/PubMed).
  • Climate acceleration — rising temperatures and altered rainfall/runoff are shortening bloom-recovery cycles, not just sustaining them.

Past initiatives spent over $70M on mechanical harvesters and manual cleanups, but the weed regrew every season because these efforts treated hyacinth as waste disposal rather than an economic resource. Harvesters on feature phones lacked buyer visibility, price transparency, and digital payment mechanisms. The bottleneck isn't harvesting capacity — it's coordination: buyers don't know what's available, harvesters don't know who's buying, and nobody is warned before a bloom becomes a health or food-security emergency.

Our Solution

There is no funded pilot deployment behind this submission. ZiwaClear is a production-deployed demo — every service described below is real, running code, exercised against realistic seeded data for two actual Lake Victoria sites, Dunga and Usenge, not against live user activity. We're stating this plainly up front because everything that follows is genuinely real infrastructure, and we don't want that to be confused with pilot results we don't yet have.

We were inspired to build ZiwaClear to transform early warning into early action. By connecting offline harvesters directly to commercial biomass buyers (such as biodigester operators), the platform turns an environmental hazard into a predictable economic commodity while alerting local officials to health and environmental risks.


How We Built It

ZiwaClear runs a four-stage loop — Detect → Predict → Alert → Act (with Acknowledgment) — across low-connectivity SMS channels and a web dashboard:

Data Capture

Integrated the Africa's Talking SMS/USSD Gateway so harvesters on basic feature phones can submit reports without internet access.

Message Parsing

Implemented Gemini 2.0 Flash via LangChain to parse localized Swahili and Sheng SMS inputs — extracting local measurement units like magunia (sacks) and fuso into structured location, quantity, and quality data.

Fallback Circuit Breaker

Built a regex fallback parser so incoming harvester SMS is never lost if the LLM provider is rate-limited or unavailable. This isn't theoretical — we hit a real Gemini quota limit during testing, and confirmed the fallback caught the message correctly without dropping it.

Risk Engine

Combines incoming harvester coverage reports with live climate data from Open-Meteo — a temperature anomaly against a seasonal baseline, plus rainfall and a coverage trend derived from recent readings — to compute risk tiers, evaluated highest-severity-first:

  • Normal
  • Watch
  • Warning
  • Emergency

Multi-Agency Alerts

Built an automated dispatch system sending CAP-shaped SMS alerts (event type, severity, area, timestamp, recommended action) to Beach Management Unit (BMU) leaders, county health officers, and water/WASH officers, based on risk severity and a site-level water-point flag. Full CAP/XML formatting is future work — see Roadmap.

Backend & Dashboard

Developed a Node.js/TypeScript API backend handling atomic batch claims and an interactive Leaflet.js map dashboard. Buyer payouts currently use mock M-Pesa B2C payout logic — live M-Pesa integration is planned, not yet built (see Roadmap).

Environmental Impact Calculation

To calculate environmental impact metrics on claimed biomass, the platform uses standard conversion formulas:

$$\text{CO}2\text{e}{\text{avoided}} = m_{\text{wet}} \times (1 - \theta) \times \gamma_{\text{CH}4} \times \text{GWP}{\text{CH}_4}$$

Where:

  • $m_{\text{wet}}$ = harvested weight
  • $\theta$ = moisture content fraction
  • $\gamma_{\text{CH}_4}$ = methane yield factor
  • $\text{GWP}_{\text{CH}_4}$ = Global Warming Potential of methane ($28\times$)

These metrics are computed only on batches that have actually been claimed and collected — not projected across all reported harvests.


Challenges We Faced

Parsing Unstructured Local Language

Processing informal Swahili and Sheng messages like "Tuko na magunia 5 kavu huko Usenge" required careful prompt design and normalization so local units (magunia / sacks, fuso) map accurately to estimated dry weights.

Handling API Constraints

During stress testing, we hit a real Gemini API quota limit — not a transient rate limit, a hard 429 on the free tier. Implementing and verifying the regex fallback engine ensured that incoming harvester SMS reports are never lost when the primary parser is throttled or unavailable, and we confirmed this live rather than assuming it would work.

Closing the Early Action Loop

Structuring two-way SMS communication so recipient acknowledgments (replying RECEIVED or CLEARED) update system timestamps and log verifiable response metrics — average time-to-acknowledge, computed from real data rather than asserted.

Coordinating Across Deployment Environments

As a small team shipping across Supabase, Render, and Africa's Talking, we ran into more than one case of a setting that was correct in one environment but not mirrored in another — auth redirect URLs still pointing at localhost after deploy, SMS callback URLs pointing at a stale host. None of these were code bugs; all were caught by testing the live path end-to-end rather than trusting local success alone.


What We Learned

  • Early Action Requires Economic Pull: Early warning alerts are far more effective when paired with direct economic incentives (buyer demand, and eventually real payment rails) for community mobilization.

  • Designing for the User's Reality: In rural landing sites, simple feature-phone SMS tools provide the most reliable access point for primary data collection.

  • System Resilience is Essential: Critical infrastructure must include local fallbacks (like regex parsing) to maintain continuity during third-party API disruptions — and those fallbacks are only trustworthy once you've actually watched them fire in a real failure, not just written them.

  • Verify Across Every Environment Separately: Local success doesn't imply production success. Env vars, redirect URLs, and callback endpoints all need independent confirmation per deployment target.

What's Next for ZiwaClear

  • On-the-Ground Pilot (Kisumu): Onboard 40–60 harvesters across the Dunga and Usenge Beach Management Units (BMUs) to calibrate parser performance with live telemetry and align delivery schedules with commercial buyer off-take.
  • Live M-Pesa Integration: Replace mock B2C payout logic with real disbursement.
  • Satellite Verification (Sentinel-2): Cross-verify harvester-reported bloom coverage remotely and calculate verifiable methane-avoidance carbon credits.
  • Full CAP/XML Alert Formatting: For interoperability with national/regional early-warning-system infrastructure.
  • Community Syndromic Reporting: A self-reported symptom-cluster SMS channel, cross-referenced against coverage spikes, to strengthen the cholera-correlation signal with direct health data.
  • Regional & Transboundary Scale: Expand across 15+ BMUs along the Kenyan Lake Coast, then cross-border into Uganda and Tanzania, directly supporting IGAD's regional mandate.
  • Market Expansion: Introduce fish waste co-digestion for higher methane yield, and explore secondary markets like eco-briquettes and craft paper packaging.
Share this project:

Updates

Submission history