9b97140fffb23acabb69d8e8352f632b06c0cf3b
Election Analytics Chatbot
A stateful, graph-based chatbot for election data analysis, built with LangGraph, FastAPI, and React.
🚀 Features
- Intelligent Query Analysis: Automatically determines if a query needs data analysis, web research, or clarification.
- Automated Data Analysis: Generates and executes Python code to analyze election datasets and produce visualizations.
- Web Research: Integrates web search capabilities for general election-related questions.
- Stateful Conversations: Maintains context across multiple turns using LangGraph's persistent checkpointing.
- Real-time Streaming: Streams reasoning steps, code execution outputs, and plots to the UI.
- Secure Authentication: Traditional login and OIDC/SSO support with HttpOnly cookies.
- History Management: Persistent storage and management of chat history and generated artifacts.
🏗️ Project Structure
backend/: Python FastAPI application using LangGraph.frontend/: React SPA built with TypeScript, Vite, and Tailwind CSS.
🛠️ Prerequisites
- Python 3.11+
- Node.js 18+
- PostgreSQL
- Docker (optional, for Postgres/PgAdmin)
- API Keys: OpenAI/Google Gemini, Google Search (if using research tools).
📥 Getting Started
Backend Setup
- Navigate to the backend directory:
cd backend - Install dependencies:
uv sync - Set up environment variables:
cp .env.example .env # Edit .env with your configuration and API keys - Run database migrations:
uv run alembic upgrade head - Start the server:
uv run python -m ea_chatbot.api.main
Frontend Setup
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install - Start the development server:
npm run dev
📖 Documentation
- Top-level GEMINI.md: General project overview.
- Backend Guide: Detailed backend architecture and implementation details.
- Frontend Guide: Frontend development guide and technology stack.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
Description
Languages
Python
65.3%
TypeScript
33.1%
CSS
1.2%
Mako
0.2%
JavaScript
0.1%