AhanaS07/finalround_interview_project
If you are the rightful owner of finalround_interview_project and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Interview Analytics Platform is a comprehensive data analytics solution designed to analyze user behavior, product engagement, and subscription metrics across various interview preparation products.
Interview Analytics Platform
A comprehensive data analytics platform for analyzing user behavior, product engagement, and subscription metrics across interview preparation products. Built with Python, SQLite, and modern web technologies.
Overview
This platform provides real-time analytics and insights for a suite of interview preparation products including:
- Mock Interviews
- Live Interviews
- Auto-Apply Features
The system processes user data, session logs, and engagement metrics to deliver actionable business intelligence through interactive dashboards, REST APIs, and conversational AI interfaces.
Features
Core Analytics
- User Engagement Analysis: Track activation, retention, and product usage patterns
- Subscription Analytics: Monitor conversion rates across four subscription tiers (none, normal, plus, god)
- Revenue Metrics: Calculate MRR, ARR, and revenue by plan
- Product Performance: Analyze engagement by product page and feature
- Cohort Analysis: Track user behavior by signup cohorts
- Geographic Distribution: Analyze user demographics and spending patterns
Interfaces
-
Interactive Dashboard (Streamlit)
- Real-time metrics visualization
- Product engagement analysis
- User demographics and spending insights
- Session analytics
-
REST API (FastAPI)
- Query analytics data programmatically
- WebSocket support for real-time updates
- JSON-based response format
-
Conversational AI Interface (MCP Server)
- Natural language queries for analytics
- AI-powered insights and recommendations
- Integration with AI assistants
Architecture
├── Data Layer
│ ├── SQLite database (interview_data.db)
│ ├── Users table (demographics, subscriptions)
│ ├── Sessions table (user activity)
│ └── Product visits table (engagement data)
│
├── Processing Layer
│ ├── data_loader.py - ETL pipeline
│ ├── revenue_calculator.py - Business metrics
│ ├── user_updater.py - Data enrichment
│ └── analytics_module.py - Core analytics engine
│
└── Presentation Layer
├── dashboard.py - Streamlit UI
├── api.py - REST API
└── mcp_server.py - AI conversation interface
Installation
Prerequisites
- Python 3.11 or higher
- pip package manager
Setup
- Clone the repository:
git clone <repository-url>
cd finalround_interview_project
- Install dependencies:
# Core analytics and dashboard
pip install -r requirements.txt
# API server (optional)
pip install -r requirements_api.txt
- Prepare data files:
Place the following files in the
data/directory:
users_data.csv- User profile data (~20,000 users)simulated_logs.json- Activity logs (~30,000 records)
Usage
1. Initialize Database and Run ETL Pipeline
Process raw data and populate the database:
python main.py
This will:
- Create database schema
- Load user data from CSV
- Process session logs
- Generate revenue metrics
- Create analytics reports
Output: analysis_report.json with detailed metrics
2. Launch Interactive Dashboard
# Using the shell script
./run_dashboard.sh
# Or directly with Streamlit
streamlit run dashboard.py
Access the dashboard at http://localhost:8501
Features:
- Overview metrics (users, sessions, revenue)
- Product engagement visualization
- User demographics analysis
- Session analytics
- Data quality monitoring
3. Start REST API Server
python api.py
API available at http://localhost:8000
Endpoints:
GET /- API status and documentationPOST /query- Query analytics dataPOST /metrics- Get specific metrics- WebSocket
/ws- Real-time updates
Example queries:
# Get conversion rate
curl -X POST http://localhost:8000/query \
-H "Content-Type: application/json" \
-d '{"query": "What is the conversion rate for live interviews?"}'
# Get user metrics
curl -X POST http://localhost:8000/metrics \
-H "Content-Type: application/json" \
-d '{"metric_type": "user_engagement"}'
4. Launch AI Conversation Interface (MCP Server)
./start_mcp.sh
The MCP server provides:
- Natural language analytics queries
- AI-powered insights
- Integration with AI assistants
- Context-aware recommendations
Data Schema
Users Table
user_id- Unique identifiername,email,country- Profile informationage,sex,married- Demographicscurrent_plan- Subscription tier (none/normal/plus/god)total_spent_local- Lifetime spendinglast_seen,joined_at- Activity timestamps
Sessions Table
session_id- Unique session identifieruser_id- Foreign key to usersduration_minutes- Session lengthtimestamp- Session start time
Product Visits Table
visit_id- Unique visit identifiersession_id- Foreign key to sessionspage_type- Product page visitedduration_minutes- Time on pagetimestamp- Visit timestamp
Key Metrics
Subscription Tiers
- None: Free tier users
- Normal: Basic paid subscription
- Plus: Premium subscription
- God: Ultimate tier with all features
Product Pages
- mock_interview: Practice interview sessions
- live_interview: Real-time interview coaching
- auto_apply: Automated job application service
Calculated Metrics
- Monthly Recurring Revenue (MRR)
- Annual Recurring Revenue (ARR)
- Conversion rates by product
- User engagement rate
- Average session duration
- Product usage frequency
- Cohort retention rates
Testing
API Tests
python test_api.py
Chat Client Tests
python test_chat.py
MCP Server Tests
python test_mcp.py
Dashboard Verification
python verify_dashboard.py
Configuration
Environment Variables
Create a .env file:
DATABASE_URL=sqlite:///interview_data.db
API_PORT=8000
DASHBOARD_PORT=8501
MCP Configuration
Edit mcp_config.json to customize the AI conversation interface:
{
"server_name": "interview-analytics",
"version": "1.0.0",
"capabilities": ["query", "analytics", "insights"]
}
Project Structure
finalround_interview_project/
├── data/ # Data files
│ ├── users_data.csv
│ └── simulated_logs.json
├── main.py # ETL pipeline orchestrator
├── database_schema.py # Database schema and management
├── data_loader.py # Data loading utilities
├── data_validation.py # Data quality checks
├── user_updater.py # User data enrichment
├── revenue_calculator.py # Revenue and business metrics
├── analytics_module.py # Core analytics engine
├── analytics_summary.py # Summary statistics
├── dashboard.py # Streamlit dashboard
├── api.py # FastAPI REST API
├── mcp_server.py # AI conversation interface
├── chat_client.py # Chat client implementation
├── requirements.txt # Python dependencies
├── requirements_api.txt # API-specific dependencies
└── run_dashboard.sh # Dashboard launcher script
Performance
- Data Processing: ~2-5 seconds for 20,000+ users
- Query Performance: <100ms for most analytics queries
- Dashboard Load Time: <2 seconds initial load
- API Response Time: <50ms average
Troubleshooting
Database Issues
# Remove existing database and rebuild
rm interview_data.db
python main.py
Port Conflicts
If default ports are in use, specify alternatives:
# Dashboard on custom port
streamlit run dashboard.py --server.port 8502
# API on custom port
uvicorn api:app --port 8001
Missing Dependencies
# Reinstall all dependencies
pip install -r requirements.txt --force-reinstall
License
MIT License - feel free to use this code for learning and development purposes.