# udayb97/retail-vendor-analytics architecture

> Architecture diagram of the GitHub repository udayb97/retail-vendor-analytics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/udayb97/retail-vendor-analytics
- Repository: https://github.com/udayb97/retail-vendor-analytics

## Overview

##### Project type and purpose
- This is a data-pipeline and analytics project (“Retail Vendor Performance Analysis”) that automates ingestion, transformation, summary computation and exploratory analysis of retail/vendor data.
- It is not a web-app but a scripted ETL + analysis workflow producing both Jupyter Notebook outputs and a Power BI dashboard.

##### File structure
- ingestion_db.py: Python script using SQLAlchemy to read raw CSV files, define tables and load data into SQLite.
- get_vendor_summary.py: Python script using pandas/SQL to compute vendor-level metrics and write summary tables or CSVs.
- *.ipynb (Exploratory Data Analysis.ipynb & Vendor Performance Analysis.ipynb): Jupyter notebooks for interactive validation, incremental EDA and charting.
- Vendor_Perforamance_Analysis.pbix: Power BI dashboard file connecting to the summary data.
- images/: holds static assets (e.g., dashboard snapshots).
- README.md: project overview, technologies and workflow.

##### Extract architecture insights from the README
- Data Collection & Structuring → ingestion_db.py + SQLite
- Summary Generation → get_vendor_summary.py (pandas + SQLAlchemy)
- EDA & Validation → Jupyter Notebooks
- Visualization → Power BI (.pbix) fed by processed summary tables
- Logging is enabled in scripts for traceability

##### Main components and interactions
a. Data Sources (raw CSV files)
b. Ingestion Layer
- “ingestion_db.py” process
- Ingestion Layer writes to “SQLite Database”
c. Data Storage
- “SQLite Relational Database”
d. Transformation Layer
- “get_vendor_summary.py”
- Outputs vendor_summary table (and/or CSV export)
e. Analysis & Validation
- Two Jupyter Notebooks
- Notebooks use pandas, SQLAlchemy, SQL
f. Reporting & Dashboard
- Power BI (.pbix)
g. Logging & Monitoring
- Logging component integrated in both ingestion and transformation scripts

##### Architectural patterns and design principles
- Clear separation of concerns: Ingestion, Transformation, Analysis, Visualization
- Modularity: discrete scripts for each stage
- Single source of truth: relational DB (SQLite)
- Reproducibility: scripted steps + notebooks
- Lightweight embedded database for easy distribution

##### Technologies & frameworks
- Python 3.x
- pandas (data manipulation)
- SQLAlchemy + SQL (DB interface + complex joins)
- SQLite (storage)
- Jupyter Notebook (interactive analysis)
- Power BI (dashboard)
- Logging module (traceability)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% ETL Layer
    subgraph "ETL"
        RawData["Raw CSV files\n(purchases.csv, sales.csv, prices.csv, freight.csv, etc.)"]:::data
        Ingestion["ingestion_db.py"]:::process
        SQLite["SQLite Database"]:::data
        Transform["get_vendor_summary.py"]:::process
        SummaryTable["Vendor Summary Tables/CSV"]:::data
    end

    %% Analytics Layer
    subgraph "Analytics"
        Notebook1["Exploratory Data Analysis.ipynb"]:::analytics
        Notebook2["Vendor Performance Analysis.ipynb"]:::analytics
    end

    %% Visualization Layer
    subgraph "Visualization"
        PowerBI["Vendor_Perforamance_Analysis.pbix"]:::reporting
        Images["images/"]:::reporting
    end

    %% Documentation
    subgraph "Documentation"
        README["README.md"]:::external
    end

    %% Logging
    Logging["Logging Module"]:::external

    %% Data Flows
    RawData -->|"SQLAlchemy INSERT"| Ingestion
    Ingestion -->|"writes tables"| SQLite
    SQLite -->|"read via pandas/SQLAlchemy"| Transform
    Transform -->|"writes summary"| SummaryTable

    SummaryTable -->|"pandas DataFrame"| Notebook1
    SQLite -->|"SQL read"| Notebook1

    SummaryTable -->|"pandas DataFrame"| Notebook2
    SQLite -->|"SQL read"| Notebook2

    SummaryTable -->|".pbix connection"| PowerBI
    Images -.->|"static assets"| README

    %% Logging Flows
    Ingestion -.->|"logs events"| Logging
    Transform -.->|"logs events"| Logging

    %% Click Events
    click Ingestion "https://github.com/udayb97/retail-vendor-analytics/blob/main/ingestion_db.py"
    click Transform "https://github.com/udayb97/retail-vendor-analytics/blob/main/get_vendor_summary.py"
    click Notebook1 "https://github.com/udayb97/retail-vendor-analytics/blob/main/Exploratory Data Analysis.ipynb"
    click Notebook2 "https://github.com/udayb97/retail-vendor-analytics/blob/main/Vendor Performance Analysis.ipynb"
    click PowerBI "https://github.com/udayb97/retail-vendor-analytics/blob/main/Vendor_Perforamance_Analysis.pbix"
    click Images "https://github.com/udayb97/retail-vendor-analytics/tree/main/images/"
    click README "https://github.com/udayb97/retail-vendor-analytics/blob/main/README.md"

    %% Styles
    classDef data fill:#D6EAF8,stroke:#21618C;
    classDef process fill:#D5F5E3,stroke:#27AE60;
    classDef analytics fill:#FCF3CF,stroke:#F1C40F;
    classDef reporting fill:#F5EEF8,stroke:#8E44AD;
    classDef external fill:#F2F3F4,stroke:#95A5A6;
```
