CoolFace
Apppublic

ketannnn/Retail-Sales-Intelligence-Dashboard

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

๐Ÿ›’ Retail Sales Intelligence Dashboard

A complete Data Analyst portfolio project โ€” data cleaning, SQL analysis, EDA, and an interactive Streamlit dashboard built on the Superstore sales dataset.

๐Ÿ“Œ Problem Statement

A Superstore Giant is experiencing intense market competition and seeks data-driven guidance on:

  • โ€”Which products, regions, categories and customer segments to prioritise or avoid
  • โ€”How discount policies affect profitability
  • โ€”Which shipping modes are most cost-effective
  • โ€”Where consistent losses are occurring and why

๐Ÿ“‚ Dataset Description

ColumnDescription
Row IDUnique row identifier
Order IDUnique order identifier
Order DateDate the order was placed
Ship DateDate the order was shipped
Ship ModeCustomer-selected shipping method
Customer ID / NameCustomer identifiers
SegmentCustomer segment (Consumer, Corporate, Home Office)
Country / City / State / Postal CodeLocation fields
RegionSales region (West, East, Central, South)
Product ID / NameProduct identifiers
Category / Sub-CategoryProduct classification
SalesRevenue from the order line
QuantityUnits ordered
DiscountFractional discount applied (0โ€“1)
ProfitNet profit / loss

Source: Sample โ€“ Superstore public dataset (9,994 rows, 21 columns)


๐Ÿ› ๏ธ Tools Used

LayerTechnology
LanguagePython 3.11+
Data wranglingPandas, NumPy
VisualisationPlotly, Matplotlib, Seaborn
DatabaseSQLite + SQLAlchemy
DashboardStreamlit
NotebooksJupyter
DeploymentDocker + Hugging Face Spaces

๐Ÿ—‚๏ธ Project Structure

retail-sales-intelligence-dashboard/
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ raw/
โ”‚   โ”‚   โ””โ”€โ”€ Sample - Superstore.csv
โ”‚   โ””โ”€โ”€ processed/              โ† auto-generated at container start
โ”‚       โ””โ”€โ”€ cleaned_superstore.csv
โ”œโ”€โ”€ .streamlit/
โ”‚   โ””โ”€โ”€ config.toml             โ† Streamlit server config for HF Spaces
โ”œโ”€โ”€ notebooks/
โ”‚   โ””โ”€โ”€ 01_data_cleaning_and_eda.ipynb
โ”œโ”€โ”€ sql/
โ”‚   โ””โ”€โ”€ business_queries.sql
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ data_cleaning.py
โ”‚   โ”œโ”€โ”€ database.py
โ”‚   โ””โ”€โ”€ analysis.py
โ”œโ”€โ”€ dashboard/
โ”‚   โ””โ”€โ”€ app.py
โ”œโ”€โ”€ Dockerfile                  โ† HF Spaces Docker deployment
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ .gitignore

โœจ Key Features

  • โ€”Automated Data Cleaning โ€” snake_case normalisation, datetime parsing, duplicate removal, safe null handling
  • โ€”Feature Engineering โ€” order_year, order_month, order_quarter, delivery_days, profit_margin, discount_range, is_profitable
  • โ€”SQLite Integration โ€” cleaned data stored in retail_sales.db for SQL-based analysis
  • โ€”10 SQL Business Queries โ€” KPIs, trends, region/category/segment/product analysis, discount impact, loss detection
  • โ€”Interactive Dashboard โ€” 8 dashboard sections with 15+ Plotly charts, KPI cards, sidebar filters, and CSV export
  • โ€”Dynamic Business Recommendations โ€” auto-generated insights from the filtered data
  • โ€”Docker Deployment โ€” runs on Hugging Face Spaces via Docker SDK

๐Ÿ“Š Dashboard Sections

SectionContent
AKPI Cards (Sales, Profit, Orders, Margin, Discount, Customers)
BMonthly Sales & Profit Trend lines
CSales & Profit by Region, Sales by Segment
DTop/Bottom products, Category vs Sub-Category heatmap
EDiscount vs Profit scatter, Avg profit by discount range, Loss order table
FAvg delivery days & Sales/Profit by Ship Mode
GFiltered data preview + CSV download
HDynamic business recommendations

๐Ÿ” SQL Analysis Included

  1. 1.Overall KPIs
  2. 2.Monthly sales & profit trend
  3. 3.Region-wise performance
  4. 4.Category-wise performance
  5. 5.Top 10 products by profit
  6. 6.Bottom 10 products by profit (loss makers)
  7. 7.Discount range impact on profit
  8. 8.Ship mode performance
  9. 9.Segment-wise performance
  10. 10.Loss-making sub-categories
  11. 11.Bonus: High-discount loss-making orders

๐Ÿ’ก Key Business Insights

  1. 1.Technology generates the highest profit margin; Furniture is the weakest.
  2. 2.Tables and Bookcases are consistent loss-makers, especially at high discounts.
  3. 3.Discounts above 20% almost always result in losses across all categories.
  4. 4.The West region is the top revenue driver; the Central region needs margin improvement.
  5. 5.Standard Class accounts for ~60% of orders but has the longest delivery times.
  6. 6.Corporate and Consumer segments dominate sales volume; Home Office is underserved.

๐Ÿš€ How to Run Locally

bash
# 1. Clone the repo
git clone https://github.com/yourusername/retail-sales-intelligence-dashboard.git
cd retail-sales-intelligence-dashboard

# 2. Create and activate virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Clean the raw data
python src/data_cleaning.py

# 5. Load into SQLite
python src/database.py

# 6. Launch the dashboard
streamlit run dashboard/app.py

# 7. (Optional) Open the Jupyter notebook
jupyter notebook notebooks/01_data_cleaning_and_eda.ipynb

๐Ÿณ Run with Docker

bash
# Build the image
docker build -t retail-sales-dashboard .

# Run the container
docker run -p 8501:8501 retail-sales-dashboard

Then open http://localhost:8501


๐Ÿ“‹ Resume Bullet Points

  • โ€”Built an end-to-end retail sales analytics project in Python using Pandas, SQLite, and Streamlit, analysing 9,994 transactions across 4 regions and 17 product sub-categories
  • โ€”Engineered 7 derived features (profit margin, delivery days, discount buckets) and automated data cleaning with encoding-safe CSV ingestion
  • โ€”Authored 10 SQL business queries identifying recoverable losses from high-discount unprofitable orders
  • โ€”Developed an interactive Streamlit dashboard with 15+ Plotly charts, dynamic KPI cards, sidebar filters, and a CSV export feature
  • โ€”Containerised the application with Docker and deployed to Hugging Face Spaces for public access

๐Ÿ“„ License

MIT โ€” free to use for portfolio and educational purposes.