<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anil Surve</title>
    <description>The latest articles on DEV Community by Anil Surve (@anil_surve).</description>
    <link>https://dev.to/anil_surve</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3906572%2F6b4edf41-de38-4295-9190-a8fcc890e7c9.jpg</url>
      <title>DEV Community: Anil Surve</title>
      <link>https://dev.to/anil_surve</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anil_surve"/>
    <language>en</language>
    <item>
      <title>Building CivicGuide: How I used Gemini AI to Simplify Voting 🗳️</title>
      <dc:creator>Anil Surve</dc:creator>
      <pubDate>Thu, 30 Apr 2026 19:04:37 +0000</pubDate>
      <link>https://dev.to/anil_surve/building-civicguide-how-i-used-gemini-ai-to-simplify-voting-284n</link>
      <guid>https://dev.to/anil_surve/building-civicguide-how-i-used-gemini-ai-to-simplify-voting-284n</guid>
      <description>&lt;h2&gt;
  
  
  👀 The Problem Nobody Talks About
&lt;/h2&gt;

&lt;p&gt;Democracy doesn’t fail because of a lack of rights; it fails because of &lt;strong&gt;confusion&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voter forms are hard to understand.&lt;/li&gt;
&lt;li&gt;Government websites are difficult to navigate.&lt;/li&gt;
&lt;li&gt;Information is rarely available in local languages.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This is not a data problem. This is a &lt;strong&gt;user experience problem&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  💡 The Idea
&lt;/h2&gt;

&lt;p&gt;What if instead of searching through complex government portals, you could just &lt;strong&gt;ask&lt;/strong&gt;?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I moved to a new district. Do I need to update my voter ID?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;CivicGuide answers like a human would: simple, context-aware, and in your native language.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Why Gemini 2.5 Flash?
&lt;/h2&gt;

&lt;p&gt;I chose Gemini 2.5 Flash for three specific reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reasoning:&lt;/strong&gt; It handles messy, unstructured civic data with ease.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native Multilingualism:&lt;/strong&gt; It generates high-quality output in local dialects without heavy translation layers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multimodality:&lt;/strong&gt; It processes image and text in a single pipeline.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🏗️ System Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkyji5r2kaz3wkdjk910q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkyji5r2kaz3wkdjk910q.png" alt="Diagram showing the flow from Flutter Web through a ChatController to the API Layer, connecting to Gemini and Civic APIs" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The flow is straightforward:&lt;br&gt;
&lt;strong&gt;User → Flutter Web → ChatController → API Layer → Gemini&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;With side integrations for Civic and Calendar APIs.&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🚀 Key Features &amp;amp; Implementation
&lt;/h2&gt;
&lt;h3&gt;
  
  
  🎙️ Feature 1: Voice Input
&lt;/h3&gt;

&lt;p&gt;Users can speak naturally. One "gotcha" I encountered was that browser APIs require user-triggered initialization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;_toggleListening&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;_speechAvailable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;_speechAvailable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_speechToText&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  📸 Feature 2: Image Understanding
&lt;/h3&gt;

&lt;p&gt;You can upload a voter ID or a ballot, and the AI extracts meaning rather than just performing OCR.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"parts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Explain this document"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"inline_data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"mime_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"image/jpeg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;base64&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  📅 Feature 3: Smart Reminders
&lt;/h3&gt;

&lt;p&gt;The AI detects dates in the conversation and suggests a "Add to Calendar" action using a hidden signal in the prompt.&lt;/p&gt;
&lt;h3&gt;
  
  
  🧩 Engineering Challenges
&lt;/h3&gt;
&lt;h4&gt;
  
  
  1. TTS Chaos Bug
&lt;/h4&gt;

&lt;p&gt;Multiple voices were speaking at once during testing. I fixed this by implementing a centralized AudioController to manage the singleton state of the speech engine.&lt;/p&gt;
&lt;h4&gt;
  
  
  2. Civic API Limitations
&lt;/h4&gt;

&lt;p&gt;Official address validation was too strict for some regions. I solved this by using Gemini to "sanitize" and interpret the user's address before sending it to the API.&lt;/p&gt;
&lt;h4&gt;
  
  
  🌐 3. Multilingual Consistency
&lt;/h4&gt;

&lt;p&gt;The UI and AI would sometimes mismatch languages. I built a dual-layer system to solve this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Layer 1:&lt;/strong&gt; UI Translation Map.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Layer 2:&lt;/strong&gt; System prompt enforcement (e.g., "Reply strictly in Hindi").&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  ⚖️ Non-Partisan by Design
&lt;/h2&gt;

&lt;p&gt;This was the most critical part of the build. I enforced neutrality through a rigorous system prompt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  No political opinions allowed.&lt;/li&gt;
&lt;li&gt;  Use only official sources.&lt;/li&gt;
&lt;li&gt;  Maintain a neutral, helpful tone.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  🎯 Design Decisions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;No Login:&lt;/strong&gt; Zero friction and privacy-first.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;WhatsApp-style UI:&lt;/strong&gt; Familiar UX leads to faster adoption.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Multimodal AI:&lt;/strong&gt; Because real documents are more helpful than generic answers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  📊 The Results
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ 4-language support&lt;/li&gt;
&lt;li&gt;✅ Real-time election data integration&lt;/li&gt;
&lt;li&gt;✅ Voice + Vision AI&lt;/li&gt;
&lt;li&gt;✅ ~2.3 MB production build&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  🔮 What’s Next?
&lt;/h2&gt;

&lt;p&gt;I'm looking into offline support using local models and expanding the data set to include EU and global election formats.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The hardest problem wasn’t the code—it was designing the right prompts.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://civicguideai.netlify.app/" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Try CivicGuide Live 🚀&lt;/a&gt;
&lt;/p&gt;
&lt;h2&gt;
  
  
  💻 Source Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/SurveAnil" rel="noopener noreferrer"&gt;
        SurveAnil
      &lt;/a&gt; / &lt;a href="https://github.com/SurveAnil/CivicGuide" rel="noopener noreferrer"&gt;
        CivicGuide
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;CivicGuide 🗳️&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;CivicGuide&lt;/strong&gt; is a context-aware, multimodal, privacy-first election education assistant built with Flutter Web. It helps citizens understand their local voting processes through a conversational AI interface — available in English, Hindi, Marathi, and Spanish.&lt;/p&gt;




&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;📌 Chosen Vertical&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Civic Education &amp;amp; Voter Accessibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Elections are the foundation of democracy, yet millions of eligible voters are disenfranchised not by law, but by confusion. Complex registration forms, obscure deadlines, and bureaucratic jargon create invisible barriers — especially for first-time voters, non-English speakers, and citizens navigating two very different democratic systems (the United States and India).&lt;/p&gt;

&lt;p&gt;CivicGuide targets this problem directly: a zero-login, privacy-first AI assistant that demystifies the voting process for anyone, anywhere, in their own language.&lt;/p&gt;




&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🧠 Approach and Logic&lt;/h2&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;The "Forked Path" Architecture&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;Rather than a generic chatbot, CivicGuide uses a &lt;strong&gt;guided state machine&lt;/strong&gt; to first onboard the user (collect language + location) before routing them into the correct…&lt;/p&gt;
&lt;/div&gt;


&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/SurveAnil/CivicGuide" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;





&lt;h2&gt;
  
  
  💬 Let's Discuss!
&lt;/h2&gt;

&lt;p&gt;I’d love to get your feedback on the architecture and the overall approach. Specifically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  How are you handling &lt;strong&gt;multilingual prompt enforcement&lt;/strong&gt; in your own apps?&lt;/li&gt;
&lt;li&gt;  Do you think AI has a place in &lt;strong&gt;sensitive areas like civic tech&lt;/strong&gt;, or is the risk of hallucination too high?&lt;/li&gt;
&lt;li&gt;  What edge cases did I miss in my non-partisan system prompt?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm looking forward to your "brutal" criticism! &lt;/p&gt;

</description>
      <category>flutter</category>
      <category>gemini</category>
      <category>ai</category>
      <category>civictech</category>
    </item>
  </channel>
</rss>
