# samarth3394/sentiment-analysis- architecture

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

## Overview

SentiViz is a Flask sentiment-analysis dashboard. Users upload CSV/Excel data or load the bundled sample, choose a text column, and receive sentiment scores and summaries for exploration and export; a separate UI path analyzes one text snippet. The dashboard also presents category/rating breakdowns and keyword insights. The graph captures the sampled API and browser interactions plus README-documented capabilities. Source excerpts do not show all routes or keyword implementation details, so those relationships are limited to documented edges.

Main entry points: [`static/js/app.js`](https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js) (Dashboard interactions), [`app.py`](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py) (Flask routes), [`templates/index.html`](https://github.com/samarth3394/sentiment-analysis-/blob/main/templates/index.html) (Browser UI), [`customer_reviews.csv`](https://github.com/samarth3394/sentiment-analysis-/blob/main/customer_reviews.csv) (Sample data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_browser["Browser UI<br/>[index.html]"]
  node_client["Dashboard interactions<br/>[app.js]"]
  node_charts["Interactive dashboard<br/>[app.js]"]
  node_textui["Single-text analyzer UI<br/>[app.js]"]
end

subgraph group_backend["API and workflow"]
  node_flask["Flask routes<br/>[app.py]"]
  node_dataset[("Loaded dataset state<br/>[app.py]")]
  node_uploads["CSV or Excel upload<br/>[app.py]"]
  node_sample["Sample data"]
  node_search["Search and filter<br/>[app.py]"]
  node_export["CSV export<br/>[app.py]"]
end

subgraph group_analysis["Sentiment processing"]
  node_sentiment["Scoring and preprocessing<br/>[app.py]"]
  node_summaries["Metrics and breakdowns<br/>[app.py]"]
  node_keyword["Keyword insights<br/>[app.py]"]
end

subgraph group_reporting["Standalone analysis"]
  node_standalone["Batch analysis script"]
  node_reportgen["Report document generator<br/>[generate_report.py]"]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_browser
node_browser -->|"loads interactions"| node_client
node_client -->|"sends API requests"| node_flask
node_flask -->|"serves page"| node_browser
node_client -->|"uploads file"| node_uploads
node_uploads -->|"loads data"| node_dataset
node_client -->|"requests sample"| node_sample
node_sample -->|"read as CSV"| node_dataset
node_client -->|"requests analysis"| node_sentiment
node_flask -->|"scores and tokenizes"| node_sentiment
node_sentiment -->|"stores analyzed data"| node_dataset
node_flask -->|"computes metrics"| node_summaries
node_summaries -->|"returns dashboard data"| node_client
node_client -->|"renders charts"| node_charts
node_flask -->|"extracts keywords"| node_keyword
node_client -->|"submits filters"| node_search
node_flask -->|"filters dataset"| node_search
node_search -->|"reads data"| node_dataset
node_client -->|"submits text"| node_textui
node_textui -->|"calls analyzer endpoint"| node_flask
node_flask -->|"scores snippet"| node_sentiment
node_client -.->|"requests export"| node_export
node_flask -->|"exports CSV"| node_export
node_export -->|"reads analyzed data"| node_dataset
node_user -.->|"runs batch analysis"| node_standalone
node_user -.->|"generates report"| node_reportgen

click node_browser "https://github.com/samarth3394/sentiment-analysis-/blob/main/templates/index.html"
click node_client "https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js"
click node_flask "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_dataset "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_uploads "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_sample "https://github.com/samarth3394/sentiment-analysis-/blob/main/customer_reviews.csv"
click node_sentiment "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_summaries "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_keyword "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_search "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_export "https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py"
click node_charts "https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js"
click node_textui "https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js"
click node_standalone "https://github.com/samarth3394/sentiment-analysis-/blob/main/sentiment_analysis.py"
click node_reportgen "https://github.com/samarth3394/sentiment-analysis-/blob/main/generate_report.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_browser,node_client,node_charts,node_textui,node_user toneBlue
class node_flask,node_dataset,node_uploads,node_sample,node_search,node_export toneAmber
class node_sentiment,node_summaries,node_keyword toneMint
class node_standalone,node_reportgen toneRose
```

## Components

### Web interface

- [Browser UI](https://github.com/samarth3394/sentiment-analysis-/blob/main/templates/index.html): `templates/index.html`
- [Dashboard interactions](https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js): `static/js/app.js`
- [Interactive dashboard](https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js): `static/js/app.js`
- [Single-text analyzer UI](https://github.com/samarth3394/sentiment-analysis-/blob/main/static/js/app.js): `static/js/app.js`

### API and workflow

- [Flask routes](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`
- [Loaded dataset state](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`
- [CSV or Excel upload](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`
- [Sample data](https://github.com/samarth3394/sentiment-analysis-/blob/main/customer_reviews.csv): `customer_reviews.csv`
- [Search and filter](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`
- [CSV export](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`

### Sentiment processing

- [Scoring and preprocessing](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`
- [Metrics and breakdowns](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`
- [Keyword insights](https://github.com/samarth3394/sentiment-analysis-/blob/main/app.py): `app.py`

### Standalone analysis

- [Batch analysis script](https://github.com/samarth3394/sentiment-analysis-/blob/main/sentiment_analysis.py): `sentiment_analysis.py`
- [Report document generator](https://github.com/samarth3394/sentiment-analysis-/blob/main/generate_report.py): `generate_report.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Browser UI: uses (evidence: `README.md`)
- Browser UI → Dashboard interactions: loads interactions (evidence: `README.md`)
- Dashboard interactions → Flask routes: sends API requests (evidence: `static/js/app.js`)
- Flask routes → Browser UI: serves page (evidence: `app.py`)
- Dashboard interactions → CSV or Excel upload: uploads file (evidence: `static/js/app.js`)
- CSV or Excel upload → Loaded dataset state: loads data (evidence: `app.py`)
- Dashboard interactions → Sample data: requests sample
- Sample data → Loaded dataset state: read as CSV (evidence: `app.py`)
- Dashboard interactions → Scoring and preprocessing: requests analysis (evidence: `static/js/app.js`)
- Flask routes → Scoring and preprocessing: scores and tokenizes (evidence: `app.py`)
- Scoring and preprocessing → Loaded dataset state: stores analyzed data (evidence: `app.py`)
- Flask routes → Metrics and breakdowns: computes metrics (evidence: `app.py`)
- Metrics and breakdowns → Dashboard interactions: returns dashboard data (evidence: `app.py`)
- Dashboard interactions → Interactive dashboard: renders charts (evidence: `static/js/app.js`)
- Flask routes → Keyword insights: extracts keywords (evidence: `README.md`)
- Dashboard interactions → Search and filter: submits filters (evidence: `static/js/app.js`)
- Flask routes → Search and filter: filters dataset (evidence: `app.py`)
- Search and filter → Loaded dataset state: reads data (evidence: `app.py`)
- Dashboard interactions → Single-text analyzer UI: submits text (evidence: `static/js/app.js`)
- Single-text analyzer UI → Flask routes: calls analyzer endpoint (evidence: `static/js/app.js`)
- Flask routes → Scoring and preprocessing: scores snippet (evidence: `app.py`)
- Dashboard interactions → CSV export: requests export
- Flask routes → CSV export: exports CSV (evidence: `README.md`)
- CSV export → Loaded dataset state: reads analyzed data (evidence: `app.py`)
- Dashboard user → Batch analysis script: runs batch analysis
- Dashboard user → Report document generator: generates report
