<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How We Built NammaShanti — An AI-Powered Civic Threat Intelligence System for Bengaluru]]></title><description><![CDATA[How We Built NammaShanti — An AI-Powered Civic Threat Intelligence System for Bengaluru]]></description><link>https://journey-of-nammashanti.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6a2f9c5b8bd05bcd4e6336f4/cf6fad60-017d-4283-9a50-2111ef74aa77.jpg</url><title>How We Built NammaShanti — An AI-Powered Civic Threat Intelligence System for Bengaluru</title><link>https://journey-of-nammashanti.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 22 Jun 2026 09:24:32 GMT</lastBuildDate><atom:link href="https://journey-of-nammashanti.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How We Built NammaShanti — An AI-Powered Civic Threat Intelligence System for Bengaluru]]></title><description><![CDATA[What happens when a city of 13 million people has no reliable way to separate real emergencies from WhatsApp rumours? We built the answer in 30 hours.


The Team Behind NammaShanti
NammaShanti was bui]]></description><link>https://journey-of-nammashanti.hashnode.dev/how-we-built-nammashanti-an-ai-powered-civic-threat-intelligence-system-for-bengaluru</link><guid isPermaLink="true">https://journey-of-nammashanti.hashnode.dev/how-we-built-nammashanti-an-ai-powered-civic-threat-intelligence-system-for-bengaluru</guid><category><![CDATA[Bengaluru]]></category><category><![CDATA[AI]]></category><category><![CDATA[hackathon]]></category><category><![CDATA[projects]]></category><category><![CDATA[Python]]></category><category><![CDATA[Firebase]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Fake News Detection]]></category><category><![CDATA[telegram bot]]></category><category><![CDATA[Google]]></category><category><![CDATA[google cloud]]></category><dc:creator><![CDATA[Pavan H.S]]></dc:creator><pubDate>Mon, 15 Jun 2026 06:49:13 GMT</pubDate><content:encoded><![CDATA[<blockquote>
<p><em>What happens when a city of 13 million people has no reliable way to separate real emergencies from WhatsApp rumours? We built the answer in 30 hours.</em></p>
</blockquote>
<hr />
<h2>The Team Behind NammaShanti</h2>
<p>NammaShanti was built by a 4-member team at the <strong>Build for Bengaluru Hackathon</strong>, organized by <strong>Google Developer Groups (GDG) Bengaluru</strong> at <strong>REVA University</strong>.</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Contribution</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Pavan H S</strong></td>
<td>Firebase architecture, backend development, AI/ML integration, and contributor across the full stack</td>
</tr>
<tr>
<td><strong>Chandan U Achar</strong></td>
<td>Core team member and contributor</td>
</tr>
<tr>
<td><strong>Jalaj Krishna B S</strong></td>
<td>Core team member and contributor</td>
</tr>
<tr>
<td><strong>Manish L</strong></td>
<td>Core team member and contributor</td>
</tr>
</tbody></table>
<p>This blog reflects my personal experience and contributions as part of the team. All credit for the complete project belongs equally to all four of us.</p>
<hr />
<h2>The Problem That Kept Us Up at Night</h2>
<p>Bengaluru is one of India's most dynamic cities — and also one of its most rumor-prone. During communal tensions, protests, or local unrest, panic spreads faster than facts. A single forwarded video on Telegram can trigger mass fear, traffic chaos, and even violence — before anyone in authority has even confirmed whether the event is real.</p>
<p>The Bengaluru Police and BBMP receive hundreds of citizen reports daily. Most are noise. Some are critical. And there's no intelligent system to tell them apart.</p>
<p>That was our problem statement. And NammaShanti was our answer.</p>
<hr />
<h2>The Pivot That Defined the Project</h2>
<p>Here's something that doesn't make it into most hackathon write-ups — the original idea was completely different.</p>
<p>We initially planned to build a bot that would <strong>automatically scrape messages from WhatsApp</strong>, evaluate them using AI, and push verified incidents to an authority dashboard. It was clean, powerful, and elegant in theory.</p>
<p>Then reality hit: WhatsApp requires higher-level business API permissions to access user messages and data. We couldn't clear that in the middle of a 30-hour hackathon.</p>
<p>So we pivoted — fast.</p>
<p>Instead of scraping WhatsApp, we built a <strong>Telegram bot</strong> where citizens could proactively forward suspicious messages, videos, or article links. The AI evaluation pipeline stayed the same. The authority dashboard stayed the same. We just changed where the reports came from.</p>
<p>And honestly? The Telegram approach turned out to be <em>better</em> — it made citizen participation explicit and consensual, rather than surveillance-based. That pivot taught us something important: constraints don't always kill ideas, sometimes they improve them.</p>
<hr />
<h2>What Is NammaShanti?</h2>
<p><strong>NammaShanti</strong> — <em>"Our Peace"</em> in Kannada — is a real-time AI-powered civic threat intelligence and rumour triage platform built for Bengaluru Police and BBMP. It ingests citizen reports from Telegram — text messages, video reels, and news article links — runs them through a custom AI engine, computes a <strong>Panic Index score</strong>, and surfaces verified incidents on a live police commander dashboard.</p>
<p>In simple terms: citizens report, AI triages, police act.</p>
<hr />
<h2>The Architecture</h2>
<p>Here's a bird's-eye view of how data flows through the system:</p>
<pre><code class="language-plaintext">Citizen (Telegram)
       │
       ▼
  NammaShantiBot → engine.py (Panic Index Engine)
       │                    │
       │         ┌──────────┴──────────────┐
       │         │  Static Scan   (30%)    │
       │         │  Velocity Score (40%)   │
       │         │  Gemini AI Score (30%)  │
       │         └─────────────────────────┘
       │
       ▼
  Firebase Firestore → React Dashboard (Live)
       │
       ▼
  Auto-Reply / Mass Broadcast → Citizen's Telegram
</code></pre>
<p>The entire pipeline runs with near-zero latency — from a citizen forwarding a message to a police officer seeing it on the dashboard takes seconds.</p>
<hr />
<h2>The Tech Stack</h2>
<p>NammaShanti 2.0 was built end-to-end on the Google ecosystem:</p>
<table>
<thead>
<tr>
<th>Technology</th>
<th>Role in the System</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Gemini 2.5 Flash</strong></td>
<td>Core AI engine — reads text, watches videos, and analyzes news articles to assess threats and draft official police responses</td>
</tr>
<tr>
<td><strong>Gemini File API</strong></td>
<td>Uploads citizen video reels to Google Cloud for multimodal visual and audio analysis before triage</td>
</tr>
<tr>
<td><strong>Google Maps Platform</strong></td>
<td>Powers the live commander dashboard with real-time incident markers, patrol unit overlays, and interactive InfoWindows across Bengaluru</td>
</tr>
<tr>
<td><strong>Firebase Firestore</strong></td>
<td>Real-time NoSQL database that syncs incidents between the Python backend and React frontend instantly</td>
</tr>
<tr>
<td><strong>Firebase Hosting</strong></td>
<td>Frontend deployment target for the production React dashboard</td>
</tr>
<tr>
<td><strong>Python (Backend)</strong></td>
<td>Telegram bot logic, Panic Index engine, web scraping, and Firestore writes</td>
</tr>
<tr>
<td><strong>React + Vite (Frontend)</strong></td>
<td>Live commander dashboard with Google Maps and real-time Firestore listeners</td>
</tr>
</tbody></table>
<hr />
<h2>The Heart of the System: The Panic Index</h2>
<p>The most technically interesting part of NammaShanti is our custom <strong>Panic Index Engine</strong> — a weighted formula that combines three independent signals to score every incoming report from 1 to 10.</p>
<pre><code class="language-plaintext">Panic Index = (Static Score × 0.3) + (Velocity Score × 0.4) + (Semantic Score × 0.3)
</code></pre>
<p><strong>Clamped to 1–10. Auto-escalates to a minimum of 8 if 3 or more static triggers are detected.</strong></p>
<h3>Breaking Down Each Signal</h3>
<p><strong>1. Static Score (30%) — Keyword Intelligence</strong></p>
<p>We built a curated list of Bengaluru-specific trigger keywords — neighbourhood names, political terms, Kannada phrases associated with unrest. A message mentioning "bandh + Silk Board + protest" scores higher than one mentioning just "crowd."</p>
<p><strong>2. Velocity Score (40%) — The Crowd Signal</strong></p>
<p>This is the most powerful signal. If 10 different citizens report the same type of incident from the same area within 15 minutes, the velocity score spikes sharply. This mimics how real emergencies actually work — one report might be noise, but ten reports in a short window almost never is.</p>
<p><strong>3. Semantic Score (30%) — Gemini AI</strong></p>
<p>Gemini 2.5 Flash reads the full message (or watches the video, or reads the scraped article) and returns a structured threat assessment including a severity score, whether it's likely fake or real, a summary, and a draft official police response — all in a single API call.</p>
<h3>Why Velocity Carries the Highest Weight</h3>
<p>We deliberately weighted velocity at 40% because it is the hardest signal to fake. You can engineer a single alarming message, but you cannot easily manufacture 15 independent citizen reports in 15 minutes. Velocity is the closest approximation we have to ground truth.</p>
<hr />
<h2>Multimodal AI: Beyond Just Text</h2>
<p>One of our proudest features is handling video reels. When a citizen forwards a video to the bot:</p>
<ol>
<li><p>The bot downloads the video file</p>
</li>
<li><p>Uploads it to Google Cloud via the <strong>Gemini File API</strong></p>
</li>
<li><p>Gemini 2.5 Flash watches the video — analyzing both the visuals and audio</p>
</li>
<li><p>Returns a structured threat assessment</p>
</li>
</ol>
<p>This means NammaShanti can detect mob violence, weapons, or crowd panic from a raw video clip — not just from keywords. That's genuinely powerful and, to our knowledge, rare in civic AI systems at this scale.</p>
<p>Similarly, when a message contains a URL, the backend automatically scrapes the article text and feeds it to Gemini — catching misinformation embedded in "news" links before they go viral.</p>
<hr />
<h2>The Live Commander Dashboard</h2>
<p>The police-facing dashboard is a React application powered by Firebase Firestore's real-time listeners. Every new incident pushed to Firestore immediately appears on the dashboard without any page refresh.</p>
<p>Key dashboard features:</p>
<ul>
<li><p><strong>Live Google Maps</strong> with incident markers colour-coded by Panic Index (red / yellow / green)</p>
</li>
<li><p><strong>Heat map overlay</strong> showing geographical clusters of incoming reports</p>
</li>
<li><p><strong>Nearby police unit overlays</strong> showing patrol positions relative to the incident</p>
</li>
<li><p><strong>Status management</strong> — authorities can update the status of any incident (acknowledged, deployed, resolved)</p>
</li>
<li><p><strong>One-click Mass Broadcast</strong> — commanders can push a verified counter-message to all registered citizens simultaneously</p>
</li>
<li><p><strong>Auto-approval loop</strong> — low-threat incidents (Panic Index &lt; 4) are automatically approved and responded to; high-threat incidents wait for a human commander's review</p>
</li>
</ul>
<blockquote>
<p>Note: The police unit deployment feature was implemented as a demo — showing how an authority could flag and assign units to incidents. Full GPS-based live dispatch was scoped for future development.</p>
</blockquote>
<hr />
<h2>Testing With Real Bengaluru Scenarios</h2>
<p>We built a test suite of 6 real-world scenarios — no Telegram interaction needed — that injects incidents directly into the engine and measures the Panic Index output:</p>
<table>
<thead>
<tr>
<th>Test Case</th>
<th>Location</th>
<th>Expected Score</th>
</tr>
</thead>
<tbody><tr>
<td>Water Mafia + Protest</td>
<td>HSR Layout</td>
<td>🔴 8+ (Auto-escalated)</td>
</tr>
<tr>
<td>Migrant Worker Clash</td>
<td>Electronic City</td>
<td>🔴 7–8 HIGH</td>
</tr>
<tr>
<td>Silk Board Protest (Kannada message)</td>
<td>Silk Board</td>
<td>🟡 4–5 MED</td>
</tr>
<tr>
<td>Fake News Article (URL scraping)</td>
<td>Online</td>
<td>🟡 3–5 MED</td>
</tr>
<tr>
<td>Bengaluru Bandh Rumour</td>
<td>City-wide</td>
<td>🟡 5–7 MED</td>
</tr>
<tr>
<td>Innocent Metro Query</td>
<td>MG Road</td>
<td>🟢 1–2 LOW</td>
</tr>
</tbody></table>
<p>The system correctly distinguished between a routine metro question and a water mafia protest — without any human intervention. That's the benchmark we're proud of.</p>
<hr />
<h2>The Night the Backend Died (And What We Did About It)</h2>
<p>No honest hackathon write-up is complete without the disaster story. Ours happened during deployment.</p>
<p>At some point deep into the 30-hour sprint, we attempted to deploy the backend on <strong>Google Cloud</strong>. It crashed — completely. Not a small bug, not a broken route. The entire backend went down.</p>
<p>In that moment, we did what every good engineer does: we went back to Git.</p>
<p>We retraced every change, commit by commit, using GitHub's history to understand what broke and when. It was painstaking and stressful — but it worked. Git wasn't just version control that day, it was our lifeline.</p>
<p>But we didn't stop at recovery. We went further.</p>
<p>We built a <strong>complete clone of the backend</strong> — fresh API keys, fresh configuration — and ran it locally on a separate system. The same React frontend was then connected to both systems, with each frontend instance isolated to its own backend. The result: if the Google Cloud deployment failed again, we had a fully functional locally-running fallback ready to go.</p>
<p>Two systems. One frontend design. Zero single point of failure.</p>
<p>It wasn't elegant. It wasn't in the original plan. But it worked — and more importantly, it taught us something that no course ever could: <strong>real engineering isn't about writing perfect code, it's about recovering when things break and building systems that don't let failures cascade.</strong></p>
<hr />
<h2>What We Learned</h2>
<p><strong>1. Pivot fast, pivot smart</strong> Our WhatsApp-to-Telegram pivot happened under time pressure and ended up being a better design decision. Never fall so in love with your original idea that you can't adapt when reality pushes back.</p>
<p><strong>2. Git is not optional — it's your safety net</strong> We recovered a crashed backend using commit history. Every engineer who thinks "I'll push later" is one crash away from losing hours of work.</p>
<p><strong>3. Build for failure, not just success</strong> Our failover clone architecture was born out of crisis, but it's actually standard practice in production systems. Hackathons that push you to your limits teach you production-grade thinking faster than any classroom.</p>
<p><strong>4. Multimodal AI changes everything</strong> Text-only moderation is 2022. Gemini's ability to watch a video and return a structured JSON threat assessment in a single call is genuinely game-changing for civic applications.</p>
<p><strong>5. Velocity beats sentiment every time</strong> Our early versions relied heavily on keyword matching. The velocity signal was the single biggest accuracy improvement — it's the closest thing to real-time ground truth you can get without physical verification.</p>
<p><strong>6. Schema enforcement is non-negotiable for AI pipelines</strong> We enforced a strict JSON output schema (<code>contract.json</code>) on every Gemini response. Without it, you get beautifully written AI text that breaks your downstream code at 2 AM. Lesson learned the hard way.</p>
<hr />
<h2>The Outcome</h2>
<p>We didn't win.</p>
<p>But we walked out of that 30-hour hackathon with something more valuable than a trophy — a fully functional system, a story we're proud of, a team that communicated well under pressure, and the satisfaction of knowing we built something genuinely useful from scratch.</p>
<p>NammaShanti is real. It works. And it solves a real problem for a real city.</p>
<p>That felt like enough.</p>
<hr />
<h2>What's Next for NammaShanti</h2>
<p>The hackathon was the beginning, not the end. Our roadmap includes:</p>
<ul>
<li><p><strong>Voice Note Processing</strong> — Transcribing Telegram voice messages via Gemini for regional language support</p>
</li>
<li><p><strong>Kannada-First Translation</strong> — Auto-translating all responses back to Kannada for local citizens</p>
</li>
<li><p><strong>Automated FIR Drafting</strong> — Generating Karnataka Police FIR-format documents for high-threat incidents</p>
</li>
<li><p><strong>Real-time GPS Fleet</strong> — Replacing demo patrol markers with live KSRP vehicle tracking</p>
</li>
<li><p><strong>Firebase Auth</strong> — Restricting dashboard access to authenticated officers only</p>
</li>
</ul>
<hr />
<h2>Try It Yourself</h2>
<p>The full source code, architecture diagrams, and test suite are available on GitHub:</p>
<p>🔗 <a href="https://github.com/seamykiin/NammaShanti">github.com/seamykiin/NammaShanti</a></p>
<p>If you're a developer interested in civic AI, a police tech researcher, or just someone who wants to see how Gemini's multimodal capabilities can be applied to real public safety problems — we'd love your feedback, contributions, or a star on the repo. ⭐</p>
<hr />
<h2>Acknowledgements</h2>
<p>Huge thanks to my incredible teammates — <strong>Chandan U Achar</strong>, <strong>Jalaj Krishna B S</strong>, and <strong>Manish L</strong> — for their dedication, sleepless effort, and teamwork throughout those intense 30 hours. This project is as much theirs as it is mine.</p>
<p>Thanks also to <strong>Google Developer Groups (GDG) Bengaluru</strong> and <strong>REVA University</strong> for organizing the Build for Bengaluru Hackathon and giving us this platform.</p>
<hr />
<p><em>Built with 🧡 for Bengaluru. "Shanti" means peace in Kannada. NammaShanti means "Our Peace."</em></p>
<hr />
<p><strong>Tags:</strong> <code>#AI</code> <code>#GeminiAI</code> <code>#Firebase</code> <code>#HackathonProject</code> <code>#CivicTech</code> <code>#Python</code> <code>#React</code> <code>#GoogleCloud</code> <code>#MachineLearning</code> <code>#Bengaluru</code> <code>#BuildForBengaluru</code> <code>#GDGBengaluru</code> <code>#FakeNewsDetection</code> <code>#TelegramBot</code></p>
]]></content:encoded></item></channel></rss>