# gen-git-26/rreview_analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/gen-git-26/rreview_analyzer
- Repository: https://github.com/gen-git-26/rreview_analyzer

## Overview

##### Main Components
- Data Ingestion & Preprocessing:
- “data” folder where scraped CSV files are stored (both raw data in “data/scraped_data” and cleaned data files).
- Data cleaning and aggregation process that leads to cleaned CSV files.
- Text Analysis using NLP/LLM Models:
- Two distinct modules: one for labeling sentiment using the “tabularisai/robust-sentiment-analysis” model and another module for sentiment training using the “distilbert-base-uncased” model.
- Image Analysis (Computer Vision):
- Two parallel image analysis tracks: one using CLIP and the other using batch classification with ResNet.
- Integration and Result Aggregation:
- User Interface / Chat-SQL Component:
- Interactive “app.py” (in the final folder) built with Streamlit, which acts as the front-end to query the analyzed data with SQL-style questions.
- Experiment & Development Artifacts:
- Optionally, include the “notebooks” folder to indicate iterative experimentation and development, showing that initial prototypes (app_v1.py, app_v2.py, etc.) and various experiment notebooks contributed to the refinement of components.

##### Relationships and Interactions
- From raw scraped data → Data Cleaning → Processed Data
- From Processed Data → Parallel branches for NLP analysis and Image analysis.
- From these analysis modules, converge outputs into a combined insights store.
- Dependencies between analysis sub-components and note that they share the same cleaned data resources.

##### Architectural Patterns & Design Principles
- Modularity: separate modules for data ingestion, text analysis, image analysis, and presentation.
- That the project uses a pipeline-style architecture where each stage (data collection, analysis, integration, UI) passes along its output to the next.
- That the project uses external services/models (LLM and CV frameworks) and leverages pre-trained models as part of its processing.

##### Technologies, Frameworks, and Libraries
- Mention Python (implied by usage of Jupyter Notebooks and .py files).
- Streamlit for building the interactive application.
- References to the pre-trained models: “tabularisai/robust-sentiment-analysis” and “distilbert-base-uncased” for NLP; CLIP and ResNet for image analysis.
- Optionally, include any data storage/SQL components (e.g., the “reviews.db” in the csv_to_sql folder) where converted CSV data is stored for rapid queries.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        A1["Raw Data (data/scraped_data)"]:::data
        B["Data Cleaning & Aggregation"]:::cleaning
        A2["Cleaned Data (data/cleaned_data.csv)"]:::data
        A3["Cleaned No-Images (data/cleaned_data_no_images.csv)"]:::data
    end

    %% Processing Layer
    subgraph "Processing Layer"
        C1["Text Analysis (NLP) (final/nlp.ipynb)"]:::analysis
        C2["Image Analysis (CV) (final/cv.ipynb)"]:::analysis
    end

    %% Integration Layer
    subgraph "Integration Layer"
        D["Integrated Insights (final/eda.ipynb)"]:::integration
        D2["CSV-to-SQL Storage (final/csv_to_sql)"]:::integration
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        E["Interactive UI (final/app.py)"]:::ui
    end

    %% Experimentation
    subgraph "Experimentation"
        F["Prototypes & Experiments (notebooks/)"]:::experiments
    end

    %% Data Flow Connections
    A1 -->|"ingests"| B
    B -->|"generates"| A2
    B -->|"generates"| A3
    A2 -->|"feeds"| C1
    A2 -->|"feeds"| C2
    A3 -->|"feeds"| C1
    A3 -->|"feeds"| C2
    C1 -->|"outputs"| D
    C2 -->|"outputs"| D
    C1 -->|"updates"| D2
    C2 -->|"updates"| D2
    D -->|"integrates into"| E
    D2 -->|"integrates into"| E
    F -->|"refines"| B

    %% Click Events
    click A1 "https://github.com/gen-git-26/rreview_analyzer/tree/main/data/scraped_data"
    click A2 "https://github.com/gen-git-26/rreview_analyzer/blob/main/data/cleaned_data.csv"
    click A3 "https://github.com/gen-git-26/rreview_analyzer/blob/main/data/cleaned_data_no_images.csv"
    click C1 "https://github.com/gen-git-26/rreview_analyzer/blob/main/final/nlp.ipynb"
    click C2 "https://github.com/gen-git-26/rreview_analyzer/blob/main/final/cv.ipynb"
    click D "https://github.com/gen-git-26/rreview_analyzer/blob/main/final/eda.ipynb"
    click D2 "https://github.com/gen-git-26/rreview_analyzer/tree/main/final/csv_to_sql"
    click E "https://github.com/gen-git-26/rreview_analyzer/blob/main/final/app.py"
    click F "https://github.com/gen-git-26/rreview_analyzer/tree/main/notebooks/"

    %% Styles
    classDef data fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef cleaning fill:#FCF3CF,stroke:#D4AC0D,stroke-width:2px;
    classDef analysis fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef integration fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef ui fill:#F5CBA7,stroke:#BA4A00,stroke-width:2px;
    classDef experiments fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
```
