# imbasito/rfm-customer-segmentation architecture

> Architecture diagram of the GitHub repository imbasito/rfm-customer-segmentation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/imbasito/rfm-customer-segmentation
- Repository: https://github.com/imbasito/rfm-customer-segmentation

## Overview

This repository documents a SQL-based customer analytics workflow for UK e-commerce transactions, ending in an interactive Power BI dashboard. The documented path runs from transaction data through cleaning and RFM feature engineering, scoring, and segmentation; separate SQL work covers exploration, KPIs, and business scenarios. The README describes the dashboard's customer overview, segmentation, and drillthrough views. No source excerpts were provided, so relationships below rely on the README's process description; script-to-stage assignments use the filenames.

Main entry points: [`Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix`](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix) (Interactive Dashboard), [`edata_cleaned.csv`](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/edata_cleaned.csv) (Cleaned Data), [`sql/Lab2_Data_Cleaning_Preparation.sql`](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab2_Data_Cleaning_Preparation.sql) (Data Cleaning), [`sql/Lab5_Behavioral_Segmentation(RFM Analysis).sql`](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql) (RFM Metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["SQL Analysis"]
  node_exploration["Data Exploration"]
  node_cleaning["Data Cleaning"]
  node_cleaned["Cleaned Data<br/>[edata_cleaned.csv]"]
  node_kpis["Business KPIs"]
  node_scenarios["Business Scenarios"]
end

subgraph group_rfm["RFM Segmentation"]
  node_rfm_metrics["RFM Metrics"]
  node_rfm_scoring["RFM Scoring"]
  node_segments["Customer Segments"]
end

subgraph group_reporting["Power BI Reporting"]
  node_dashboard["Interactive Dashboard"]
  node_customer_overview["Customer Overview"]
  node_segment_view["RFM Dashboard"]
  node_drillthrough["Customer Drillthrough"]
end

node_analyst(("Analyst"))
node_transactions["Transaction Data<br/>[sample-data.csv]"]

node_analyst -->|"imports"| node_transactions
node_transactions -->|"cleans"| node_cleaning
node_cleaning -->|"produces"| node_cleaned
node_cleaned -->|"engineers features"| node_rfm_metrics
node_rfm_metrics -->|"scores metrics"| node_rfm_scoring
node_rfm_scoring -->|"assigns segments"| node_segments
node_cleaned -->|"imports output"| node_dashboard
node_dashboard -->|"shows"| node_customer_overview
node_dashboard -->|"shows"| node_segment_view
node_dashboard -->|"supports"| node_drillthrough
node_analyst -.->|"explores data"| node_exploration
node_analyst -.->|"calculates KPIs"| node_kpis
node_analyst -.->|"evaluates cases"| node_scenarios

click node_transactions "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sample%20data/sample-data.csv"
click node_exploration "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab1_Exploration.sql"
click node_cleaning "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab2_Data_Cleaning_Preparation.sql"
click node_cleaned "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/edata_cleaned.csv"
click node_kpis "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab3_SQL%20Business%20KPIs.sql"
click node_scenarios "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab4_Business_case_scenarios.sql"
click node_rfm_metrics "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql"
click node_rfm_scoring "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql"
click node_segments "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql"
click node_dashboard "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix"
click node_customer_overview "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix"
click node_segment_view "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix"
click node_drillthrough "https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_exploration,node_cleaning,node_cleaned,node_kpis,node_scenarios toneBlue
class node_rfm_metrics,node_rfm_scoring,node_segments toneAmber
class node_dashboard,node_customer_overview,node_segment_view,node_drillthrough toneMint
class node_analyst toneIndigo
class node_transactions toneTeal
```

## Components

### SQL Analysis

- [Data Exploration](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab1_Exploration.sql): `sql/Lab1_Exploration.sql`
- [Data Cleaning](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab2_Data_Cleaning_Preparation.sql): `sql/Lab2_Data_Cleaning_Preparation.sql`
- [Cleaned Data](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/edata_cleaned.csv): `edata_cleaned.csv`
- [Business KPIs](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab3_SQL%20Business%20KPIs.sql): `sql/Lab3_SQL Business KPIs.sql`
- [Business Scenarios](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab4_Business_case_scenarios.sql): `sql/Lab4_Business_case_scenarios.sql`

### RFM Segmentation

- [RFM Metrics](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql): `sql/Lab5_Behavioral_Segmentation(RFM Analysis).sql`
- [RFM Scoring](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql): `sql/Lab5_Behavioral_Segmentation(RFM Analysis).sql`
- [Customer Segments](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sql/Lab5_Behavioral_Segmentation(RFM%20Analysis).sql): `sql/Lab5_Behavioral_Segmentation(RFM Analysis).sql`

### Power BI Reporting

- [Interactive Dashboard](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix): `Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix`
- [Customer Overview](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix): `Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix`
- [RFM Dashboard](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix): `Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix`
- [Customer Drillthrough](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix): `Dashboards/Ecommerce_Transactions_UK_Dashboard.pbix`

### Other components

- **Analyst**
- [Transaction Data](https://github.com/imbasito/rfm-customer-segmentation/blob/basito/sample%20data/sample-data.csv): `sample data/sample-data.csv`

## Connections

- Analyst → Transaction Data: imports (evidence: `README.md`)
- Transaction Data → Data Cleaning: cleans (evidence: `README.md`)
- Data Cleaning → Cleaned Data: produces (evidence: `README.md`)
- Cleaned Data → RFM Metrics: engineers features (evidence: `README.md`)
- RFM Metrics → RFM Scoring: scores metrics (evidence: `README.md`)
- RFM Scoring → Customer Segments: assigns segments (evidence: `README.md`)
- Cleaned Data → Interactive Dashboard: imports output (evidence: `README.md`)
- Interactive Dashboard → Customer Overview: shows (evidence: `README.md`)
- Interactive Dashboard → RFM Dashboard: shows (evidence: `README.md`)
- Interactive Dashboard → Customer Drillthrough: supports (evidence: `README.md`)
- Analyst → Data Exploration: explores data
- Analyst → Business KPIs: calculates KPIs
- Analyst → Business Scenarios: evaluates cases
