# ayushdevadiga1/reviewlens architecture

> Architecture diagram of the GitHub repository ayushdevadiga1/reviewlens, 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/ayushdevadiga1/reviewlens
- Repository: https://github.com/ayushdevadiga1/reviewlens

## Overview

ReviewLens loads offline Amazon and Flipkart review datasets, cleans and stores them, filters fake reviews, performs aspect-based sentiment analysis, and serves analysis through a FastAPI API and Streamlit dashboard. The graph follows that workflow and also includes comparison, trends, product discovery, health, and async-job capabilities documented in the README. Some subsystem links rely on README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`api/main.py`](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/main.py) (FastAPI App), [`api/services/analysis_pipeline.py`](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/analysis_pipeline.py) (Analysis Pipeline), [`db/models.py`](https://github.com/ayushdevadiga1/reviewlens/blob/main/db/models.py) (Review Data Models), [`frontend/pages/1_Single_Product.py`](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/pages/1_Single_Product.py) (Dashboard Pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion"]
  node_amazon_loader["Amazon Loader<br/>[amazon_loader.py]"]
  node_flipkart_loader["Flipkart Loader<br/>[flipkart_loader.py]"]
  node_cleaner["Review Cleaner<br/>[cleaner.py]"]
end

subgraph group_analysis["Analysis"]
  node_fake_detector["Fake Review Filter<br/>[fake_detector.py]"]
  node_absa_service["ABSA Service<br/>[absa.py]"]
  node_inference["ABSA Inference<br/>[inference.py]"]
  node_aspects["Aspect Definitions<br/>[aspects.py]"]
  node_pipeline["Analysis Pipeline"]
  node_aggregator["Score Aggregator<br/>[aggregator.py]"]
end

subgraph group_serving["API Serving"]
  node_api_app["FastAPI App<br/>[main.py]"]
  node_analyze_router["Analyze Endpoint<br/>[analyze.py]"]
  node_jobs_router["Async Jobs<br/>[jobs.py]"]
  node_compare_router["Comparison Endpoint<br/>[compare.py]"]
  node_trends_router["Trends Endpoint<br/>[trends.py]"]
  node_products_router["Product Discovery<br/>[products.py]"]
  node_health_router["Health Endpoint<br/>[health.py]"]
  node_request_schemas["Request Schemas<br/>[request.py]"]
  node_response_schemas["Response Schemas<br/>[response.py]"]
  node_auth["API-Key Auth<br/>[auth.py]"]
  node_rate_limit["Rate Limits<br/>[rate_limit.py]"]
end

subgraph group_storage["Persistence"]
  node_models["Review Data Models<br/>[models.py]"]
  node_session["DB Sessions<br/>[session.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_pages["Dashboard Pages"]
  node_overview["Dashboard Overview<br/>[Overview.py]"]
  node_api_client["API Client<br/>[api_client.py]"]
  node_sidebar["Shared Sidebar<br/>[sidebar.py]"]
  node_theme["Dashboard Theme<br/>[theme.py]"]
  node_radar["Radar Chart<br/>[radar_chart.py]"]
  node_comparison_table["Comparison Table"]
end

node_postgres[("PostgreSQL")]
node_user(("Dashboard User"))

node_amazon_loader -->|"cleans reviews"| node_cleaner
node_flipkart_loader -->|"cleans reviews"| node_cleaner
node_amazon_loader -->|"stores reviews"| node_session
node_flipkart_loader -->|"stores reviews"| node_session
node_session -->|"creates tables"| node_models
node_session -->|"connects"| node_postgres
node_api_app -->|"creates tables"| node_session
node_api_app -->|"registers"| node_analyze_router
node_api_app -->|"registers"| node_compare_router
node_api_app -->|"registers"| node_trends_router
node_api_app -->|"registers"| node_health_router
node_api_app -->|"registers"| node_products_router
node_api_app -->|"registers"| node_jobs_router
node_api_app -->|"installs middleware"| node_auth
node_api_app -->|"installs middleware"| node_rate_limit
node_analyze_router -->|"runs analysis"| node_pipeline
node_jobs_router -->|"runs analysis"| node_pipeline
node_pipeline -->|"filters reviews"| node_fake_detector
node_pipeline -->|"analyzes genuine reviews"| node_absa_service
node_absa_service -->|"uses inference"| node_inference
node_pipeline -->|"aggregates results"| node_aggregator
node_inference -->|"uses aspects"| node_aspects
node_pipeline -->|"persists results"| node_models
node_compare_router -->|"aggregates comparison"| node_aggregator
node_compare_router -->|"queries products"| node_models
node_trends_router -->|"aggregates trends"| node_aggregator
node_trends_router -->|"queries reviews"| node_models
node_products_router -->|"queries products"| node_models
node_health_router -->|"checks database"| node_models
node_analyze_router -->|"validates input"| node_request_schemas
node_analyze_router -->|"returns results"| node_response_schemas
node_user -->|"uses dashboard"| node_dashboard_pages
node_user -->|"opens overview"| node_overview
node_dashboard_pages -->|"requests data"| node_api_client
node_overview -->|"requests data"| node_api_client
node_dashboard_pages -->|"renders sidebar"| node_sidebar
node_overview -->|"renders sidebar"| node_sidebar
node_sidebar -->|"checks health"| node_api_client
node_sidebar -->|"renders status"| node_theme
node_dashboard_pages -->|"renders chart"| node_radar
node_dashboard_pages -->|"renders comparison"| node_comparison_table
node_api_client -->|"calls REST API"| node_api_app

click node_amazon_loader "https://github.com/ayushdevadiga1/reviewlens/blob/main/data_ingestion/loaders/amazon_loader.py"
click node_flipkart_loader "https://github.com/ayushdevadiga1/reviewlens/blob/main/data_ingestion/loaders/flipkart_loader.py"
click node_cleaner "https://github.com/ayushdevadiga1/reviewlens/blob/main/data_ingestion/cleaner.py"
click node_fake_detector "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/fake_detector.py"
click node_absa_service "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/absa.py"
click node_inference "https://github.com/ayushdevadiga1/reviewlens/blob/main/ml/absa/inference.py"
click node_aspects "https://github.com/ayushdevadiga1/reviewlens/blob/main/ml/absa/aspects.py"
click node_pipeline "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/analysis_pipeline.py"
click node_aggregator "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/aggregator.py"
click node_models "https://github.com/ayushdevadiga1/reviewlens/blob/main/db/models.py"
click node_session "https://github.com/ayushdevadiga1/reviewlens/blob/main/db/session.py"
click node_api_app "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/main.py"
click node_analyze_router "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/analyze.py"
click node_jobs_router "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/jobs.py"
click node_compare_router "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/compare.py"
click node_trends_router "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/trends.py"
click node_products_router "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/products.py"
click node_health_router "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/health.py"
click node_request_schemas "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/schemas/request.py"
click node_response_schemas "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/schemas/response.py"
click node_auth "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/middleware/auth.py"
click node_rate_limit "https://github.com/ayushdevadiga1/reviewlens/blob/main/api/middleware/rate_limit.py"
click node_dashboard_pages "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/pages/1_Single_Product.py"
click node_overview "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/Overview.py"
click node_api_client "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/api_client.py"
click node_sidebar "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/sidebar.py"
click node_theme "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/theme.py"
click node_radar "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/radar_chart.py"
click node_comparison_table "https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/comparison_table.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_amazon_loader,node_flipkart_loader,node_cleaner,node_user toneBlue
class node_fake_detector,node_absa_service,node_inference,node_aspects,node_pipeline,node_aggregator,node_postgres toneAmber
class node_api_app,node_analyze_router,node_jobs_router,node_compare_router,node_trends_router,node_products_router,node_health_router,node_request_schemas,node_response_schemas,node_auth,node_rate_limit toneMint
class node_models,node_session toneRose
class node_dashboard_pages,node_overview,node_api_client,node_sidebar,node_theme,node_radar,node_comparison_table toneIndigo
```

## Components

### Ingestion

- [Amazon Loader](https://github.com/ayushdevadiga1/reviewlens/blob/main/data_ingestion/loaders/amazon_loader.py): `data_ingestion/loaders/amazon_loader.py`
- [Flipkart Loader](https://github.com/ayushdevadiga1/reviewlens/blob/main/data_ingestion/loaders/flipkart_loader.py): `data_ingestion/loaders/flipkart_loader.py`
- [Review Cleaner](https://github.com/ayushdevadiga1/reviewlens/blob/main/data_ingestion/cleaner.py): `data_ingestion/cleaner.py`

### Analysis

- [Fake Review Filter](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/fake_detector.py): `api/services/fake_detector.py`
- [ABSA Service](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/absa.py): `api/services/absa.py`
- [ABSA Inference](https://github.com/ayushdevadiga1/reviewlens/blob/main/ml/absa/inference.py): `ml/absa/inference.py`
- [Aspect Definitions](https://github.com/ayushdevadiga1/reviewlens/blob/main/ml/absa/aspects.py): `ml/absa/aspects.py`
- [Analysis Pipeline](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/analysis_pipeline.py): `api/services/analysis_pipeline.py`
- [Score Aggregator](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/services/aggregator.py): `api/services/aggregator.py`

### API Serving

- [FastAPI App](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/main.py): `api/main.py`
- [Analyze Endpoint](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/analyze.py): `api/routers/analyze.py`
- [Async Jobs](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/jobs.py): `api/routers/jobs.py`
- [Comparison Endpoint](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/compare.py): `api/routers/compare.py`
- [Trends Endpoint](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/trends.py): `api/routers/trends.py`
- [Product Discovery](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/products.py): `api/routers/products.py`
- [Health Endpoint](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/routers/health.py): `api/routers/health.py`
- [Request Schemas](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/schemas/request.py): `api/schemas/request.py`
- [Response Schemas](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/schemas/response.py): `api/schemas/response.py`
- [API-Key Auth](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/middleware/auth.py): `api/middleware/auth.py`
- [Rate Limits](https://github.com/ayushdevadiga1/reviewlens/blob/main/api/middleware/rate_limit.py): `api/middleware/rate_limit.py`

### Persistence

- [Review Data Models](https://github.com/ayushdevadiga1/reviewlens/blob/main/db/models.py): `db/models.py`
- [DB Sessions](https://github.com/ayushdevadiga1/reviewlens/blob/main/db/session.py): `db/session.py`

### Dashboard

- [Dashboard Pages](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/pages/1_Single_Product.py): `frontend/pages/1_Single_Product.py`
- [Dashboard Overview](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/Overview.py): `frontend/Overview.py`
- [API Client](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/api_client.py): `frontend/components/api_client.py`
- [Shared Sidebar](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/sidebar.py): `frontend/components/sidebar.py`
- [Dashboard Theme](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/theme.py): `frontend/components/theme.py`
- [Radar Chart](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/radar_chart.py): `frontend/components/radar_chart.py`
- [Comparison Table](https://github.com/ayushdevadiga1/reviewlens/blob/main/frontend/components/comparison_table.py): `frontend/components/comparison_table.py`

### Other components

- **PostgreSQL**
- **Dashboard User**

## Connections

- Amazon Loader → Review Cleaner: cleans reviews (evidence: `data_ingestion/loaders/amazon_loader.py`)
- Flipkart Loader → Review Cleaner: cleans reviews (evidence: `data_ingestion/loaders/flipkart_loader.py`)
- Amazon Loader → DB Sessions: stores reviews (evidence: `data_ingestion/loaders/amazon_loader.py`)
- Flipkart Loader → DB Sessions: stores reviews (evidence: `data_ingestion/loaders/flipkart_loader.py`)
- DB Sessions → Review Data Models: creates tables (evidence: `db/session.py`)
- DB Sessions → PostgreSQL: connects (evidence: `db/session.py`)
- FastAPI App → DB Sessions: creates tables (evidence: `api/main.py`)
- FastAPI App → Analyze Endpoint: registers (evidence: `api/main.py`)
- FastAPI App → Comparison Endpoint: registers (evidence: `api/main.py`)
- FastAPI App → Trends Endpoint: registers (evidence: `api/main.py`)
- FastAPI App → Health Endpoint: registers (evidence: `api/main.py`)
- FastAPI App → Product Discovery: registers (evidence: `api/main.py`)
- FastAPI App → Async Jobs: registers (evidence: `api/main.py`)
- FastAPI App → API-Key Auth: installs middleware (evidence: `api/main.py`)
- FastAPI App → Rate Limits: installs middleware (evidence: `api/main.py`)
- Analyze Endpoint → Analysis Pipeline: runs analysis (evidence: `api/routers/analyze.py`)
- Async Jobs → Analysis Pipeline: runs analysis (evidence: `api/routers/jobs.py`)
- Analysis Pipeline → Fake Review Filter: filters reviews (evidence: `README.md`)
- Analysis Pipeline → ABSA Service: analyzes genuine reviews (evidence: `README.md`)
- ABSA Service → ABSA Inference: uses inference (evidence: `api/services/absa.py`)
- Analysis Pipeline → Score Aggregator: aggregates results (evidence: `api/services/analysis_pipeline.py`)
- ABSA Inference → Aspect Definitions: uses aspects (evidence: `ml/absa/inference.py`)
- Analysis Pipeline → Review Data Models: persists results (evidence: `api/services/analysis_pipeline.py`)
- Comparison Endpoint → Score Aggregator: aggregates comparison (evidence: `api/routers/compare.py`)
- Comparison Endpoint → Review Data Models: queries products (evidence: `api/routers/compare.py`)
- Trends Endpoint → Score Aggregator: aggregates trends (evidence: `api/routers/trends.py`)
- Trends Endpoint → Review Data Models: queries reviews (evidence: `api/routers/trends.py`)
- Product Discovery → Review Data Models: queries products (evidence: `api/routers/products.py`)
- Health Endpoint → Review Data Models: checks database (evidence: `api/routers/health.py`)
- Analyze Endpoint → Request Schemas: validates input (evidence: `api/routers/analyze.py`)
- Analyze Endpoint → Response Schemas: returns results (evidence: `api/routers/analyze.py`)
- Dashboard User → Dashboard Pages: uses dashboard (evidence: `README.md`)
- Dashboard User → Dashboard Overview: opens overview (evidence: `README.md`)
- Dashboard Pages → API Client: requests data (evidence: `frontend/pages/1_Single_Product.py`)
- Dashboard Overview → API Client: requests data (evidence: `frontend/Overview.py`)
- Dashboard Pages → Shared Sidebar: renders sidebar (evidence: `frontend/pages/1_Single_Product.py`)
- Dashboard Overview → Shared Sidebar: renders sidebar (evidence: `frontend/Overview.py`)
- Shared Sidebar → API Client: checks health (evidence: `frontend/components/sidebar.py`)
- Shared Sidebar → Dashboard Theme: renders status (evidence: `frontend/components/sidebar.py`)
- Dashboard Pages → Radar Chart: renders chart (evidence: `frontend/pages/1_Single_Product.py`)
- Dashboard Pages → Comparison Table: renders comparison
- API Client → FastAPI App: calls REST API (evidence: `README.md`)
