# tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation architecture

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

- Interactive diagram: https://gitdiagram.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation
- Repository: https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation

## Overview

##### Project Type and Purpose
- This is a data-analytics & visualization project built in Python, centered on:
- Ingesting raw CSV data (transactions, customers, products)
- Performing EDA, feature engineering, clustering, lookalike modeling
- Exposing results via a Streamlit dashboard
- Key goal: generate business-actionable insights and customer recommendations.

##### File Structure
- Top level:
- datasets/ – raw CSV inputs + derived customer_data.csv
- notebooks/ – Jupyter notebooks for EDA, Clustering, Lookalike
- app/ – Streamlit dashboard (streamlit_main.py + requirements.txt)
- Reports/ – exported artifacts (Lookalike.csv)
- .devcontainer/ – container config for reproducible environment
- Patterns: clear separation of data layer (datasets), processing/modeling layer (notebooks), presentation layer (app).

##### Extract Architecture Insights from README
- Data ingestion → cleaning → feature engineering yields an intermediate “customer_data.csv.”
- Clustering notebook builds RFM + PCA + K-means pipeline.
- Lookalike notebook computes cosine similarities → exports recommendations CSV.
- Streamlit app imports all artifacts, renders interactive visualizations (radar, treemap, 3D scatter) and tables.

##### Main Components & Their Interactions
a. Data Layer
- Raw Data Files (datasets/Customers.csv, Products.csv, Transactions.csv)
- Derived Data (datasets/customer_data.csv)
b. Processing Layer (Notebooks)
- EDA Notebook: merges raw files → cleans → feature engineering → writes customer_data.csv
- Clustering Notebook: reads customer_data.csv → PCA + K-means → outputs cluster assignments (in memory or as file)
- Lookalike Notebook: reads customer_data.csv (and clusters if needed) → cosine similarity → writes Reports/Lookalike.csv
c. Presentation Layer
- Streamlit App (app/streamlit_main.py)
- Reads datasets/customer_data.csv, cluster outputs, lookalike CSV
- Generates interactive visualizations with Plotly & Streamlit UI
d. Environment & Deployment
- .devcontainer/devcontainer.json for VSCode containerization
- requirements.txt listing Python dependencies

##### Architectural Patterns & Principles
- Modular pipeline: each notebook is a self-contained data-processing stage
- Clear separation: data → processing → modeling → presentation
- File-based artifacts as integration points between stages
- Reproducible dev environment via devcontainer

##### Essential Details to Capture
- File paths/folders as component names
- Data flows between notebooks and artifacts
- Tech stack per component (Python 3.x, Pandas, Scikit-learn, Plotly, Streamlit)
- Reproducibility layer (.devcontainer)
- Output artifact storage (Reports/)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Dev Container"
        DEV[".devcontainer/devcontainer.json"]:::env
        subgraph "Data Sources"
            RAW_CUST["Customers.csv"]:::data
            RAW_PROD["Products.csv"]:::data
            RAW_TX["Transactions.csv"]:::data
        end
        EDA["EDA.ipynb"]:::process
        DERIVED[(customer_data.csv)]:::store
        CLUSTER["Clustering.ipynb"]:::process
        LOOK_PROC["Lookalike.ipynb"]:::process
        LOOK_OUT["Lookalike.csv"]:::output
        subgraph "Presentation Layer"
            STREAM["streamlit_main.py"]:::presentation
            REQ["requirements.txt"]:::presentation
        end
    end
    README["README.md"]:::doc

    RAW_CUST -->|ingest| EDA
    RAW_PROD -->|ingest| EDA
    RAW_TX -->|ingest| EDA
    EDA -->|writes| DERIVED
    DERIVED -->|reads| CLUSTER
    DERIVED -->|reads| LOOK_PROC
    LOOK_PROC -->|writes| LOOK_OUT
    DERIVED -->|reads| STREAM
    CLUSTER -->|provides clusters| STREAM
    LOOK_OUT -->|provides recommendations| STREAM

    click RAW_CUST "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/datasets/Customers.csv"
    click RAW_PROD "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/datasets/Products.csv"
    click RAW_TX "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/datasets/Transactions.csv"
    click DERIVED "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/datasets/customer_data.csv"
    click EDA "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/notebooks/EDA.ipynb"
    click CLUSTER "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/notebooks/Clustering.ipynb"
    click LOOK_PROC "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/notebooks/Lookalike.ipynb"
    click LOOK_OUT "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/Reports/Lookalike.csv"
    click STREAM "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/app/streamlit_main.py"
    click REQ "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/app/requirements.txt"
    click DEV "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/.devcontainer/devcontainer.json"
    click README "https://github.com/tejasshinkar12/ecommerce-transactions-analysis-and-customer-segmentation/blob/main/README.md"

    classDef data fill:#cce5ff,stroke:#0062cc,color:#004085
    classDef process fill:#d4edda,stroke:#155724,color:#155724
    classDef store fill:#e2e3e5,stroke:#6c757d,color:#383d41
    classDef output fill:#fff3cd,stroke:#856404,color:#856404
    classDef presentation fill:#f5c6cb,stroke:#721c24,color:#721c24
    classDef env fill:#f8f9fa,stroke:#343a40,color:#343a40
    classDef doc fill:#d1ecf1,stroke:#0c5460,color:#0c5460
```
