A full-stack AI-powered data analytics dashboard that lets you ask questions in natural language and automatically:
- Generates SQL queries for SQL Server
- Executes them on your database
- Visualizes results as charts
- Produces AI-generated business insights
##Tech Stack
Backend
C#, .NET 10 (ASP.NET Core)
Entity Framework Core
SQL Server / SQL Express
OpenAI Chat Completions API (GPT-4o-mini)
Dependency Injection, HttpClient, Options pattern
Frontend
HTML5
Tailwind CSS
Font Awesome icons
Chart.js for charts
Vanilla JavaScript + Fetch API
This project simulates a mini “AI + BI” tool:
-
You type a question in plain English
e.g., “Show me total sales by month for the last year”
-
The backend uses OpenAI GPT-4o-mini to:
- Understand your intent
- Generate a T-SQL query against your schema
-
The app runs this SQL against a Sales database via Entity Framework Core.
-
The result is:
- Returned to the frontend as JSON
- Visualized with Chart.js (line/bar charts for trends, etc.)
- Sent back to OpenAI again to generate business-level insights (trends, peaks, anomalies, recommendations)
-
The UI displays:
- The exact SQL query used
- Execution stats (rows returned, time, confidence)
- AI-generated insights in natural language
- Interactive charts that show how metrics change over time or by category
[User Browser] │ ▼ [HTML + Tailwind + JS + Chart.js] ← (index.html served from wwwroot) │ ▼ [ASP.NET Core Controllers] │ ├─ /api/test/query → Natural language → SQL → execute → insights + chart data └─ /api/test/test-db → Database connectivity check │ ▼ [Services: AiQueryService] │ ├─ Calls OpenAI (chat completions) to create SQL └─ Calls OpenAI again to summarize result rows as insights │ ▼ [EF Core + SQL Server] ├─ Tables: Sales, Customers, Products, ProductCategories └─ Seeded demo data for analytics



