# srinjoyee1008/retail-bi-intelligence-platform architecture

> Architecture diagram of the GitHub repository srinjoyee1008/retail-bi-intelligence-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srinjoyee1008/retail-bi-intelligence-platform
- Repository: https://github.com/srinjoyee1008/retail-bi-intelligence-platform

## Overview

This is a local-first retail BI dashboard: a user opens the Streamlit app, which ensures demo data exists, computes retail metrics, and displays KPIs, trends, segmentation, inventory alerts, anomalies, forecasts, and recommendations. The implemented data path generates CSV-backed demo datasets when needed, loads them into a configurable SQLite or PostgreSQL database, and analytics reads those tables. The README also describes broader ingestion and deployment ambitions, but those are not evident as implemented subsystems in the supplied tree. Connections reflect the shown calls; broader README capabilities are not inferred.

Main entry points: [`Porject/app.py`](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/app.py) (Streamlit dashboard), [`Porject/src/analytics.py`](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py) (Frame preparation), [`Porject/src/db.py`](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/db.py) (Table access), [`Porject/retail_bi.db`](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/retail_bi.db) (Retail database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Streamlit dashboard<br/>[app.py]"]
end

subgraph group_analysis["Retail analytics"]
  node_kpis["KPI metrics<br/>[analytics.py]"]
  node_sales["Sales trends<br/>[analytics.py]"]
  node_category["Category breakdown<br/>[analytics.py]"]
  node_segments["Customer segments<br/>[analytics.py]"]
  node_inventory["Inventory alerts<br/>[analytics.py]"]
  node_forecast["Sales forecast<br/>[analytics.py]"]
  node_anomalies["Revenue anomalies<br/>[analytics.py]"]
  node_recommendations["Product recommendations<br/>[analytics.py]"]
  node_preparation["Frame preparation<br/>[analytics.py]"]
end

subgraph group_data["Demo data and storage"]
  node_db_access["Table access<br/>[db.py]"]
  node_generation["Demo data generation<br/>[data_generation.py]"]
  node_config["Database configuration<br/>[config.py]"]
  node_store[("Retail database<br/>[retail_bi.db]")]
end

node_user(("Dashboard user"))

node_user -->|"opens"| node_app
node_app -->|"ensures data"| node_db_access
node_app -->|"resets data"| node_db_access
node_app -->|"requests metrics"| node_kpis
node_app -->|"requests trend"| node_sales
node_app -->|"requests breakdown"| node_category
node_app -->|"requests segments"| node_segments
node_app -->|"requests alerts"| node_inventory
node_app -->|"requests forecast"| node_forecast
node_app -->|"requests anomalies"| node_anomalies
node_app -->|"requests recommendations"| node_recommendations
node_kpis -->|"prepares frames"| node_preparation
node_sales -->|"prepares frames"| node_preparation
node_category -->|"prepares frames"| node_preparation
node_segments -->|"prepares frames"| node_preparation
node_inventory -->|"prepares frames"| node_preparation
node_forecast -->|"uses trend"| node_sales
node_anomalies -->|"prepares frames"| node_preparation
node_recommendations -->|"prepares frames"| node_preparation
node_preparation -->|"loads tables"| node_db_access
node_db_access -->|"gets database URL"| node_config
node_db_access -->|"generates datasets"| node_generation
node_db_access -->|"loads and reads"| node_store
node_app -->|"previews tables"| node_store

click node_app "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/app.py"
click node_kpis "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_sales "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_category "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_segments "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_inventory "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_forecast "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_anomalies "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_recommendations "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_preparation "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py"
click node_db_access "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/db.py"
click node_generation "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/data_generation.py"
click node_config "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/config.py"
click node_store "https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/retail_bi.db"

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_app,node_user toneBlue
class node_kpis,node_sales,node_category,node_segments,node_inventory,node_forecast,node_anomalies,node_recommendations,node_preparation toneAmber
class node_db_access,node_generation,node_config,node_store toneMint
```

## Components

### Dashboard

- [Streamlit dashboard](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/app.py): `Porject/app.py`

### Retail analytics

- [KPI metrics](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Sales trends](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Category breakdown](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Customer segments](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Inventory alerts](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Sales forecast](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Revenue anomalies](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Product recommendations](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`
- [Frame preparation](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/analytics.py): `Porject/src/analytics.py`

### Demo data and storage

- [Table access](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/db.py): `Porject/src/db.py`
- [Demo data generation](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/data_generation.py): `Porject/src/data_generation.py`
- [Database configuration](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/src/config.py): `Porject/src/config.py`
- [Retail database](https://github.com/srinjoyee1008/retail-bi-intelligence-platform/blob/master/Porject/retail_bi.db): `Porject/retail_bi.db`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit dashboard: opens (evidence: `Porject/app.py`)
- Streamlit dashboard → Table access: ensures data (evidence: `Porject/app.py`)
- Streamlit dashboard → Table access: resets data (evidence: `Porject/app.py`)
- Streamlit dashboard → KPI metrics: requests metrics (evidence: `Porject/app.py`)
- Streamlit dashboard → Sales trends: requests trend (evidence: `Porject/app.py`)
- Streamlit dashboard → Category breakdown: requests breakdown (evidence: `Porject/app.py`)
- Streamlit dashboard → Customer segments: requests segments (evidence: `Porject/app.py`)
- Streamlit dashboard → Inventory alerts: requests alerts (evidence: `Porject/app.py`)
- Streamlit dashboard → Sales forecast: requests forecast (evidence: `Porject/app.py`)
- Streamlit dashboard → Revenue anomalies: requests anomalies (evidence: `Porject/app.py`)
- Streamlit dashboard → Product recommendations: requests recommendations (evidence: `Porject/app.py`)
- KPI metrics → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Sales trends → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Category breakdown → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Customer segments → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Inventory alerts → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Sales forecast → Sales trends: uses trend (evidence: `Porject/src/analytics.py`)
- Revenue anomalies → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Product recommendations → Frame preparation: prepares frames (evidence: `Porject/src/analytics.py`)
- Frame preparation → Table access: loads tables (evidence: `Porject/src/analytics.py`)
- Table access → Database configuration: gets database URL (evidence: `Porject/src/db.py`)
- Table access → Demo data generation: generates datasets (evidence: `Porject/src/db.py`)
- Table access → Retail database: loads and reads (evidence: `Porject/src/db.py`)
- Streamlit dashboard → Retail database: previews tables (evidence: `Porject/app.py`)
