Inspiration
Malaysia spends RM145 million on its National Flood Warning Programme — yet forecast accuracy sits at just 5.6%. Even worse, 69.8% of Malaysians have never heard of the early warning system in their area (Auditor-General's Report 2023).
We asked: what if every Malaysian could get a plain-language, AI-reasoned flood risk assessment for their exact location — in seconds, in their language?
What it does
BanjirSiaga is a web app that fuses live weather data, government warnings, and historical flood records through Gemini AI to deliver hyper-local flood risk assessments in Bahasa Malaysia and English.
Core features:
- AI Risk Assessment — Enter any Malaysian location. We pull real-time rainfall, humidity, wind data from Open-Meteo, cross-reference government flood warnings and historical flood records, then let Gemini 2.0 Flash reason over all data to produce a risk level (SELAMAT / WASPADA / BAHAYA) with natural-language guidance.
- Photo Analysis — Upload a flood photo. Gemini Vision estimates water depth, identifies hazards, and provides bilingual safety guidance.
- Scenario Replay — Toggle "Replay Mode" to simulate the devastating Dec 2024 Kelantan flood using cached sensor data — perfect for disaster planning and training.
- Evacuation Routing — For BAHAYA-level risks, the app shows the 3 nearest evacuation centres with distance and capacity.
How we built it
Architecture:
- Frontend — Vanilla HTML/CSS/JS with Leaflet.js for interactive maps. Premium dark-mode UI with Plus Jakarta Sans typography.
- Backend — FastAPI (Python) serving both the API and static files.
- AI Layer — Google Gen AI SDK with a 3-model cascade (gemini-2.0-flash → gemini-2.0-flash-lite → gemini-1.5-flash-8b) plus a rule-based fallback for bulletproof reliability.
- Data Sources — Open-Meteo (live weather), data.gov.my (flood history, evacuation centres), custom replay dataset (Dec 2024 Kelantan flood).
Prompt Engineering:
- System prompts enforce structured JSON output with strict schema (risk_level, bm, en, immediate_actions)
- Location context, weather data, government warnings, and historical records are all injected into the user prompt
- Gemini reasons over the full context to produce a holistic risk assessment — not just threshold-based alerts
Challenges we ran into
- Gemini API rate limits on free tier during the hackathon — solved with a 3-model cascade + intelligent rule-based fallback that uses weather thresholds from Malaysia's meteorological standards
- Getting consistent bilingual (BM/EN) output from Gemini — solved with explicit system prompt structuring
- Ensuring the app works offline/degraded — the fallback system guarantees a response even with zero API connectivity
Accomplishments that we're proud of
- Zero downtime — the app NEVER returns an error, even if all Gemini models are rate-limited
- Bilingual by default — every assessment in both BM and EN
- Real data — live weather from Open-Meteo, real evacuation centres from data.gov.my
- Scenario Replay — unique feature for disaster preparedness training
What we learned
- How to leverage Gemini's reasoning capabilities for multi-source data fusion
- The importance of fallback systems in production AI applications
- That Malaysia's flood warning infrastructure has significant gaps that technology can help bridge
What's next for BanjirSiaga
- Integration with Malaysia's real-time river level sensors (InfoBanjir API)
- Push notifications via Telegram/WhatsApp for subscribed areas
- Community flood reporting with photo verification
- Multi-language support (Mandarin, Tamil) for Malaysia's diverse population
- Deployment to Google Cloud Run for nationwide access
Built With
- css
- fastapi
- gemini-2.0-flash
- gemini-vision
- google-gen-ai-sdk
- html
- javascript
- leaflet.js
- open-meteo-api
- python
Log in or sign up for Devpost to join the conversation.