# praveen0095/ecommerce-retention-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/praveen0095/ecommerce-retention-analysis
- Repository: https://github.com/praveen0095/ecommerce-retention-analysis

## Overview

This repository describes an e-commerce retention analytics pipeline: raw transaction data is cleaned and feature-engineered with PySpark, staged in cloud storage and Snowflake, modeled with dbt, and consumed in Power BI for retention insights. The graph preserves the documented staging and mart layers and the repository’s named SQL analyses. Most SQL and dbt model contents were not provided, so their internal behavior and relationships beyond the README’s documented flow are not inferred.

Main entry points: [`scripts/pyspark_data_trans.py`](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/scripts/pyspark_data_trans.py) (PySpark Cleaning), [`dbt/models/staging`](https://github.com/praveen0095/ecommerce-retention-analysis/tree/main/dbt/models/staging) (dbt Staging Models), [`dbt/models/marts/customer_retention.sql`](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/marts/customer_retention.sql) (Retention Mart), [`Snowflake/warehouse_setup.sql`](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/warehouse_setup.sql) (Warehouse Setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processing["Data Processing"]
  node_pyspark["PySpark Cleaning"]
  node_s3[("Parquet Data Lake")]
end

subgraph group_warehouse["Warehouse and Modeling"]
  node_snowflake[("Snowflake Warehouse")]
  node_warehouse_setup["Warehouse Setup"]
  node_dbt_staging["dbt Staging Models"]
  node_stg_churn["Churn Staging"]
  node_stg_cohort["Cohort Staging<br/>[stg_cohort_24M.sql]"]
  node_stg_customer["Customer Staging"]
  node_stg_rfm["RFM Staging"]
  node_retention_mart["Retention Mart"]
end

subgraph group_analytics["Retention Analytics"]
  node_churn_analysis["Churn Analysis<br/>[churn_analysis.sql]"]
  node_cohort_analysis["24-Month Cohort Analysis<br/>[cohort_24M.sql]"]
  node_segment_analysis["Customer Segmentation"]
  node_rfm_analysis["RFM Analysis<br/>[rfm_analysis.sql]"]
end

subgraph group_consumption["Insights and Reporting"]
  node_power_bi["Power BI Dashboards"]
  node_business_insights(("Retention Decisions"))
end

node_raw_data["Raw CSV Data"]

node_raw_data -->|"ingests"| node_pyspark
node_pyspark -->|"writes Parquet"| node_s3
node_s3 -->|"loads Parquet"| node_snowflake
node_warehouse_setup -->|"configures loading"| node_snowflake
node_snowflake -->|"provides source data"| node_dbt_staging
node_dbt_staging -->|"models marts"| node_retention_mart
node_retention_mart -->|"feeds dashboards"| node_power_bi
node_power_bi -->|"supports decisions"| node_business_insights

click node_pyspark "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/scripts/pyspark_data_trans.py"
click node_warehouse_setup "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/warehouse_setup.sql"
click node_dbt_staging "https://github.com/praveen0095/ecommerce-retention-analysis/tree/main/dbt/models/staging"
click node_stg_churn "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_churn_segment.sql"
click node_stg_cohort "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_cohort_24M.sql"
click node_stg_customer "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_customer_seg.sql"
click node_stg_rfm "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_rfm_analysis.sql"
click node_retention_mart "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/marts/customer_retention.sql"
click node_churn_analysis "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/churn_analysis.sql"
click node_cohort_analysis "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/cohort_24M.sql"
click node_segment_analysis "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/customer_segment.sql"
click node_rfm_analysis "https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/rfm_analysis.sql"

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_pyspark,node_s3 toneBlue
class node_snowflake,node_warehouse_setup,node_dbt_staging,node_stg_churn,node_stg_cohort,node_stg_customer,node_stg_rfm,node_retention_mart toneAmber
class node_churn_analysis,node_cohort_analysis,node_segment_analysis,node_rfm_analysis toneMint
class node_power_bi,node_business_insights toneRose
class node_raw_data toneIndigo
```

## Components

### Data Processing

- [PySpark Cleaning](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/scripts/pyspark_data_trans.py): `scripts/pyspark_data_trans.py`
- **Parquet Data Lake**

### Warehouse and Modeling

- **Snowflake Warehouse**
- [Warehouse Setup](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/warehouse_setup.sql): `Snowflake/warehouse_setup.sql`
- [dbt Staging Models](https://github.com/praveen0095/ecommerce-retention-analysis/tree/main/dbt/models/staging): `dbt/models/staging`
- [Churn Staging](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_churn_segment.sql): `dbt/models/staging/stg_churn_segment.sql`
- [Cohort Staging](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_cohort_24M.sql): `dbt/models/staging/stg_cohort_24M.sql`
- [Customer Staging](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_customer_seg.sql): `dbt/models/staging/stg_customer_seg.sql`
- [RFM Staging](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/staging/stg_rfm_analysis.sql): `dbt/models/staging/stg_rfm_analysis.sql`
- [Retention Mart](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/dbt/models/marts/customer_retention.sql): `dbt/models/marts/customer_retention.sql`

### Retention Analytics

- [Churn Analysis](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/churn_analysis.sql): `Snowflake/analysis/churn_analysis.sql`
- [24-Month Cohort Analysis](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/cohort_24M.sql): `Snowflake/analysis/cohort_24M.sql`
- [Customer Segmentation](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/customer_segment.sql): `Snowflake/analysis/customer_segment.sql`
- [RFM Analysis](https://github.com/praveen0095/ecommerce-retention-analysis/blob/main/Snowflake/analysis/rfm_analysis.sql): `Snowflake/analysis/rfm_analysis.sql`

### Insights and Reporting

- **Power BI Dashboards**
- **Retention Decisions**

### Other components

- **Raw CSV Data**

## Connections

- Raw CSV Data → PySpark Cleaning: ingests (evidence: `README.md`)
- PySpark Cleaning → Parquet Data Lake: writes Parquet (evidence: `README.md`)
- Parquet Data Lake → Snowflake Warehouse: loads Parquet (evidence: `README.md`)
- Warehouse Setup → Snowflake Warehouse: configures loading (evidence: `README.md`)
- Snowflake Warehouse → dbt Staging Models: provides source data (evidence: `README.md`)
- dbt Staging Models → Retention Mart: models marts (evidence: `README.md`)
- Retention Mart → Power BI Dashboards: feeds dashboards (evidence: `README.md`)
- Power BI Dashboards → Retention Decisions: supports decisions (evidence: `README.md`)
