# gustavorubim/sentiment-dashboard-f architecture

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

- Interactive diagram: https://gitdiagram.com/gustavorubim/sentiment-dashboard-f
- Repository: https://github.com/gustavorubim/sentiment-dashboard-f

## Overview

##### Project Type and Purpose
- This is a React-based dashboard application focused on visualizing and analyzing sentiment data from review CSV files.
- Its main purpose is to process review datasets (ingested from CSV files/unzipped in the public folder) and display different analytical views, including sentiment analysis and model metrics.

##### File Structure
- Top-level directories include:
- "public": Contains static assets, including the main index.html and CSV data files (or a ZIP to be extracted).
- "src": Contains all main application code, including React components (e.g., App.js, various dashboards, and landing pages).
- "build": Contains the output of the production build.
- There are also important configuration and dependency files such as package.json, which indicate that npm is used as the package manager.
- Notice how the project separates UI components (in src/components), utility functions (src/analysisUtils.js), and shared context (src/context/ThemeContext.js with corresponding theming in src/styles/theme.css).

##### README for Additional Insights
- The README clearly explains that the app is bootstrapped via public/index.html and src/index.js.
- The core routing and state management is done in src/App.js, which delegates views to multiple specialized dashboards (AnalysisDashboard.js, Dashboard.js, ModelMetricsDashboard.js, ReviewDetailDashboard.js, and DisagreementExamination.js).
- The modular architecture emphasizes separation of concerns: data ingestion, UI presentation, utility processing, and theming.

##### Main Components and Their Interactions
- Data Ingestion: CSV files (or unzipped resources) in the public folder serve as the initial data source.
- Bootstrapping Layer: public/index.html loads the React app via src/index.js.
- Application Core:
- App.js—acts as the central coordinator that handles routing and state management.
- It orchestrates the rendering of different dashboard views.
- UI Dashboards:
- Dashboard.js, AnalysisDashboard.js, ModelMetricsDashboard.js, ReviewDetailDashboard.js, and DisagreementExamination.js each represent a different view or part of the analysis.
- Utility Layer:
- analysisUtils.js processes the raw CSV data and computes sentiment values.
- UI Components:
- Reusable components like GlassCard.js and ThemeToggle.js structure the user interface.
- Shared State and Styling:
- ThemeContext.js is used for managing application-wide theming, supported by theme.css in the styles folder.

##### Architectural Patterns to Highlight
- Modular design with clear separation between presentation (React components) and logic/utility (analysisUtils.js).
- Single-page application bootstrapping pattern: starting from public/index.html → src/index.js → App.js.
- Component-based architecture typical of React applications.
- The use of context for managing shared state (ThemeContext) aligns with recommended React patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingestion Layer
    subgraph "Data Ingestion Layer"
        D1("Reviews Data (CSV)"):::data
    end

    %% Bootstrapping Layer
    subgraph "Bootstrapping Layer"
        B1("public/index.html"):::bootstrap
        B2("src/index.js"):::bootstrap
    end

    %% Application Core
    subgraph "Application Core"
        C1("src/App.js"):::core
    end

    %% UI Dashboards
    subgraph "UI Dashboards"
        U1("src/AnalysisDashboard.js"):::dashboard
        U2("src/Dashboard.js"):::dashboard
        U3("src/ModelMetricsDashboard.js"):::dashboard
        U4("src/ReviewDetailDashboard.js"):::dashboard
        U5("src/DisagreementExamination.js"):::dashboard
    end

    %% Utility Services
    subgraph "Utility Services"
        UT("src/analysisUtils.js"):::utility
    end

    %% UI Components
    subgraph "UI Components"
        CP1("src/components/GlassCard.js"):::uiComponent
        CP2("src/components/ThemeToggle.js"):::uiComponent
    end

    %% Shared State & Styling
    subgraph "Shared State & Styling"
        S1("src/context/ThemeContext.js"):::shared
        S2("src/styles/theme.css"):::shared
    end

    %% Connections
    D1 -->|"loads"| B1
    B1 -->|"bootstraps"| B2
    B2 -->|"initializes"| C1

    C1 -->|"routes to"| U1
    C1 -->|"routes to"| U2
    C1 -->|"routes to"| U3
    C1 -->|"routes to"| U4
    C1 -->|"routes to"| U5

    U1 -->|"processes data with"| UT
    U2 -->|"processes data with"| UT
    U3 -->|"processes data with"| UT
    U4 -->|"processes data with"| UT
    U5 -->|"processes data with"| UT

    C1 -->|"applies theme from"| S1
    S1 -->|"styles defined in"| S2

    U1 -->|"uses"| CP1
    U1 -->|"uses"| CP2
    U2 -->|"uses"| CP1
    U2 -->|"uses"| CP2
    U3 -->|"uses"| CP1
    U3 -->|"uses"| CP2
    U4 -->|"uses"| CP1
    U4 -->|"uses"| CP2
    U5 -->|"uses"| CP1
    U5 -->|"uses"| CP2

    %% Click Events
    click D1 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/public/reviews.zip"
    click B1 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/public/index.html"
    click B2 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/index.js"
    click C1 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/App.js"
    click U1 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/AnalysisDashboard.js"
    click U2 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/Dashboard.js"
    click U3 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/ModelMetricsDashboard.js"
    click U4 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/ReviewDetailDashboard.js"
    click U5 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/DisagreementExamination.js"
    click UT "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/analysisUtils.js"
    click CP1 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/components/GlassCard.js"
    click CP2 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/components/ThemeToggle.js"
    click S1 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/context/ThemeContext.js"
    click S2 "https://github.com/gustavorubim/sentiment-dashboard-f/blob/main/src/styles/theme.css"

    %% Styles
    classDef data fill:#d1e7dd,stroke:#0f5132,stroke-width:2px;
    classDef bootstrap fill:#cff4fc,stroke:#055160,stroke-width:2px;
    classDef core fill:#fff3cd,stroke:#664d03,stroke-width:2px;
    classDef dashboard fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
    classDef utility fill:#f8d7da,stroke:#842029,stroke-width:2px;
    classDef uiComponent fill:#d1c4e9,stroke:#4a148c,stroke-width:2px;
    classDef shared fill:#cfe2ff,stroke:#084298,stroke-width:2px;
```
