# vaishnavimahadik23/food-review-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/vaishnavimahadik23/food-review-analyzer
- Repository: https://github.com/vaishnavimahadik23/food-review-analyzer

## Overview

Food Review Analyzer accepts restaurant-review text in a Flutter client, sends it to a FastAPI service, and returns sentiment and aspect-level findings. The service preprocesses text and runs the persisted classifier/vectorizer and aspect analysis, then stores the result in SQLite. Separate API routes expose review history and sentiment-count analytics. The README documents the client and broader NLP capabilities, but Flutter/Dart source is absent from the supplied tree; those client details and several NLP stages are therefore represented only at subsystem level. Edges cite the README or sampled backend source.

Main entry points: [`backend/main.py`](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.py) (REST API routes), [`flutter_app`](https://github.com/vaishnavimahadik23/food-review-analyzer/tree/main/flutter_app) (Flutter application), [`backend/database.py`](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/database.py) (Database operations), [`backend/nlp_service.py`](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py) (Sentiment prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter client"]
  node_flutter_client["Flutter application"]
end

subgraph group_api["API service"]
  node_api_routes["REST API routes<br/>[main.py]"]
  node_request_schema["Request/response schemas<br/>[schemas.py]"]
  node_review_history["Review history<br/>[main.py]"]
  node_analytics["Sentiment analytics<br/>[main.py]"]
end

subgraph group_nlp["NLP analysis"]
  node_text_preprocessing["Text preprocessing<br/>[nlp_service.py]"]
  node_vectorizer["TF-IDF vectorizer"]
  node_sentiment_model["Sentiment classifier"]
  node_sentiment_prediction["Sentiment prediction<br/>[nlp_service.py]"]
  node_aspect_analysis["Aspect analysis<br/>[nlp_service.py]"]
end

subgraph group_persistence["Review storage"]
  node_sqlite_store[("Review database<br/>[food_reviews.db]")]
  node_database_access["Database operations<br/>[database.py]"]
end

node_customer(("Review user"))

node_customer -->|"enters review"| node_flutter_client
node_flutter_client -->|"calls REST API"| node_api_routes
node_api_routes -->|"validates request"| node_request_schema
node_api_routes -->|"requests analysis"| node_text_preprocessing
node_text_preprocessing -->|"prepares text"| node_sentiment_prediction
node_sentiment_prediction -->|"transforms text"| node_vectorizer
node_sentiment_prediction -->|"predicts sentiment"| node_sentiment_model
node_api_routes -->|"requests analysis"| node_aspect_analysis
node_api_routes -->|"saves result"| node_database_access
node_api_routes -->|"returns response"| node_request_schema
node_database_access -->|"writes reviews"| node_sqlite_store
node_review_history -->|"reads reviews"| node_database_access
node_analytics -->|"reads counts"| node_database_access
node_flutter_client -->|"requests history"| node_review_history
node_flutter_client -->|"requests analytics"| node_analytics

click node_flutter_client "https://github.com/vaishnavimahadik23/food-review-analyzer/tree/main/flutter_app"
click node_api_routes "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.py"
click node_request_schema "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/schemas.py"
click node_text_preprocessing "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py"
click node_vectorizer "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/model/tfidf_vectorizer.joblib"
click node_sentiment_model "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/model/sentiment_model.joblib"
click node_sentiment_prediction "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py"
click node_aspect_analysis "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py"
click node_sqlite_store "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/food_reviews.db"
click node_database_access "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/database.py"
click node_review_history "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.py"
click node_analytics "https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.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_flutter_client,node_customer toneBlue
class node_api_routes,node_request_schema,node_review_history,node_analytics toneAmber
class node_text_preprocessing,node_vectorizer,node_sentiment_model,node_sentiment_prediction,node_aspect_analysis toneMint
class node_sqlite_store,node_database_access toneRose
```

## Components

### Flutter client

- [Flutter application](https://github.com/vaishnavimahadik23/food-review-analyzer/tree/main/flutter_app): `flutter_app`

### API service

- [REST API routes](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.py): `backend/main.py`
- [Request/response schemas](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/schemas.py): `backend/schemas.py`
- [Review history](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.py): `backend/main.py`
- [Sentiment analytics](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/main.py): `backend/main.py`

### NLP analysis

- [Text preprocessing](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py): `backend/nlp_service.py`
- [TF-IDF vectorizer](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/model/tfidf_vectorizer.joblib): `model/tfidf_vectorizer.joblib`
- [Sentiment classifier](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/model/sentiment_model.joblib): `model/sentiment_model.joblib`
- [Sentiment prediction](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py): `backend/nlp_service.py`
- [Aspect analysis](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/nlp_service.py): `backend/nlp_service.py`

### Review storage

- [Review database](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/food_reviews.db): `backend/food_reviews.db`
- [Database operations](https://github.com/vaishnavimahadik23/food-review-analyzer/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Review user**

## Connections

- Review user → Flutter application: enters review (evidence: `README.md`)
- Flutter application → REST API routes: calls REST API (evidence: `README.md`)
- REST API routes → Request/response schemas: validates request (evidence: `backend/main.py`)
- REST API routes → Text preprocessing: requests analysis (evidence: `backend/main.py`)
- Text preprocessing → Sentiment prediction: prepares text (evidence: `backend/nlp_service.py`)
- Sentiment prediction → TF-IDF vectorizer: transforms text (evidence: `backend/nlp_service.py`)
- Sentiment prediction → Sentiment classifier: predicts sentiment (evidence: `backend/nlp_service.py`)
- REST API routes → Aspect analysis: requests analysis (evidence: `backend/main.py`)
- REST API routes → Database operations: saves result (evidence: `backend/main.py`)
- REST API routes → Request/response schemas: returns response (evidence: `backend/main.py`)
- Database operations → Review database: writes reviews (evidence: `backend/database.py`)
- Review history → Database operations: reads reviews (evidence: `backend/main.py`)
- Sentiment analytics → Database operations: reads counts (evidence: `backend/main.py`)
- Flutter application → Review history: requests history (evidence: `README.md`)
- Flutter application → Sentiment analytics: requests analytics (evidence: `README.md`)
