Jun 13, 2026

NF QueryGPT – AI Database Analyst

bwai-trae-delhi hackathon traehackathonl commudle aidataanalyst nextjs fastapi gemini3.5 sql

An AI-powered conversational Database Analyst for matrimony platforms supporting English, Hinglish, and voice queries. Integrates dual-layer read-only security, an interactive 3D table relationship explorer, and on-the-fly CSV/JSON/Excel dataset analysis.


💡 The Problem (The Why)

In fast-growing enterprises (like matrimony services), operational managers, customer support reps, and marketing leaders frequently need data insights to make strategic decisions. Currently, they face two options:

  1. Wait Days for IT: Requesting custom SQL reports from data engineers, delaying fast decisions.
  2. Direct Client Vulnerabilities: Granting non-technical users access to SQL consoles, which exposes the system to query performance degradation, accidental deletions, or injection attacks.

✨ The Solution (The What)

NF QueryGPT is a secure, natural language analytics portal. It acts as an on-demand AI Business Analyst that translates voice commands, standard English, or colloquial Hinglish ("Delhi se kitne users active active hain?") into safe, optimized database queries, executing them instantly.

Core Features:

  1. Interactive 3D Schema Explorer: Renders an interactive 3D table node mesh showing database tables, column types, and foreign key references. Drag-to-rotate interaction allows users to visualize how database entities relate.
  2. Dual-Layer SQL Safety:
    • Grammar Scanner (Regex Layer): Screens SQL commands pre-execution to block administrative commands, mutations, and DML keywords (INSERTDROPDELETEUPDATEALTER).
    • Physical System Locks (SQLite Level): Opens the database connection pool strictly in read-only mode (?mode=ro). Even if system prompts or regex filters are bypassed, the database engine physically rejects write operations.
  3. Structured AI Analyst Insights: Rather than just displaying raw numbers, the tool automatically breaks down every data query into three categories:
    • What Happened: A concise summary of raw data metrics.
    • Why It Matters: The business value, anomalies, or underlying trends.
    • What Action to Take: Actionable operational recommendations.
  4. Hinglish & Real-Time Voice Search: Air-tight integration with the browser Web Speech API for voice recognition, system-prompted to interpret colloquial terminology. Includes a text-to-speech speaker to read executive summaries aloud.
  5. No-API-Key Mock Mode: Dynamic regex-based mock router allows the system to resolve standard query paths offline/without an API key, ensuring 100% demo uptime for hackathon judges.
  6. Custom Dataset File Upload Analyzer (New Build Feature):
    • Users can drag-and-drop or upload custom external data files (.csv.json.xlsx).
    • Parses datasets on-the-fly and projects them in the UI table preview, feeding sample records to the AI Business Analyst to yield strategic insights and auto-recommend charts.
  7. Publication-Grade PDF & Excel Exports: Instantly compiles user prompts, queries, and charts into executive PDF reports ready for print.

🛠️ Tech Stack

  • Frontend: Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS, Recharts (for dynamic visualizations), Lucide Icons.
  • Backend: FastAPI (Python 3.12), SQLite3, SQLAlchemy, OpenPyXL, google-generativeai / Gemini LLM.
  • Deployment: Vercel (Frontend), Local FastAPI (Backend Uvicorn server).

⚙️ How It Works (System Design)

  1. Input: User speaks or types a query (e.g., "Show subscription revenue splits").
  2. SQL Generation: The query is routed to the FastAPI backend, which matches schema context with Gemini to generate a SELECT SQL block.
  3. Safety Verification: Code runs through regex scanner, and executes on the database opened with ?mode=ro.
  4. Execution & Mapping: The results are parsed. The engine matches the number/types of columns to recommend the best visualization (KPI Card, Pie, Bar, or Line Chart).
  5. AI Synthesis: Data is processed to produce strategic insights.
  6. File Upload Mode: External CSV/JSON/Excel files skip SQL generation, parse the contents into a preview model, and pipe data structures directly into the visualizers and AI analyst.

1

Give a star to encourage!Discussion
Start a new conversation!
Login to join the discussion

More Builds by Aman Agrahari

aman agrahari software developer web developer full stack developer react developer
aman agrahari election awareness platform democracy awareness platform aman agrahari projects innovative bca project
ai career guidance platform ai learning platform skill development platform future career planning platform ai powered student guidance