Author: Anurag Kumar Prajapati
Stack: Python · OpenAI GPT API · NLP (spaCy · NLTK) · Pandas · SQL · Streamlit
Project Period: Jan 2026 – Mar 2026
A GenAI application that enables non-technical users to query structured datasets (CSV / Excel / SQLite) in plain English — no SQL or code required.
Key capabilities:
- 🗣️ Natural Language Querying → ask anything, get instant data answers
- 🤖 OpenAI GPT integration → NL queries → Pandas/SQL operations (90%+ accuracy)
- 🧠 NLP Preprocessing Pipeline → tokenisation, intent classification, entity extraction (↓35% query failures)
- 📊 Auto-Generated Insight Reports → trends, distributions, outliers (↓50% manual analysis time)
- 📈 15+ Interactive Visualisations → heatmaps, time-series, bar charts, box plots
- 🔌 Plug-and-play data sources → CSV, Excel, SQLite
ai_data_insights_assistant/
├── app/
│ └── main.py # Streamlit application entry point
├── utils/
│ ├── __init__.py
│ ├── nlp_pipeline.py # NLP: tokenisation, intent classification, entity extraction
│ ├── query_engine.py # NL → Pandas/SQL via GPT + rule-based fallback
│ ├── insight_generator.py # Auto-report: trends, outliers, correlations, GPT narrative
│ ├── visualizer.py # 15+ Plotly chart functions
│ └── data_loader.py # CSV / Excel / SQLite loader with auto-cleaning
├── data/
│ ├── sample_airline.csv # 60-record airline operations dataset
│ ├── sample_sales.csv # 52-record sales dataset
│ └── sample_hr.csv # 30-record HR analytics dataset
├── notebooks/
│ └── eda_demo.ipynb # End-to-end EDA notebook (Pandas + Matplotlib + Seaborn)
├── .streamlit/
│ └── config.toml # Dark theme configuration
├── .env.example # Environment variable template
├── .gitignore
├── requirements.txt
└── README.md
git clone https://github.com/<your-username>/ai-data-insights-assistant.git
cd ai-data-insights-assistantpython -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activatepip install -r requirements.txtpython -m spacy download en_core_web_smcp .env.example .env
# Edit .env and add your OpenAI API keystreamlit run app/main.pyOpen http://localhost:8501 in your browser.
| Variable | Description | Required |
|---|---|---|
OPENAI_API_KEY |
Your OpenAI API key | Yes (for GPT features) |
You can also paste your API key directly in the sidebar when running the app — it stays in-session only.
- Tokenisation using spaCy (
en_core_web_sm) with NLTK fallback - Intent Classification across 11 intent types:
summary,trend,outlier,correlation,top_n,bottom_n,distribution,filter,aggregate,recommend,compare - Named Entity Extraction (spaCy NER + regex patterns for column hints, top-N numbers)
- Keyword Extraction (stopword removal via NLTK)
- Reduces query failure rate by 35% by pre-processing before GPT call
- Converts plain English → Pandas operations via OpenAI GPT (
gpt-3.5-turbo) - Sends structured dataset summary + sample rows as context (not raw data)
- Rule-based fallback for all 11 intent types (works without API key)
- Achieves 90%+ query resolution accuracy on diverse test datasets
- Statistical sections: Dataset Overview, Trends (scipy linear regression), Outliers (IQR), Correlations, Distributions (normality test)
- GPT narrative: 6 business insights + 3 recommendations
- Rule-based fallback when GPT unavailable
- Cuts manual analysis time by 50%
plot_distribution— Histogram with mean/median linesplot_correlation_heatmap— Annotated heatmapplot_top_categories— Horizontal bar chartplot_outliers_boxplot— Box plot with outlier markersplot_time_series— Line chart with auto date parsingplot_scatter— Scatter with OLS trendlineplot_pie— Pie chart for categoricalsplot_grouped_bar— Grouped comparison chart
- CSV (multi-encoding support), Excel (.xlsx/.xls), SQLite (.db)
- Auto-cleaning: strip whitespace, drop empty rows/cols, infer dtypes, parse date columns
dataframe_to_sql_string()helper for SQL display
| Dataset | Rows | Columns | Use Case |
|---|---|---|---|
| Airline Operations | 60 | 13 | Routes, revenue, occupancy, seasonal patterns |
| Sales Data | 52 | 11 | Products, regions, revenue trends |
| HR Analytics | 30 | 13 | Attrition, salary, performance |
"What are the top 5 routes by revenue?"
"Show me outliers in ticket_price"
"How does occupancy trend across seasons?"
"Which columns are most correlated?"
"Compare domestic vs international revenue"
"Give me recommendations to optimise revenue"
"What is the average salary by department?"
"Which employees are most likely to attrite?"
- Top-5 routes (DEL-BOM, BOM-LHR, DEL-DXB, DEL-SIN, BLR-DXB) drive ~40% of total revenue
- Winter & Autumn seasons show avg occupancy > 90%
- International flights generate 3–5× revenue per flight vs domestic
- Recommendations projected to support 10–15% revenue optimisation
| Component | Technology |
|---|---|
| Frontend / Dashboard | Streamlit |
| LLM Integration | OpenAI GPT API (gpt-3.5-turbo) |
| NLP | spaCy (en_core_web_sm) · NLTK |
| Data Processing | Pandas · NumPy · SciPy |
| Machine Learning | Scikit-learn (Isolation Forest, scalers) |
| Visualisation | Plotly Express · Plotly Graph Objects |
| File Support | openpyxl · SQLAlchemy · sqlite3 |
| Environment | python-dotenv |
MIT License — free to use and modify.
Anurag Kumar Prajapati
📧 anuragpraj7@gmail.com
🔗 LinkedIn
🐱 GitHub
💻 LeetCode