Organizations struggle to extract meaningful insights from their data and Power BI dashboards. Data analysts spend significant time answering repetitive questions about metrics, trends, and KPIs. This project solves this by creating an AI-powered conversational data analyst that:
┌─────────────────────────────────────────────────────────────────┐
│ USER INTERFACE (Streamlit) │
│ Upload Data → Analyze → Chat → Insights │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ CONVERSATIONAL AI ENGINE │
│ ┌──────────────┐ ┌──────────────┐ ┌────────────────────┐ │
│ │ Intent │ │ Context │ │ Response │ │
│ │ Classifier │ │ Retriever │ │ Generator (LLM) │ │
│ │ │ │ (RAG-style) │ │ │ │
│ └──────────────┘ └──────────────┘ └────────────────────┘ │
└────────────────────────────┬────────────────────────────────────┘
│
┌──────────────┴──────────────┐
▼ ▼
┌─────────────────────────┐ ┌──────────────────────────────┐
│ DATA ANALYSIS ENGINE │ │ POWER BI INTEGRATION │
│ • Data Loader │ │ • Metadata Parser │
│ • EDA Engine │ │ • KPI Analyzer │
│ • Insight Generator │ │ • Dashboard Explainer │
│ • Statistical Analysis │ │ │
└───────────┬─────────────┘ └──────────────┬───────────────┘
│ │
▼ ▼
┌─────────────────────────┐ ┌──────────────────────────────┐
│ CSV/Excel Dataset │ │ Power BI Metadata (JSON) │
└─────────────────────────┘ └──────────────────────────────┘
llm_data_analyst/
├── app.py # Streamlit UI application
├── requirements.txt # Python dependencies
├── .env.template # Environment variables template
├── README.md # This file
│
├── config/
│ └── settings.py # Application configuration
│
├── src/
│ ├── analysis/
│ │ ├── data_loader.py # Dataset loading and validation
│ │ ├── eda_engine.py # Exploratory Data Analysis
│ │ └── insight_generator.py # Converts EDA to insights
│ │
│ ├── chatbot/
│ │ ├── intent_classifier.py # Classifies user queries
│ │ ├── context_retriever.py # RAG-style context retrieval
│ │ └── chatbot_engine.py # Main conversational AI
│ │
│ ├── powerbi/
│ │ └── metadata_parser.py # Power BI integration
│ │
│ └── utils/
│ └── llm_client.py # LLM client (OpenAI/Anthropic/Mock)
│
├── prompts/
│ └── templates.py # LLM prompt templates
│
├── data/
│ ├── sample_sales_data.csv # Sample dataset
│ └── powerbi_metadata.json # Sample Power BI metadata
│
└── outputs/ # Generated reports and analyses
git clone <repository-url>
cd llm_data_analyst
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.template .env
# Edit .env and add your API keys
streamlit run app.py
The application will open in your browser at http://localhost:8501
General Analysis:
- "What are the main trends in the data?"
- "Which variables are strongly correlated?"
- "Show me the top 5 insights"
Specific Queries:
- "Explain the outliers in Sales_Amount"
- "Why is revenue increasing?"
- "Compare Northeast vs Southeast regions"
KPI Questions:
- "What is the current Customer Satisfaction Score?"
- "Why is Total Revenue below target?"
- "Explain the Marketing ROI metric"
Dashboard:
- "Summarize the dashboard"
- "Which KPIs need attention?"
- "Show me all underperforming metrics"
Generates metadata
EDA Engine
Missing value analysis
Insight Generation
Entity extraction
Context Retrieval (RAG)
Maintains conversation history
Response Generation
The system integrates with Power BI through metadata-based approach:
Export from Power BI (Manual Process): 1. Identify key KPIs and their current values 2. Note trends, targets, and performance indicators 3. Export as JSON in the required format
Metadata Structure:
{
"dashboard_name": "Dashboard Name",
"kpis": [
{
"name": "KPI Name",
"value": 12345,
"target": 10000,
"trend": {
"direction": "increasing",
"value": 7.2
}
}
],
"filters": {...},
"visualizations": [...]
}
The system supports three LLM modes:
Perfect for development/demo
OpenAI
USE_MOCK_LLM=false in .envOPENAI_API_KEY to .envUses GPT-4 Turbo
Anthropic Claude
USE_MOCK_LLM=false in .envANTHROPIC_API_KEY to .envThe project includes sample data in data/:
Problem Identification: "Organizations have vast amounts of data in Excel files and Power BI dashboards, but extracting insights requires manual analysis. I built an AI system that automatically analyzes data, generates insights, and answers questions conversationally."
Solution Architecture: "The system has three main components:
Data Analysis Engine: Performs comprehensive EDA - descriptive stats, correlations, outlier detection, trend analysis. It's built with pandas, scipy, and scikit-learn.
LLM Integration: Uses prompt engineering to convert statistical findings into business insights. I created structured prompts for different tasks - executive summaries, trend explanations, KPI descriptions.
Conversational AI: Implements RAG (Retrieval-Augmented Generation) - classifies user intent, retrieves relevant context from the analysis, and generates responses using the LLM."
Key Technical Decisions:
Why metadata-based Power BI integration? "Scraping Power BI UI would be fragile and violate terms of service. Metadata-based approach is clean, maintainable, and allows users to control exactly what data is shared with the AI."
Why RAG instead of fine-tuning? "RAG provides current, accurate answers without requiring model retraining. The context retriever ensures responses are grounded in actual data, preventing hallucinations."
Why support Mock LLM? "Makes the system testable and demonstrable without API costs. Shows I think about development workflows and production concerns."
Challenges Solved:
Production Considerations:
# Test data loading
python -c "from src.analysis.data_loader import DataLoader; loader = DataLoader(); loader.load_file('data/sample_sales_data.csv')"
# Test EDA
python -c "from src.analysis.eda_engine import EDAEngine; import pandas as pd; data = pd.read_csv('data/sample_sales_data.csv'); eda = EDAEngine(data); results = eda.run_full_analysis(); print(results.keys())"
# Test chatbot
python -c "from src.chatbot.chatbot_engine import DataAnalystChatbot; bot = DataAnalystChatbot(use_mock=True); print(bot.chat('What are the key insights?'))"
This project is for educational and demonstration purposes.
This is a portfolio project. For improvements or questions, please open an issue.
For questions about this project or interview discussions, please contact the developer.
Built with: Python, Streamlit, Pandas, OpenAI/Anthropic APIs, Power BI Integration
$ claude mcp add AnalyticaX \
-- python -m otcore.mcp_server <graph>