Skip to content

Commit 6789e01

Browse files
committed
Update README for the redesigned executive dashboard
- Replace the two-bullet dashboard section with what the report actually does: KPI cards, the nine visuals, browser-side cross-filtering, themes, CSV export, and the design decisions behind it - Correct the project structure to match the repo (generator/, spark/, dashboards/assets/, docs/, data/raw|silver|gold) - List the metrics the Gold layer actually surfaces - Add a Docker-free path for running the pipeline end to end - Fix the Python badge: the project targets 3.9, not 3.11
1 parent 9444b7d commit 6789e01

1 file changed

Lines changed: 95 additions & 30 deletions

File tree

‎README.md‎

Lines changed: 95 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🚀 RetailFlow: Enterprise Data Engineering Platform
22

3-
![Python](https://img.shields.io/badge/Python-3.11-blue?logo=python)
3+
![Python](https://img.shields.io/badge/Python-3.9-blue?logo=python)
44
![Apache Spark](https://img.shields.io/badge/Apache%20Spark-PySpark-orange?logo=apachespark)
55
![Apache Airflow](https://img.shields.io/badge/Apache%20Airflow-Orchestration-017CEE?logo=apacheairflow)
66
![Docker](https://img.shields.io/badge/Docker-Containerized-2496ED?logo=docker)
@@ -89,7 +89,7 @@ This project demonstrates many of the technologies and engineering practices use
8989
| Containerization | Docker & Docker Compose |
9090
| CI/CD | GitHub Actions |
9191
| Testing | Pytest |
92-
| Dashboard | Plotly |
92+
| Dashboard | Plotly.js, embedded in a self-contained HTML page |
9393
| Version Control | Git & GitHub |
9494

9595
---
@@ -102,7 +102,8 @@ This project demonstrates many of the technologies and engineering practices use
102102
- Clean and standardize data with PySpark
103103
- Bronze → Silver → Gold Medallion Architecture
104104
- Star Schema Data Warehouse
105-
- Executive Plotly Dashboard
105+
- Executive dashboard with browser-side cross-filtering across 8 dimensions
106+
- Self-contained, offline-capable HTML report (light and dark themes)
106107
- Automated Apache Airflow Pipeline
107108
- Dockerized Deployment
108109
- Automated Data Quality Testing
@@ -113,32 +114,44 @@ This project demonstrates many of the technologies and engineering practices use
113114
# 📂 Project Structure
114115

115116
```text
116-
RetailFlow/
117+
Retail-Data-Engineering-Pipeline/
117118
│
118-
├── airflow/
119-
│ ├── dags/
120-
│ ├── plugins/
119+
├── generator/ # Faker-based synthetic data generator
120+
│ ├── run.py # entry point (--scale controls volume)
121+
│ ├── config.yaml # output paths and formats
122+
│ ├── customers.py · products.py · orders.py
123+
│ └── dirty_data.py # injects the realistic quality issues
121124
│
122-
├── data/
123-
│ ├── bronze/
124-
│ ├── silver/
125-
│ ├── gold/
126-
│
127-
├── generators/
128-
│
129-
├── transformations/
125+
├── spark/
126+
│ ├── bronze_to_silver.py # cleaning and standardisation
127+
│ ├── silver_to_gold.py # star schema build
128+
│ ├── gold_analytics.py # Gold → dashboard payload
129+
│ └── dashboard_builder.py # HTML assembly and column encoding
130130
│
131131
├── dashboards/
132+
│ ├── executive_dashboard.html # generated report
133+
│ └── assets/
134+
│ ├── app.css # design tokens, cards, filter bar
135+
│ └── app.js # client-side aggregation and charts
132136
│
133-
├── tests/
137+
├── docs/
138+
│ └── index.html # GitHub Pages copy of the dashboard
134139
│
135-
├── docker/
140+
├── data/
141+
│ ├── raw/ # Bronze
142+
│ ├── silver/
143+
│ └── gold/ # fact_sales + dim_customer/product/date
136144
│
137-
├── .github/
145+
├── airflow/dags/
146+
│ └── retail_pipeline_dag.py
138147
│
139-
├── requirements.txt
148+
├── tests/
149+
│ └── test_gold_data.py
140150
│
141-
└── docker-compose.yml
151+
├── .github/workflows/ci.yml
152+
├── docker-compose.yml
153+
├── Dockerfile
154+
└── requirements.txt
142155
```
143156

144157
---
@@ -202,10 +215,13 @@ The Gold Layer builds an analytical Star Schema consisting of:
202215
- DimProduct
203216
- DimDate
204217

205-
Business metrics include:
218+
Business metrics surfaced from this layer:
206219

207-
- Revenue
208-
- Order Status Distribution
220+
- Revenue, cost and gross profit per order line
221+
- Average order value and average profit margin
222+
- Order counts by fulfilment status and payment method
223+
- Revenue by brand, category, city and customer demographic
224+
- Monthly revenue, profit, quantity and order-volume trends
209225

210226
---
211227

@@ -224,18 +240,53 @@ These techniques improve scalability and execution performance.
224240

225241
---
226242

227-
# 📊 Dashboard
243+
# 📊 Executive Dashboard
244+
245+
The Gold layer feeds a single **self-contained HTML report** — no server, no build step, no external requests. Open the file and it works offline.
246+
247+
**[View the live dashboard →](https://chidex-coder.github.io/Retail-Data-Engineering-Pipeline/)**
248+
249+
### What's on it
250+
251+
**8 KPI cards** — Revenue, Gross Profit, Orders, Customers, Products Sold, Avg Order Value, Avg Profit Margin, Cities Served.
252+
253+
**9 visuals**, in three rows:
254+
255+
| Row | Visuals |
256+
|-----|---------|
257+
| 1 | Revenue Trend · Top Products by Brand · Revenue by Category |
258+
| 2 | Revenue by City · Revenue by Gender · Payment Methods |
259+
| 3 | Order Status · Top Customers · Monthly Orders |
228260

229-
The executive dashboard provides interactive business insights including:
261+
### Interactivity
230262

231-
- Revenue
232-
- Order Status Distribution
263+
Every filter re-aggregates the **entire fact table in the browser**. The Gold rows are dictionary-encoded into base64 typed arrays and embedded in the page, so one filter change recomputes all eight KPIs and all nine charts in roughly **70 ms** — no server round trip, no pre-baked trace toggling.
233264

234-
Dashboard is built using **Plotly**.
265+
- **Filters** — Year, Month, Category, Brand, Payment Method, Gender, Order Status, plus a type-ahead City search
266+
- **Metric switch** — Revenue / Profit / Quantity, repainting every value-based chart and rewriting its title
267+
- **Themes** — light and dark, each a separately chosen palette rather than an inverted one
268+
- **Export** — the current selection downloads as CSV; Plotly's PNG export is kept, its logo and lasso/box-select tools removed
235269

236-
### Live Dashboard
270+
### Design decisions
237271

238-
https://chidex-coder.github.io/Retail-Data-Engineering-Pipeline/
272+
- **Bars, not pies.** Length is easier to compare than angle, so payment methods and order status are horizontal bars rather than donuts.
273+
- **Colour encodes the measure**, not decoration — Revenue green, Profit blue, Quantity orange, order counts purple. Every colour was checked for contrast against its surface and for colour-vision separation.
274+
- **Order Status uses a reserved status palette** (Delivered green through Cancelled red) with values always labelled, so colour never carries meaning on its own.
275+
- **No legends.** Each chart shows one series at a time and the metric switch says which.
276+
- **Real date axes.** Trend charts plot actual dates, so `Jan 2024` reads as a month instead of the integer `202401`.
277+
- **Left joins, not filters.** An order line with an unresolved brand or payment method still counts toward revenue and only drops out of that one breakdown — dropping those rows outright would silently delete a fifth of the revenue. The unresolved counts are printed in the dashboard footer.
278+
279+
### Data standardisation
280+
281+
`spark/gold_analytics.py` normalises dimension attributes before they reach a chart: HTML fragments (`<b>Sony</b>`) and emoji (`IKEA📱💻`) are stripped, and placeholder values (`NULL`, `Unknown`, `-`, `N/A`) become genuine nulls instead of showing up as categories.
282+
283+
### Generating it
284+
285+
```bash
286+
python spark/gold_analytics.py
287+
```
288+
289+
Writes `dashboards/executive_dashboard.html` and `docs/index.html` (the GitHub Pages copy). The Airflow DAG runs this as its `run_analytics` task.
239290

240291
---
241292

@@ -334,6 +385,20 @@ source venv/bin/activate
334385
pip install -r requirements.txt
335386
```
336387

388+
## Run the Pipeline Directly
389+
390+
Runs the whole pipeline without Docker (requires a JRE for PySpark):
391+
392+
```bash
393+
python generator/run.py --scale 0.01
394+
python spark/bronze_to_silver.py
395+
python spark/silver_to_gold.py
396+
python spark/gold_analytics.py
397+
python -m pytest tests/ -v
398+
```
399+
400+
Then open `dashboards/executive_dashboard.html` in a browser.
401+
337402
## Start Airflow
338403

339404
```bash

0 commit comments

Comments
 (0)