Skip to content

hnikhil-dev/VoterSense

Repository files navigation

VoterSense — Conversational Civic Assistant

An AI-powered interactive assistant designed to simplify the Indian election process through professional explanations, legal troubleshooting, and integrated Google services.

Built for the PromptWars Solution Challenge 2026 — Challenge Two: Civic Education.


Chosen Vertical

Civic Education — Election Process Simplification

VoterSense acts as an authoritative, conversational guide that breaks down complex electoral processes into digestible explanations for everyday citizens, making democratic participation accessible to all.


Approach & Logic

The Problem

The Indian election process involves complex legal frameworks, technical systems (EVMs, VVPATs), and multi-phase timelines that can be challenging for citizens to navigate. When voters encounter issues (such as personation or missing names), they often lack clear guidance on their legal rights or procedural remedies.

Our Solution

VoterSense serves as an informed guide that:

  1. Context-Aware Interactions: Leverages Google Gemini AI to provide clear, objective responses tailored to user inquiries.
  2. Statutory Citations: Every troubleshooting scenario includes precise legal references (e.g., Section 49P for tendered votes, Section 135A for booth capturing).
  3. Process Visualization: An interactive roadmap details the 7 phases of the electoral cycle—from official notification to government formation.
  4. Authoritative Resources: Integrates Google Maps for locating polling stations and provides direct links to official Election Commission of India (ECI) portals.

Decision-Making Logic

  • Professional AI Persona: The assistant utilizes a specialized system prompt that enforces non-partisan, factually accurate, and professional communication.
  • Resilient Fallback System: In the absence of an API configuration, the application utilizes a keyword-matching engine with a comprehensive knowledge base covering common electoral questions.
  • Legal Knowledge Base: All troubleshooting scenarios are grounded in the Representation of the People Act, the IPC, and the Conduct of Elections Rules.

System Architecture

Overview

VoterSense is structured as a single-page application with specialized modules for different aspects of civic education:

  • Dashboard: High-level statistics and navigation.
  • AI Assistant: Conversational interface powered by Gemini.
  • Election Roadmap: Procedural timeline with statutory details.
  • Troubleshooter: Scenario-based legal guidance.
  • Station Locator: Geographical visualization via Google Maps.

Technology Stack

  • Frontend: React 19, Vite 8
  • Design: Vanilla CSS with professional dark-mode aesthetics and Framer Motion animations
  • AI Engine: Google Gemini API (gemini-2.0-flash)
  • Geospatial: Google Maps JavaScript API
  • Testing: Vitest for robust logic verification
  • Typography: Google Fonts (Inter, Space Grotesk)

How the Solution Works

VoterSense operates as a single-page React application that integrates directly with Google Services without requiring a traditional backend.

  1. User Interaction: Users navigate through an intuitive, dark-themed dashboard to access different modules (Timeline, Chat, Troubleshooter, Polling Locator).
  2. AI Processing: When a user asks a question, the input is sent to the Gemini API (gemini-2.0-flash-lite by default). The system uses a strict system prompt to constrain the AI to professional, accurate civic education responses.
  3. Resiliency: If the primary AI model hits a rate limit, the application automatically falls back to alternative models (gemini-2.0-flash, gemini-1.5-pro), and ultimately to a pre-built static knowledge base if all API calls fail.
  4. Geospatial Features: The Polling Station Locator uses the Google Maps API to render geographical data based on sample datasets, demonstrating real-world usability.

Getting Started

Prerequisites

  • Node.js 18+ and npm

Installation

git clone https://github.com/hnikhil-dev/VoterSense.git
cd VoterSense
npm install
npm run dev

Configuration

You can configure the application in two ways:

  1. Environment Variables (Recommended): Create a .env file in the root directory and add your keys (VITE_GEMINI_API_KEY and VITE_MAPS_API_KEY).
  2. In-App Settings: Alternatively, navigate to the Settings section in the application and enter your keys directly into the browser session.

Assumptions Made

To scope the project for this hackathon, the following assumptions and design decisions were made:

  1. Geographical Focus: The assistant is strictly tuned for the Indian electoral system (Lok Sabha, Vidhan Sabha, and local body elections).
  2. Legal Timeliness: All statutory references (e.g., Conduct of Elections Rules, IPC sections) are based on the legal framework active as of 2024-2025.
  3. Non-Partisanship: The AI is assumed to safely reject any partisan or candidate-specific inquiries based on its system instruction constraints.
  4. Data Privacy: It is assumed that users prefer not to have their queries logged. Therefore, all API communication happens directly from the client to Google servers, and API keys are stored only in volatile browser memory or build-time environment variables.
  5. API Limits: The fallback architecture assumes that free-tier API rate limits may be frequently hit during a hackathon evaluation, necessitating the robust multi-model fallback chain implemented.

Design Philosophy

VoterSense adheres to a professional, "non-AI generated" look by:

  • Avoiding informal emojis and casual language.
  • Utilizing professional iconography (Feather Icons).
  • Implementing a structured, authoritative tone in all AI responses.
  • Ensuring a premium, accessible UI with clear hierarchy and navigation.

Security & Privacy

  • Local Storage: API credentials are stored only within the browser session and are never transmitted to external servers (except for direct Google API calls).
  • Direct Integration: Communication with Google services occurs directly from the client's browser.
  • Data Minimization: No personal user data is collected or stored.

Accessibility

  • Standardized Navigation: Full keyboard support and focus management.
  • Semantic HTML: Proper use of ARIA roles and landmarks.
  • Responsive Design: Mobile-first architecture with a collapsible sidebar.
  • Motion Control: Respects prefers-reduced-motion system settings.

Evaluation Criteria Coverage

Criteria Implementation Detail
Code Integrity Modular React architecture with clean separation of concerns.
Security Browser-local key management and direct API calls.
User Experience Fast, streaming AI responses and interactive visual elements.
Testing 12 unit tests covering fallback logic and data integrity.
Google Services Gemini API, Google Maps API, and Google Fonts integration.

Developed for the PromptWars Solution Challenge 2026

About

An AI-powered interactive assistant that simplifies the Indian election process through conversational explanations, legal troubleshooting, and Google-powered services.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors