A professional Streamlit dashboard for analyzing e-commerce sales metrics, featuring interactive visualizations and configurable date range filtering.
- Interactive Date Filtering: Select year and month range with automatic comparison to previous year
- Key Performance Indicators: Revenue, monthly growth, average order value, and total orders with trend indicators
- Revenue Analysis: Monthly trend comparison between current and previous periods
- Product Category Analysis: Top 10 categories by revenue with visual ranking
- Geographic Analysis: US choropleth map showing revenue distribution by state
- Customer Experience Metrics: Review scores and delivery time analysis
cc-data-analysis/
├── app.py # Streamlit dashboard application
├── data_loader.py # Data loading and preparation functions
├── business_metrics.py # Business metric calculation functions
├── EDA.ipynb # Original exploratory data analysis
├── EDA_Refactored.ipynb # Refactored analysis notebook
├── ecommerce_data/ # Data directory
│ ├── orders_dataset.csv
│ ├── order_items_dataset.csv
│ ├── products_dataset.csv
│ ├── customers_dataset.csv
│ ├── order_reviews_dataset.csv
│ └── order_payments_dataset.csv
└── README.md
- Clone the repository and navigate to the project directory:
cd cc-data-analysis- Install dependencies using uv:
uv syncStart the Streamlit dashboard:
uv run streamlit run app.pyThe dashboard will open in your default browser at http://localhost:8501.
To run the refactored analysis notebook:
uv run jupyter lab EDA_Refactored.ipynb- Title on the left
- Date filters on the right (apply globally to all visualizations):
- Year selector (defaults to 2023)
- Start Month selector
- End Month selector
Four metric cards displaying:
- Total Revenue: With year-over-year growth indicator
- Monthly Growth: Average month-over-month growth rate
- Average Order Value: With year-over-year growth indicator
- Total Orders: With year-over-year growth indicator
Trend indicators use green for positive trends and red for negative trends.
- Revenue Trend: Line chart comparing current year (solid) vs previous year (dashed)
- Top 10 Categories: Horizontal bar chart with blue gradient, sorted by revenue
- Revenue by State: US choropleth map with blue color scale
- Satisfaction vs Delivery Time: Bar chart showing average review score by delivery time bucket
- Average Delivery Time: Days with trend indicator (lower is better)
- Review Score: Large score display with star rating
Functions for data loading and preparation:
load_raw_datasets(data_dir): Load all CSV files from directoryprepare_sales_data(orders, order_items, status_filter): Create merged sales datasetfilter_by_date_range(df, start_year, start_month, end_year, end_month): Filter by date rangeprepare_sales_with_products(sales_data, products): Add product categoriesprepare_sales_with_customers(sales_data, orders, customers): Add customer geographyprepare_sales_with_reviews(sales_data, reviews): Add review scorescalculate_delivery_time(df): Calculate delivery days
Functions for calculating business metrics:
calculate_total_revenue(sales_data): Sum of pricescalculate_revenue_growth(current, previous): Percentage growthcalculate_monthly_revenue(sales_data): Revenue by monthcalculate_average_monthly_growth(sales_data): Average MoM growthcalculate_total_orders(sales_data): Unique order countcalculate_average_order_value(sales_data): AOV calculationcalculate_revenue_by_category(sales_data): Category breakdowncalculate_revenue_by_state(sales_data): Geographic breakdowncalculate_average_review_score(sales_data): Mean review scorecalculate_average_delivery_time(sales_data): Mean delivery dayscalculate_review_by_delivery_speed(sales_data): Reviews by delivery bucket
| Dataset | Column | Description |
|---|---|---|
| orders | order_id | Unique order identifier |
| orders | customer_id | Customer identifier |
| orders | order_status | Status (delivered, shipped, canceled, etc.) |
| orders | order_purchase_timestamp | Order date and time |
| orders | order_delivered_customer_date | Delivery date |
| order_items | order_item_id | Item sequence within order |
| order_items | product_id | Product identifier |
| order_items | price | Item price in USD |
| order_items | freight_value | Shipping cost |
| products | product_category_name | Product category |
| customers | customer_state | US state abbreviation |
| reviews | review_score | Rating from 1-5 |