How aswinpookkatt/genieverse works
Project type and purpose
• Type: Full-stack, voice-enabled data analysis application built with Streamlit.
• Purpose: Convert user voice or text input into SQL queries, execute them against DuckDB or Databricks, and render analytic visualizations. It includes user authentication, session management, SQL sanitization, data profiling, and AI-powered query generation via Google Gemini.
File structure
• Top-level scripts:
• login.py, home.py → Authentication and landing pages
• app.py, app_01.py, test.py → Voice and text query entry points
• ui.py → Shared UI helper functions
• router.py → Directs an NL request to the appropriate AI agent
• agents.py → Implements “Data Engineer” & “Visualization” agents
• prompts.py → Templates for AI prompts
• utils.py → Database connection, query execution, sanitization
• Folders:
• data/ → Sample CSVs, DuckDB files, and database-setup scripts
• data_scanner/ → Data profiling (anomaly detection) & data quality checks
• static/ → Images and assets (e.g., the logo)
• .streamlit/ → Streamlit config and secrets for API keys & DB paths
• Configs & dependencies: requirements.txt, .streamlit/config.toml, .streamlit/secrets.toml
README for additional insights
• Architecture callouts: Authentication, AI agents, voice features, data analysis, UI components, configuration.
• External dependencies: Google Gemini API, DuckDB or Databricks, Plotly, streamlit-mic-recorder.
a. Main components
• User Interface (Streamlit Frontend)
• Login page → Session manager
• Home/dashboard → Buttons for text/voice input
• Visualization canvas (Plotly charts)
• Voice/Text Input Processing
• streamlit-mic-recorder (voice) → Speech-to-text conversion
• Application Logic Layer
• router.py → Routes request to correct agent
• agents.py →
– Data Engineer Agent (generates SQL)
– Visualization Agent (chooses chart type, builds JSON config)
• prompts.py → AI-prompt templates
• AI Service
• Google Gemini (external API)
• Data Access Layer
• utils.py → DB connection pool, query execution, sanitization, modification detection
• Data Scanner micro-service → data_profiler.py & data_quality.py
• Persistence
• DuckDB (local .duckdb files) or Databricks SQL Warehouse
• users_db.duckdb for authentication and chat history
• Static Assets
• static/ for images
b. Relationships and data flow
1. User interacts with Streamlit UI → selects voice or text mode.
3. router.py receives input → picks an agent based on context.
4. Agent sends prompt + schema info to Google Gemini → receives SQL or visualization instructions.
5. utils.py executes SQL against DuckDB/Databricks → returns result set.
6. Visualization Agent formats results into Plotly charts → UI renders them.
7. Data Scanner can be invoked for profiling → writes reports back to UI.
8. Session data & chat history stored in users_db.duckdb.
c. Architectural patterns
• Layered architecture: UI → Application logic → Data access → Storage
• Micro-services style: Data Scanner as a self-contained component
• API integration: External AI service (Google Gemini) decoupled via router
d. Key technologies
• Streamlit (UI)
• streamlit-mic-recorder (voice capture)
• Google Gemini API (NLP → SQL)
• DuckDB / Databricks (storage & analytics)
• Plotly (visualizations)
• Python modules: agents.py, router.py, utils.py, data_scanner/*
Elements
• Clear labels: name each module (e.g., “Data Engineer Agent”)
• Blue rectangles for components/modules
• Orange parallelogram for static assets