🛡️ Raksha — The Story Inspiration Every monsoon season, millions of families across South Asia wake up not knowing if it's safe to send their kids to school, whether to stay home, or when to evacuate. Weather apps give you a 7-day forecast. But they don't tell you what to do.

I built Raksha because I wanted one clear answer every morning — is it safe to go outside today? Not a number. Not a map. A decision. Especially for families with children or elderly members who face disproportionate risk from floods, heatwaves, and air quality events.

The name Raksha (रक्षा) means protection in Sanskrit — and that's exactly what the app tries to deliver.

What It Does Raksha is a real-time family safety assistant. It:

Detects your GPS location and fetches live hyperlocal weather from OpenWeatherMap Scores your risk using a trained Random Forest model on rainfall, wind, humidity, elevation, and historical disaster zone proximity Amplifies the score if children or elderly are in your household (×1.4–1.6×) Generates one safety decision via Groq LLaMA 3.3-70b — a single, actionable sentence Explains why with a plain-language breakdown of the primary risk drivers Shows local emergency helplines detected from your GPS country Lets you share your safety status to WhatsApp, Telegram, or Twitter How I Built It Frontend — React + TypeScript + Vite, styled with a custom Material 3 design system in vanilla CSS. The UI dynamically shifts its colour palette based on the risk level (green → amber → red) using HSL CSS variables.

Backend — FastAPI + Uvicorn, deployed on Render. Handles weather fetching, ML inference, Groq LLM calls, and SQLite logging.

ML Model — A scikit-learn Random Forest Classifier trained on synthetic flood/disaster feature data:

$$\text{score} = \text{RF}([\text{rainfall}, \text{elevation}, \text{humidity}, \text{wind}, \text{historical_zone}])$$

$$\text{final_score} = \text{score} \times \begin{cases} 1.6 & \text{if children and elderly} \ 1.4 & \text{if one vulnerable group} \ 1.0 & \text{otherwise} \end{cases}$$

AI Layer — Groq's LLaMA 3.3-70b generates the one-sentence safety decision with a strict prompt: one sentence, starts with an action verb in caps, no fluff. The chatbot receives the full user context — risk level, weather, household profile, and location — so every response is hyperlocal and personalized.

Challenges Desktop layout — getting a fluid 72px→220px hover-expand sidebar navigation rail right in pure CSS was tricky. The base app shell had a max-width: 430px mobile cap that took hours to track down. Location → helplines — mapping GPS-detected ISO country codes (IN, US) to the correct emergency numbers required building a lookup table for 15+ countries. Context injection — making the chatbot actually useful meant serializing the entire user state (risk, weather, household, location) into the system prompt without hallucination. Deployment — routing Vercel's serverless frontend to a persistent Render backend via vercel.json rewrites, without touching any API call code. What I Learned How to combine real ML inference with LLM-generated explanations in a single API call Material 3 dynamic color theming entirely in CSS variables Vercel edge rewrites as a zero-code API proxy How to make a chatbot actually contextual rather than generic Built With react typescript vite fastapi python scikit-learn groq openweathermap sqlite vercel render

Made for WeatherWise Hack · Team Code: WWH-RHV8D6

Built With

Share this project:

Updates