# raghuvamshi-git/retailsense architecture

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

- Interactive diagram: https://gitdiagram.com/raghuvamshi-git/retailsense
- Repository: https://github.com/raghuvamshi-git/retailsense

## Overview

RetailSense AI+ is a retail analytics dashboard with a FastAPI backend. The visible live workflow is a user submitting forecast inputs from the Forecast page: the frontend client sends them to the forecast route, whose service predicts demand and saves the forecast. Inventory decisions follow a similar route-to-service flow and use the decision engine. Other dashboard areas and analytics modules cover pricing, promotions, anomalies, exploration, and modeling; several frontend views use explicitly labeled demo data. The README is empty, and unsampled module connections are omitted where source evidence does not establish them.

Main entry points: [`frontend/src/App.jsx`](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/App.jsx) (Dashboard shell), [`frontend/src/data/demoData.js`](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/data/demoData.js) (Demo datasets), [`frontend/src/api/client.js`](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/api/client.js) (HTTP API client), [`frontend/src/pages/ForecastPage.jsx`](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/ForecastPage.jsx) (Forecast page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard UI"]
  node_app["Dashboard shell<br/>[App.jsx]"]
  node_forecast_page["Forecast page<br/>[ForecastPage.jsx]"]
  node_inventory_page["Inventory page<br/>[InventoryPage.jsx]"]
  node_overview_page["Overview page<br/>[OverviewPage.jsx]"]
  node_pricing_page["Pricing page<br/>[PricingPage.jsx]"]
  node_promotions_page["Promotions page<br/>[PromotionsPage.jsx]"]
  node_anomaly_page["Anomaly page<br/>[AnomalyPage.jsx]"]
  node_explorer_page["Data explorer<br/>[ExplorerPage.jsx]"]
  node_sidebar["Navigation sidebar<br/>[Sidebar.jsx]"]
  node_topbar["Top bar<br/>[Topbar.jsx]"]
  node_kpi["KPI cards<br/>[KpiCard.jsx]"]
  node_ui_states["Loading and error states<br/>[States.jsx]"]
  node_demo_data["Demo datasets<br/>[demoData.js]"]
end

subgraph group_api["API runtime"]
  node_api_client["HTTP API client<br/>[client.js]"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_forecast_route["Forecast route<br/>[forecast.py]"]
  node_inventory_route["Inventory route<br/>[inventory.py]"]
  node_database[("Forecast database<br/>[connection.py]")]
end

subgraph group_domain["Decision services"]
  node_forecast_service["Forecast service"]
  node_inventory_service["Inventory service"]
  node_inventory_engine["Inventory decisions<br/>[inventory.py]"]
  node_inventory_recs["Inventory recommendations<br/>[recommendations.py]"]
end

subgraph group_analytics["Analytics modules"]
  node_forecast_models["Forecast models<br/>[xgboost_model.py]"]
  node_lightgbm["LightGBM model<br/>[lightgbm_model.py]"]
  node_lstm["LSTM model<br/>[lstm_model.py]"]
  node_evaluation["Forecast evaluation<br/>[evaluation.py]"]
  node_anomaly_detector["Anomaly detection<br/>[detector.py]"]
  node_explainability["SHAP explanations<br/>[shap_explainer.py]"]
  node_pricing["Pricing recommendations<br/>[recommendation.py]"]
  node_promotion["Promotion recommendations<br/>[recommendation.py]"]
  node_scenario["Scenario simulation<br/>[simulator.py]"]
end

subgraph group_data["Data and features"]
  node_data_loader["Data loading<br/>[data_loader.py]"]
  node_validation["Data validation<br/>[data_validation.py]"]
  node_feature_engineering["Feature engineering"]
end

node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_topbar
node_app -->|"renders"| node_overview_page
node_app -->|"renders"| node_forecast_page
node_app -->|"renders"| node_inventory_page
node_app -->|"renders"| node_pricing_page
node_app -->|"renders"| node_promotions_page
node_app -->|"renders"| node_anomaly_page
node_app -->|"renders"| node_explorer_page
node_overview_page -->|"renders"| node_kpi
node_overview_page -->|"reads"| node_demo_data
node_forecast_page -->|"submits forecast"| node_api_client
node_forecast_page -->|"renders"| node_ui_states
node_forecast_page -->|"reads"| node_demo_data
node_inventory_page -->|"submits inventory"| node_api_client
node_inventory_page -->|"renders"| node_ui_states
node_inventory_page -->|"reads"| node_demo_data
node_pricing_page -->|"reads"| node_demo_data
node_promotions_page -->|"reads"| node_demo_data
node_anomaly_page -->|"reads"| node_demo_data
node_explorer_page -->|"reads"| node_demo_data
node_topbar -->|"checks health"| node_api_client
node_api_client -->|"POSTs forecast"| node_forecast_route
node_api_client -->|"POSTs inventory"| node_inventory_route
node_api_app -->|"registers"| node_forecast_route
node_api_app -->|"registers"| node_inventory_route
node_forecast_route -->|"calls"| node_forecast_service
node_inventory_route -->|"calls"| node_inventory_service
node_forecast_service -->|"writes forecast"| node_database
node_inventory_service -->|"calculates decisions"| node_inventory_engine
node_inventory_service -->|"gets recommendation"| node_inventory_recs

click node_app "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/App.jsx"
click node_forecast_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/ForecastPage.jsx"
click node_inventory_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/InventoryPage.jsx"
click node_overview_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/OverviewPage.jsx"
click node_pricing_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/PricingPage.jsx"
click node_promotions_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/PromotionsPage.jsx"
click node_anomaly_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/AnomalyPage.jsx"
click node_explorer_page "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/ExplorerPage.jsx"
click node_sidebar "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/Sidebar.jsx"
click node_topbar "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/Topbar.jsx"
click node_kpi "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/KpiCard.jsx"
click node_ui_states "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/States.jsx"
click node_demo_data "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/data/demoData.js"
click node_api_client "https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/api/client.js"
click node_api_app "https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/main.py"
click node_forecast_route "https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/routes/forecast.py"
click node_inventory_route "https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/routes/inventory.py"
click node_forecast_service "https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/services/forecast_service.py"
click node_inventory_service "https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/services/inventory_service.py"
click node_inventory_engine "https://github.com/raghuvamshi-git/retailsense/blob/main/src/decision_engine/inventory.py"
click node_inventory_recs "https://github.com/raghuvamshi-git/retailsense/blob/main/src/decision_engine/recommendations.py"
click node_database "https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/database/connection.py"
click node_forecast_models "https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/xgboost_model.py"
click node_lightgbm "https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/lightgbm_model.py"
click node_lstm "https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/lstm_model.py"
click node_evaluation "https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/evaluation.py"
click node_anomaly_detector "https://github.com/raghuvamshi-git/retailsense/blob/main/src/anomaly_detection/detector.py"
click node_explainability "https://github.com/raghuvamshi-git/retailsense/blob/main/src/explainability/shap_explainer.py"
click node_pricing "https://github.com/raghuvamshi-git/retailsense/blob/main/src/pricing/recommendation.py"
click node_promotion "https://github.com/raghuvamshi-git/retailsense/blob/main/src/promotion/recommendation.py"
click node_scenario "https://github.com/raghuvamshi-git/retailsense/blob/main/src/scenario/simulator.py"
click node_data_loader "https://github.com/raghuvamshi-git/retailsense/blob/main/src/preprocessing/data_loader.py"
click node_validation "https://github.com/raghuvamshi-git/retailsense/blob/main/src/preprocessing/data_validation.py"
click node_feature_engineering "https://github.com/raghuvamshi-git/retailsense/blob/main/src/features/feature_engineering.py"

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_forecast_page,node_inventory_page,node_overview_page,node_pricing_page,node_promotions_page,node_anomaly_page,node_explorer_page,node_sidebar,node_topbar,node_kpi,node_ui_states,node_demo_data toneBlue
class node_api_client,node_api_app,node_forecast_route,node_inventory_route,node_database toneAmber
class node_forecast_service,node_inventory_service,node_inventory_engine,node_inventory_recs toneMint
class node_forecast_models,node_lightgbm,node_lstm,node_evaluation,node_anomaly_detector,node_explainability,node_pricing,node_promotion,node_scenario toneRose
class node_data_loader,node_validation,node_feature_engineering toneIndigo
```

## Components

### Dashboard UI

- [Dashboard shell](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Forecast page](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/ForecastPage.jsx): `frontend/src/pages/ForecastPage.jsx`
- [Inventory page](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/InventoryPage.jsx): `frontend/src/pages/InventoryPage.jsx`
- [Overview page](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/OverviewPage.jsx): `frontend/src/pages/OverviewPage.jsx`
- [Pricing page](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/PricingPage.jsx): `frontend/src/pages/PricingPage.jsx`
- [Promotions page](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/PromotionsPage.jsx): `frontend/src/pages/PromotionsPage.jsx`
- [Anomaly page](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/AnomalyPage.jsx): `frontend/src/pages/AnomalyPage.jsx`
- [Data explorer](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/pages/ExplorerPage.jsx): `frontend/src/pages/ExplorerPage.jsx`
- [Navigation sidebar](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [Top bar](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/Topbar.jsx): `frontend/src/components/Topbar.jsx`
- [KPI cards](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/KpiCard.jsx): `frontend/src/components/KpiCard.jsx`
- [Loading and error states](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/components/States.jsx): `frontend/src/components/States.jsx`
- [Demo datasets](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/data/demoData.js): `frontend/src/data/demoData.js`

### API runtime

- [HTTP API client](https://github.com/raghuvamshi-git/retailsense/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [FastAPI application](https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/main.py): `backend/app/main.py`
- [Forecast route](https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/routes/forecast.py): `backend/app/routes/forecast.py`
- [Inventory route](https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/routes/inventory.py): `backend/app/routes/inventory.py`
- [Forecast database](https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/database/connection.py): `backend/app/database/connection.py`

### Decision services

- [Forecast service](https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/services/forecast_service.py): `backend/app/services/forecast_service.py`
- [Inventory service](https://github.com/raghuvamshi-git/retailsense/blob/main/backend/app/services/inventory_service.py): `backend/app/services/inventory_service.py`
- [Inventory decisions](https://github.com/raghuvamshi-git/retailsense/blob/main/src/decision_engine/inventory.py): `src/decision_engine/inventory.py`
- [Inventory recommendations](https://github.com/raghuvamshi-git/retailsense/blob/main/src/decision_engine/recommendations.py): `src/decision_engine/recommendations.py`

### Analytics modules

- [Forecast models](https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/xgboost_model.py): `src/forecasting/xgboost_model.py`
- [LightGBM model](https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/lightgbm_model.py): `src/forecasting/lightgbm_model.py`
- [LSTM model](https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/lstm_model.py): `src/forecasting/lstm_model.py`
- [Forecast evaluation](https://github.com/raghuvamshi-git/retailsense/blob/main/src/forecasting/evaluation.py): `src/forecasting/evaluation.py`
- [Anomaly detection](https://github.com/raghuvamshi-git/retailsense/blob/main/src/anomaly_detection/detector.py): `src/anomaly_detection/detector.py`
- [SHAP explanations](https://github.com/raghuvamshi-git/retailsense/blob/main/src/explainability/shap_explainer.py): `src/explainability/shap_explainer.py`
- [Pricing recommendations](https://github.com/raghuvamshi-git/retailsense/blob/main/src/pricing/recommendation.py): `src/pricing/recommendation.py`
- [Promotion recommendations](https://github.com/raghuvamshi-git/retailsense/blob/main/src/promotion/recommendation.py): `src/promotion/recommendation.py`
- [Scenario simulation](https://github.com/raghuvamshi-git/retailsense/blob/main/src/scenario/simulator.py): `src/scenario/simulator.py`

### Data and features

- [Data loading](https://github.com/raghuvamshi-git/retailsense/blob/main/src/preprocessing/data_loader.py): `src/preprocessing/data_loader.py`
- [Data validation](https://github.com/raghuvamshi-git/retailsense/blob/main/src/preprocessing/data_validation.py): `src/preprocessing/data_validation.py`
- [Feature engineering](https://github.com/raghuvamshi-git/retailsense/blob/main/src/features/feature_engineering.py): `src/features/feature_engineering.py`

## Connections

- Dashboard shell → Navigation sidebar: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Top bar: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Overview page: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Forecast page: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Inventory page: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Pricing page: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Promotions page: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Anomaly page: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Data explorer: renders (evidence: `frontend/src/App.jsx`)
- Overview page → KPI cards: renders (evidence: `frontend/src/pages/OverviewPage.jsx`)
- Overview page → Demo datasets: reads (evidence: `frontend/src/pages/OverviewPage.jsx`)
- Forecast page → HTTP API client: submits forecast (evidence: `frontend/src/pages/ForecastPage.jsx`)
- Forecast page → Loading and error states: renders (evidence: `frontend/src/pages/ForecastPage.jsx`)
- Forecast page → Demo datasets: reads (evidence: `frontend/src/pages/ForecastPage.jsx`)
- Inventory page → HTTP API client: submits inventory (evidence: `frontend/src/pages/InventoryPage.jsx`)
- Inventory page → Loading and error states: renders (evidence: `frontend/src/pages/InventoryPage.jsx`)
- Inventory page → Demo datasets: reads (evidence: `frontend/src/pages/InventoryPage.jsx`)
- Pricing page → Demo datasets: reads (evidence: `frontend/src/pages/PricingPage.jsx`)
- Promotions page → Demo datasets: reads (evidence: `frontend/src/pages/PromotionsPage.jsx`)
- Anomaly page → Demo datasets: reads (evidence: `frontend/src/pages/AnomalyPage.jsx`)
- Data explorer → Demo datasets: reads (evidence: `frontend/src/pages/ExplorerPage.jsx`)
- Top bar → HTTP API client: checks health (evidence: `frontend/src/components/Topbar.jsx`)
- HTTP API client → Forecast route: POSTs forecast (evidence: `frontend/src/api/client.js`)
- HTTP API client → Inventory route: POSTs inventory (evidence: `frontend/src/api/client.js`)
- FastAPI application → Forecast route: registers (evidence: `backend/app/main.py`)
- FastAPI application → Inventory route: registers (evidence: `backend/app/main.py`)
- Forecast route → Forecast service: calls (evidence: `backend/app/routes/forecast.py`)
- Inventory route → Inventory service: calls (evidence: `backend/app/routes/inventory.py`)
- Forecast service → Forecast database: writes forecast (evidence: `backend/app/services/forecast_service.py`)
- Inventory service → Inventory decisions: calculates decisions (evidence: `backend/app/services/inventory_service.py`)
- Inventory service → Inventory recommendations: gets recommendation (evidence: `backend/app/services/inventory_service.py`)
