Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍽️ Swiggy Market Intelligence Engine

Swiggy Market Intelligence Engine

Python Pandas Plotly Streamlit SQLite

Not just charts. A decision-support system for Swiggy's growth team.


About This Project

This project is a full-stack data analytics solution built on 197,430 real Swiggy food delivery orders across India. It goes beyond surface-level charts to answer the kind of strategic questions a growth analyst or product manager at Swiggy would actually care about.

The project combines exploratory data analysis, statistical testing, machine learning scoring models, SQL pipelines, and revenue forecasting into a single cohesive system β€” delivered through an interactive Streamlit dashboard, a 66-cell Jupyter notebook, and a downloadable 20-sheet Excel KPI report.

Three original analytical frameworks sit at the core:

  • City Expansion Opportunity Index β€” a composite model that ranks every city by growth potential
  • Menu Intelligence Matrix β€” a BCG-style quadrant chart classifying food categories by revenue and satisfaction
  • Restaurant Health Score β€” a viability index that flags at-risk restaurants before they churn

Whether you're exploring the data, running SQL queries, or reviewing the forecasting model, everything is connected through a single source of truth: swiggy_data.xlsx.


5 Strategic Questions This Project Answers β€” With Data

# Question Framework / Method
1 Which cities should Swiggy expand into next? City Expansion Opportunity Index
2 Which restaurants are at risk of churning off the platform? Restaurant Health Score
3 Which food categories are Stars vs Dogs in our portfolio? Menu Intelligence Matrix
4 When is peak demand, and how should ops scale? Synthetic demand modelling + time-of-day analysis
5 What does revenue look like in the next 3 months? ARIMA forecasting with train/test validation

What Makes This Different?

Most Swiggy analysis projects produce the same bar charts. This project builds three proprietary analytical frameworks modelled on consulting methodology:

πŸ™οΈ A1 β€” City Expansion Opportunity Index

A 4-signal composite model that scores every city 0–100:

  • Revenue Growth Rate (30%) β€” Is the market accelerating?
  • Weighted Customer Rating (25%) β€” Does the market have satisfied customers?
  • Order Density / restaurant (25%) β€” How efficient is the market?
  • Category Diversity (20%) β€” How sticky is the platform?

Produces a strategic 4-quadrant scatter: Stars / Untapped / Emerging / Low Priority.

🍽️ A3 β€” Menu Intelligence Matrix (BCG-Style)

Classifies food categories into four strategic quadrants:

  • ⭐ Stars β€” High revenue share + high rating β†’ Promote aggressively
  • πŸ’Ž Hidden Gems β€” Low revenue + high rating β†’ Invest in discovery
  • πŸ’° Cash Cows β€” High revenue + lower rating β†’ Maintain and improve
  • ⚠️ Review Needed β€” Low revenue + low rating β†’ Revamp or discontinue

πŸ₯ A2 β€” Restaurant Health Score (Composite Viability Index)

Assigns each restaurant a Health Score (0–100):

  • Revenue contribution (40%) + Customer satisfaction (30%) + Order volume (20%) + Recency (10%)
  • Tiered output: Champion / Healthy / At Risk / Critical

Dataset

Attribute Value
Source Swiggy platform orders
Rows 197,430
Columns 10
Key Fields State, City, Order Date, Restaurant Name, Category, Dish Name, Price (INR), Rating, Rating Count

Project Structure

SwiggyAnalysis/
β”‚
β”œβ”€β”€ app.py                      # Streamlit dashboard entrypoint
β”œβ”€β”€ dashboard_ui.py             # Page layout, sidebar filters, KPIs, footer
β”œβ”€β”€ dashboard_tabs.py           # 9 dashboard tab renderers
β”œβ”€β”€ analytics_models.py         # RFM, cohorts, statistical tests, forecast validation
β”œβ”€β”€ export_tableau_extracts.py  # Tableau-ready CSV export layer
β”œβ”€β”€ swiggy_sales_analysis.ipynb # Main analysis notebook
β”œβ”€β”€ sql_pipeline.py             # SQLite DB + 12 analytics queries
β”œβ”€β”€ generate_excel_report.py    # 20-sheet formatted Excel KPI report
β”œβ”€β”€ next-dashboard/             # Next.js analytics dashboard
β”œβ”€β”€ tests/                      # Pytest suite
β”œβ”€β”€ tableau_extracts/           # Tableau workbook + extract docs
β”œβ”€β”€ swiggy_data.xlsx            # Source dataset
β”œβ”€β”€ requirements.txt            # Runtime dependencies
└── README.md

Dashboard β€” 9 Tabs

Tab Content
πŸ“ˆ Overview Revenue KPIs, quarterly performance, day-of-week patterns
πŸ—ΊοΈ Geographic State/city heatmaps, revenue vs rating scatter
🎯 Segments Order-value segments, food preference heatmap, frequency tiers
πŸ“‰ Trends Monthly trend + 3-month moving average, MoM growth rate
πŸ’‘ Insights Pareto 80-20 analysis, price-rating correlation, Menu Intelligence Matrix
🧭 Modeled Demand Clearly separated synthetic time-of-day / peak-hour scenario
πŸ§ͺ Advanced Analytics RFM, cohort retention, Mann-Whitney U, ANOVA, ARIMA validation
πŸ—„οΈ SQL Pipeline 12 SQL queries running against a live SQLite database
πŸ“ Expansion Strategy City Expansion Opportunity Index + Restaurant Health Score

Notebook β€” End-to-End Analysis

Β§ 0   Executive Summary
Β§ 1   Data Loading & Quality Audit
Β§ 2   Weighted Rating Analysis
Β§ 3   Revenue Overview
Β§ 4   Monthly Trend & MoM Growth
Β§ 5   Category & Geographic Analysis
      ↳ A3: Menu Intelligence Matrix (BCG Framework)
      ↳ A1: City Expansion Opportunity Index
Β§ 6   Quarterly Performance
Β§ 7   Customer Segmentation
      ↳ A2: Restaurant Health Score
      ↳ 7.1 RFM Analysis
      ↳ 7.2 Peak Hours (synthetic demand)
      ↳ 7.3 Cohort Retention
      ↳ 7.4 Hypothesis Testing (Mann-Whitney U, ANOVA)
Β§ 8   Correlation & Price Analysis
Β§ 9   Geographic Visualisations
Β§10   Predictive Forecasting (ARIMA with MAPE vs naive baseline)
Β§11   SQL Integration Demo
Β§12   Excel Report Generation

Tableau Extract Layer

Streamlit is the engineering layer for live Python analytics. Tableau is intended as a focused executive BI layer, using flat CSV extracts generated from the same tested Python functions:

python export_tableau_extracts.py

This writes tableau_extracts/ with:

  • orders_enriched.csv β€” order rows plus Value_Segment, Food Category, Year-Month, Quarter, and DayName
  • city_expansion_index.csv β€” city opportunity score, inputs, and tier
  • restaurant_health_score.csv β€” restaurant health score, inputs, and tier
  • rfm_summary.csv / rfm_detail.csv β€” restaurant-partner RFM outputs
  • cohort_retention.csv β€” monthly restaurant-partner retention matrix

Use these files in Tableau instead of rebuilding RFM, cohort, ARIMA, statistical tests, or composite indices as Tableau calculated fields.


SQL Analytics Pipeline

12 queries run against a SQLite database built from swiggy_data.xlsx β€” replicating a real data-engineering pipeline:

  1. Monthly Revenue Trend
  2. Revenue by State
  3. Revenue by Category
  4. Quarterly Performance
  5. Top Dishes by Revenue
  6. Top Restaurants
  7. Day-of-Week Patterns
  8. Customer Basket Segmentation
  9. Restaurant Frequency Tiers
  10. Pareto 80% Cities
  11. Restaurant RFM Segmentation
  12. Restaurant Cohort Retention

Excel KPI Report β€” 20 Sheets

Generated on-demand from the dashboard (Download button in sidebar):

Summary KPIs Β· Monthly Trend Β· Quarterly Performance Β· Top States Β· Top Cities Β· Top Dishes Β· Category Mix Β· Customer Segments Β· Pareto Analysis Β· Day of Week Β· Time of Day Β· Price-Rating Β· Restaurant Frequency Β· RFM Summary Β· RFM Detail Β· Cohort Retention Β· Statistical Tests Β· Forecast Validation Β· Forecast Metrics Β· Revenue Forecast


Tech Stack

Layer Tools
Data Wrangling Python, Pandas, NumPy
Visualisation Plotly (interactive), Matplotlib, Seaborn
Statistics SciPy (Mann-Whitney U, ANOVA), Statsmodels (ARIMA)
ML / Scoring scikit-learn (MinMaxScaler for composite indices)
Database SQLite (via Python stdlib)
Dashboard Streamlit
Reporting openpyxl (20-sheet Excel)

Quick Start

# 1. Clone and install
git clone https://github.com/Brijesh03032001/SwiggyAnalysis.git
cd SwiggyAnalysis
pip install -r requirements.txt

# 2. Launch the dashboard
streamlit run app.py

# 3. Open the notebook
jupyter notebook swiggy_sales_analysis.ipynb

⚠️ Place swiggy_data.xlsx in the project root before running.


Testing & CI

Automated tests use small synthetic fixtures, so they run quickly without the full swiggy_data.xlsx file:

pip install -r requirements-dev.txt
pytest

The suite covers food classification edge cases, shared data preparation, RFM segmentation, cohort retention, and all SQL queries. GitHub Actions runs the same tests on every push and pull request via .github/workflows/tests.yml.


Key Findings

  • Revenue concentration measured: Pareto analysis identifies the exact city set needed to reach 80% of revenue
  • Untapped markets identified: Several tier-2 cities score high on the Expansion Index despite low current revenue
  • Critical restaurants flagged: Restaurant Health Score surfaces partners below the intervention threshold
  • Star categories: A small number of food categories drive disproportionate revenue with high satisfaction β€” clear marketing priorities
  • Modeled demand peaks: Lunch (11–13h) and Dinner (19–22h) dominate in the separated synthetic time-of-day scenario; weekends slightly outperform weekdays

Advanced Analytics Implementation Notes

The dataset does not include a Customer ID or real order timestamp. To keep the analysis honest and reproducible:

  • RFM analysis is implemented as restaurant-partner RFM using Restaurant Name as the entity.
  • Cohort retention is implemented as restaurant-partner monthly cohort retention.
  • Peak-hour analysis uses a clearly labelled synthetic demand distribution because only Order Date is available.
  • Forecasting validates ARIMA against naive and 3-month moving-average baselines using holdout months, with MAPE/RMSE shown in the dashboard and Excel report.
  • Statistical testing uses SciPy Mann-Whitney U tests for Veg vs Non-Veg distributions and ANOVA across value tiers/cities.

Skills Demonstrated

  • βœ… Analytical Frameworks β€” BCG-style matrix, composite scoring models (consulting methodology)
  • βœ… Data Analysis β€” Pandas, NumPy, exploratory analysis, outlier detection
  • βœ… Statistical Methods β€” Mann-Whitney U, ANOVA, correlation analysis
  • βœ… Visualisation β€” Interactive Plotly dashboards, storytelling with data
  • βœ… Forecasting β€” ARIMA with train/test split, MAPE vs naive baseline comparison
  • βœ… SQL β€” 12 production-style queries, SQLite pipeline, window functions
  • βœ… Business Intelligence β€” KPI design, customer segmentation, Pareto analysis
  • βœ… Software Engineering β€” Modular Python, Streamlit app, downloadable Excel reports

πŸ“¬ Contact & Links

Brijesh Kumar

About

🍽️ Swiggy Market Intelligence Engine β€” turns 197K+ food delivery orders into strategy using BCG Menu Matrix, City Expansion Index & Restaurant Health Score. Built with Python, Pandas, Plotly, SQLite & Streamlit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages