# avi03-dev-oi/prisight architecture

> Architecture diagram of the GitHub repository avi03-dev-oi/prisight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avi03-dev-oi/prisight
- Repository: https://github.com/avi03-dev-oi/prisight

## Overview

Prisight is a full-stack revenue-intelligence platform: users manage products and sales/market data, then use forecasts, pricing, inventory, promotion, and explanatory insights to guide decisions. A React application calls a FastAPI backend whose routers expose those capabilities; the README documents forecasting and model evaluation, while sampled code confirms feature generation, NLP explanations, and admin evaluation/tuning. The excerpts do not show most router-to-service wiring, so those links are omitted rather than inferred. The SQLite/SQLAlchemy database and model family are documented; individual unsampled service interactions are not asserted.

Main entry points: [`Backend/app/main.py`](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/main.py) (API entrypoint), [`frontend/src/App.jsx`](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/App.jsx) (App routes), [`frontend/src/services/api.js`](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/services/api.js) (API client), [`Backend/app/Services/Feature_engineering_service.py`](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/Feature_engineering_service.py) (Feature engineering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React application"]
  node_app["App routes<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_pricing_page["Pricing page<br/>[Pricing.jsx]"]
  node_inventory_page["Inventory page<br/>[Inventory.jsx]"]
  node_promotions_page["Promotions page<br/>[Promotions.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_admin_ui["Admin console"]
  node_admin_api["Admin API client<br/>[adminApi.js]"]
end

subgraph group_api["FastAPI API"]
  node_backend["API entrypoint<br/>[main.py]"]
  node_products["Product routes<br/>[Product_router.py]"]
  node_sales["Sales routes<br/>[Sales_router.py]"]
  node_market["Market routes<br/>[market_router.py]"]
  node_forecast["Forecast routes<br/>[forecast_router.py]"]
  node_lstm["LSTM routes<br/>[lstm_router.py]"]
  node_pricing["Pricing routes<br/>[pricing_router.py]"]
  node_inventory["Inventory routes"]
  node_promotions["Promotion routes"]
  node_features["Feature routes<br/>[feature_router.py]"]
  node_nlp_routes["Insight routes<br/>[nlp_router.py]"]
  node_evaluation["Evaluation routes"]
end

subgraph group_intelligence["Business intelligence"]
  node_market_service["Market service<br/>[Market_services.py]"]
  node_feature_service["Feature engineering"]
  node_nlp_service["Insight generation"]
end

subgraph group_admin["Model operations"]
  node_admin_routes["Admin evaluation API"]
  node_tuning_routes["Tuning API<br/>[tuning_router.py]"]
  node_admin_service["Evaluation service"]
  node_tuning_service["Tuning jobs<br/>[tuning_service.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("Async database<br/>[database.py]")]
  node_models["Domain models"]
  node_admin_models["Evaluation records"]
end

node_business_user(("Business user"))

node_business_user -->|"navigates"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_pricing_page
node_app -->|"routes to"| node_inventory_page
node_app -->|"routes to"| node_promotions_page
node_dashboard -->|"requests data"| node_api_client
node_pricing_page -->|"requests data"| node_api_client
node_inventory_page -->|"requests data"| node_api_client
node_promotions_page -->|"requests data"| node_api_client
node_api_client -->|"HTTP requests"| node_backend
node_backend -->|"dispatches"| node_products
node_backend -->|"dispatches"| node_sales
node_backend -->|"dispatches"| node_market
node_backend -->|"dispatches"| node_forecast
node_backend -->|"dispatches"| node_lstm
node_backend -->|"dispatches"| node_pricing
node_backend -->|"dispatches"| node_inventory
node_backend -->|"dispatches"| node_promotions
node_backend -->|"dispatches"| node_features
node_backend -->|"dispatches"| node_nlp_routes
node_backend -->|"dispatches"| node_evaluation
node_market -->|"calls"| node_market_service
node_features -->|"calls"| node_feature_service
node_nlp_routes -->|"calls"| node_nlp_service
node_feature_service -->|"reads and writes"| node_database
node_feature_service -->|"uses feature model"| node_models
node_nlp_service -->|"reads and writes"| node_database
node_nlp_service -->|"requests reorder advice"| node_inventory
node_business_user -->|"administers models"| node_admin_ui
node_admin_ui -->|"requests evaluations"| node_admin_api
node_admin_api -->|"HTTP requests"| node_backend
node_backend -->|"dispatches"| node_admin_routes
node_backend -->|"dispatches"| node_tuning_routes
node_admin_routes -->|"calls"| node_admin_service
node_tuning_routes -->|"starts tuning"| node_tuning_service
node_admin_service -->|"queries records"| node_database
node_admin_service -->|"uses records"| node_admin_models
node_tuning_service -->|"stores tuning results"| node_admin_models

click node_app "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/Dashboard.jsx"
click node_pricing_page "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/Pricing.jsx"
click node_inventory_page "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/Inventory.jsx"
click node_promotions_page "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/Promotions.jsx"
click node_api_client "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/services/api.js"
click node_backend "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/main.py"
click node_products "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Products/Product_router.py"
click node_sales "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Sales_record/Sales_router.py"
click node_market "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Market/market_router.py"
click node_forecast "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Forecast/forecast_router.py"
click node_lstm "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/LSTM/lstm_router.py"
click node_pricing "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Pricing/pricing_router.py"
click node_inventory "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Inventory/inventory_router.py"
click node_promotions "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Promotion/promotion_router.py"
click node_features "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Features/feature_router.py"
click node_nlp_routes "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/NLP/nlp_router.py"
click node_evaluation "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Evaluation/evaluation_router.py"
click node_market_service "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/Market_services.py"
click node_feature_service "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/Feature_engineering_service.py"
click node_nlp_service "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/NLP/explanation_service.py"
click node_admin_ui "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/admin/ModelEvaluation.jsx"
click node_admin_api "https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/services/adminApi.js"
click node_admin_routes "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/routers/admin_evaluation_router.py"
click node_tuning_routes "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/routers/tuning_router.py"
click node_admin_service "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/services/admin_evaluation_service.py"
click node_tuning_service "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/services/tuning_service.py"
click node_database "https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/database.py"
click node_models "https://github.com/avi03-dev-oi/prisight/tree/main/Backend/app/models"
click node_admin_models "https://github.com/avi03-dev-oi/prisight/tree/main/Backend/app/admin/models"

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_dashboard,node_pricing_page,node_inventory_page,node_promotions_page,node_api_client,node_admin_ui,node_admin_api,node_business_user toneBlue
class node_backend,node_products,node_sales,node_market,node_forecast,node_lstm,node_pricing,node_inventory,node_promotions,node_features,node_nlp_routes,node_evaluation toneAmber
class node_market_service,node_feature_service,node_nlp_service toneMint
class node_admin_routes,node_tuning_routes,node_admin_service,node_tuning_service toneRose
class node_database,node_models,node_admin_models toneIndigo
```

## Components

### React application

- [App routes](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/Dashboard.jsx): `frontend/src/Dashboard.jsx`
- [Pricing page](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/Pricing.jsx): `frontend/src/pages/Pricing.jsx`
- [Inventory page](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/Inventory.jsx): `frontend/src/pages/Inventory.jsx`
- [Promotions page](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/Promotions.jsx): `frontend/src/pages/Promotions.jsx`
- [API client](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Admin console](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/pages/admin/ModelEvaluation.jsx): `frontend/src/pages/admin/ModelEvaluation.jsx`
- [Admin API client](https://github.com/avi03-dev-oi/prisight/blob/main/frontend/src/services/adminApi.js): `frontend/src/services/adminApi.js`

### FastAPI API

- [API entrypoint](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/main.py): `Backend/app/main.py`
- [Product routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Products/Product_router.py): `Backend/app/routers/Products/Product_router.py`
- [Sales routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Sales_record/Sales_router.py): `Backend/app/routers/Sales_record/Sales_router.py`
- [Market routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Market/market_router.py): `Backend/app/routers/Market/market_router.py`
- [Forecast routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Forecast/forecast_router.py): `Backend/app/routers/Forecast/forecast_router.py`
- [LSTM routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/LSTM/lstm_router.py): `Backend/app/routers/LSTM/lstm_router.py`
- [Pricing routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Pricing/pricing_router.py): `Backend/app/routers/Pricing/pricing_router.py`
- [Inventory routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Inventory/inventory_router.py): `Backend/app/routers/Inventory/inventory_router.py`
- [Promotion routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Promotion/promotion_router.py): `Backend/app/routers/Promotion/promotion_router.py`
- [Feature routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Features/feature_router.py): `Backend/app/routers/Features/feature_router.py`
- [Insight routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/NLP/nlp_router.py): `Backend/app/routers/NLP/nlp_router.py`
- [Evaluation routes](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/routers/Evaluation/evaluation_router.py): `Backend/app/routers/Evaluation/evaluation_router.py`

### Business intelligence

- [Market service](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/Market_services.py): `Backend/app/Services/Market_services.py`
- [Feature engineering](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/Feature_engineering_service.py): `Backend/app/Services/Feature_engineering_service.py`
- [Insight generation](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/Services/NLP/explanation_service.py): `Backend/app/Services/NLP/explanation_service.py`

### Model operations

- [Admin evaluation API](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/routers/admin_evaluation_router.py): `Backend/app/admin/routers/admin_evaluation_router.py`
- [Tuning API](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/routers/tuning_router.py): `Backend/app/admin/routers/tuning_router.py`
- [Evaluation service](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/services/admin_evaluation_service.py): `Backend/app/admin/services/admin_evaluation_service.py`
- [Tuning jobs](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/admin/services/tuning_service.py): `Backend/app/admin/services/tuning_service.py`

### Persistence

- [Async database](https://github.com/avi03-dev-oi/prisight/blob/main/Backend/app/database.py): `Backend/app/database.py`
- [Domain models](https://github.com/avi03-dev-oi/prisight/tree/main/Backend/app/models): `Backend/app/models`
- [Evaluation records](https://github.com/avi03-dev-oi/prisight/tree/main/Backend/app/admin/models): `Backend/app/admin/models`

### Other components

- **Business user**

## Connections

- Business user → App routes: navigates
- App routes → Dashboard: routes to
- App routes → Pricing page: routes to
- App routes → Inventory page: routes to
- App routes → Promotions page: routes to
- Dashboard → API client: requests data
- Pricing page → API client: requests data
- Inventory page → API client: requests data
- Promotions page → API client: requests data
- API client → API entrypoint: HTTP requests
- API entrypoint → Product routes: dispatches
- API entrypoint → Sales routes: dispatches
- API entrypoint → Market routes: dispatches
- API entrypoint → Forecast routes: dispatches
- API entrypoint → LSTM routes: dispatches
- API entrypoint → Pricing routes: dispatches
- API entrypoint → Inventory routes: dispatches
- API entrypoint → Promotion routes: dispatches
- API entrypoint → Feature routes: dispatches
- API entrypoint → Insight routes: dispatches
- API entrypoint → Evaluation routes: dispatches
- Market routes → Market service: calls
- Feature routes → Feature engineering: calls
- Insight routes → Insight generation: calls
- Feature engineering → Async database: reads and writes
- Feature engineering → Domain models: uses feature model
- Insight generation → Async database: reads and writes
- Insight generation → Inventory routes: requests reorder advice
- Business user → Admin console: administers models
- Admin console → Admin API client: requests evaluations
- Admin API client → API entrypoint: HTTP requests
- API entrypoint → Admin evaluation API: dispatches
- API entrypoint → Tuning API: dispatches
- Admin evaluation API → Evaluation service: calls
- Tuning API → Tuning jobs: starts tuning
- Evaluation service → Async database: queries records
- Evaluation service → Evaluation records: uses records
- Tuning jobs → Evaluation records: stores tuning results
