# atharvtrivedi21/sentiment-analysis-dashboard architecture

> Architecture diagram of the GitHub repository atharvtrivedi21/sentiment-analysis-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atharvtrivedi21/sentiment-analysis-dashboard
- Repository: https://github.com/atharvtrivedi21/sentiment-analysis-dashboard

## Overview

##### Project Type and Purpose
- This is an **interactive analytical dashboard** (a single‐page Streamlit web app) for performing sentiment analysis on customer feedback.
- It ingests a text dataset, classifies sentiment via NLTK, and renders visualizations (bar chart, pie chart, word cloud).

##### File Structure
- Top‐level files:
- app.py – the Streamlit entry point and orchestrator
- batch_sentiment_data.csv – sample data source
- test.py – (optional) script for basic unit tests or dry‐run
- requirements.txt – Python dependencies
- No separate frontend/backend directories – the UI and logic live together in app.py.
- No external microservices; everything runs in one process.

##### README Insights
- Tech stack: Streamlit (UI), NLTK (NLP), Matplotlib/WordCloud (visuals), pandas (data handling).
- Key features listed: sentiment classification, distribution plots, word clouds.
- Deployment: runs via `streamlit run app.py`.

##### Main Components
a. **User Interface (Streamlit Frontend)**
- Handles user interactions (file upload or built-in dataset selection)
- Triggers analysis and renders charts
b. **Data Layer**
- CSV data input (batch_sentiment_data.csv) or dynamic input
- pandas DataFrame for in‐memory processing
c. **Processing Layer**
- NLTK Sentiment Analyzer
- Preprocessing: tokenization, stop‐word removal
- Classification: Positive/Neutral/Negative
d. **Visualization Layer**
- Matplotlib/Pyplot for bar and pie charts
- WordCloud library for generating word clouds
e. **Optional Test Harness**
- test.py script for sanity checks on the analysis functions

##### Relationships and Interactions
- User→Streamlit UI: selects data or uploads file
- UI→Data Layer: passes file path/data
- Data Layer→Processing Layer: provides raw text for NLP
- Processing Layer→Visualization Layer: returns sentiment counts and word frequencies
- Visualization Layer→UI: renders graphs and word clouds

##### Architectural Patterns and Design Principles
- **Single‐process, event‐driven**: Streamlit callbacks drive the workflow.
- **Layered**: clear separation of data, processing, and visualization within one script.
- **Modularity**: if scaling up, you could extract each layer into modules (e.g., data.py, nlp.py, viz.py).

##### Technologies and Libraries to Annotate
- Streamlit: UI framework
- pandas: data ingestion/manipulation
- NLTK: NLP preprocessing & sentiment classification
- Matplotlib & WordCloud: plotting & word cloud generation
- Python 3.x runtime

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface"
        UI["Streamlit Frontend\n(event-driven UI)"]:::ui
    end

    %% Data Layer
    subgraph "Data Layer"
        CSV[(batch_sentiment_data.csv)]:::data
        DF["pandas DataFrame"]:::data
    end

    %% Processing Layer
    subgraph "Processing Layer"
        NLP["NLTK Preprocessing &\nSentiment Classification"]:::processing
    end

    %% Visualization Layer
    subgraph "Visualization Layer"
        VIZ["Matplotlib & WordCloud\nChart Generation"]:::viz
    end

    %% Test & Documentation
    subgraph "Test & Documentation"
        TEST["test.py\n(Sanity Checks)"]:::test
        REQ["requirements.txt"]:::doc
        DOC1["README.md"]:::doc
        DOC2["Sentiment-Analysis-Dashboard.pdf"]:::doc
    end

    %% Data Flow
    UI -->|"select/upload data"| DF
    CSV -->|"load batch CSV"| DF
    DF -->|"raw text"| NLP
    NLP -->|"sentiment scores & word frequencies"| VIZ
    VIZ -->|"render charts & word clouds"| UI
    TEST -->|"sanity checks on analysis"| NLP

    %% Click Events
    click UI "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/app.py"
    click DF "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/app.py"
    click NLP "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/app.py"
    click VIZ "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/app.py"
    click CSV "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/batch_sentiment_data.csv"
    click TEST "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/test.py"
    click REQ "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/requirements.txt"
    click DOC1 "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/README.md"
    click DOC2 "https://github.com/atharvtrivedi21/sentiment-analysis-dashboard/blob/main/Sentiment-Analysis-Dashboard.pdf"

    %% Styles
    classDef ui fill:#D8BFD8,stroke:#673AB7,stroke-width:1px
    classDef data fill:#BBDEFB,stroke:#2196F3,stroke-width:1px
    classDef processing fill:#C8E6C9,stroke:#4CAF50,stroke-width:1px
    classDef viz fill:#FFE0B2,stroke:#FF9800,stroke-width:1px
    classDef test fill:#E1BEE7,stroke:#9C27B0,stroke-width:1px,stroke-dasharray:5 5
    classDef doc fill:#CFD8DC,stroke:#607D8B,stroke-width:1px,stroke-dasharray:2 2
```
