# highonsemicolon/sentiment-based-movie-rating-system architecture

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

- Interactive diagram: https://gitdiagram.com/highonsemicolon/sentiment-based-movie-rating-system
- Repository: https://github.com/highonsemicolon/sentiment-based-movie-rating-system

## Overview

##### Project Type and Purpose
- This project is a full-stack Django web application designed to rate movies based on sentiment analysis.
- The README is brief but indicates that the system’s core feature is sentiment analysis to produce movie ratings.
- The presence of Notebooks containing Jupyter notebooks, machine learning model files (model_1.pkl), and CSVs (neg.csv, pos.csv, stopwords.csv) suggests an experimental and data-driven component that probably processes movie reviews or textual data for sentiment analysis.

##### Analysis of the File Structure
- Django Core: Major Django directories include:
- movieProject: Contains the project-wide settings, URL configurations (asgi.py, wsgi.py, settings.py), and overall project initialization.
- manage.py: The Django CLI entry point.
- Applications:
- accounts: Likely handles user authentication, profiles, and related views (admin.py, models.py, urls.py, views.py).
- movie: Contains the primary app for movie handling with models, views, URL routing, admin configurations, and migration files.
- Templates: HTML files (base, about, contact, index, login, etc.) define the UI for different pages, including movie listings and movie details.
- Static & Assets:
- static and assets directories include CSS, JavaScript, fonts, and images used by the frontend (e.g., for the admin interface and the main website).
- Machine Learning Environment:
- Notebooks: Includes exploratory and development notebooks (with checkpoints), a pickled ML model (model_1.pkl), and CSV files containing sentiment data that are key to the sentiment analysis engine.

##### Main Components
a. Frontend Components:
- Web Pages & Templates: Represented by HTML templates (index, movies, single, login, register, etc.).
- Static Assets: CSS, JavaScript, images, and fonts—ensuring the dynamic visual presentation.
b. Backend Components:
- Django Core Engine: The movieProject directory (settings, URL routing, WSGI/ASGI interfaces) serves as the backbone.
- Applications:
- Accounts App: Manages user authentication and data.
- Movie App: Handles movie data including models, views, and URL endpoints.
c. Machine Learning & Sentiment Analysis Pipeline:
- Notebooks & Models: Represent the machine learning experimentation (Jupyter notebooks) and the production model (model_1.pkl). This pipeline likely includes:
- Data Inputs: CSV files for positive, negative words and stopwords.
- Model Processing: The sentiment analysis workflow that takes text inputs (e.g., movie reviews) and produces sentiment ratings.
d. Data Storage:
- Database: SQLite database (db.sqlite3) represents the persistence layer for the backend (movie data, user accounts, ratings).
- Media Assets: Media folder (with movie posters) stores uploaded movie-related images.
e. External / Integration Points (if applicable):
- Although not explicitly stated, consider any APIs or external services if the sentiment analysis model or movie data requires external interaction.

##### Relationships and Interactions
- The Frontend interacts with the Backend through HTTP requests:
- Users access web pages that serve forms for registration, login, and movie-related views.
- The Backend (Django) routes requests to respective apps (accounts, movie) based on URL patterns.
- The Movie App likely interacts with the machine learning model:
- When a user submits a review, the system might route the text to the sentiment analysis pipeline for processing, which then informs the movie rating.
- Static and media content are served as separate layers to support the user interface.
- The ML pipeline (developed in Notebooks) and the stored model (model_1.pkl) should be shown as a modular component that communicates with the backend for prediction results.

##### Architectural Patterns and Technologies
- Modular Application Architecture: Separate apps (accounts and movie) indicate logical separation of concerns.
- Machine Learning Integration: Emphasize the integration of the sentiment analysis model via a dedicated module, which could be represented as a service or microcomponent.
- Deployment and Development Tools: The presence of a “manage.py” and configuration files hint the standard Django development flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User Browser"]:::external

    subgraph "Frontend Layer"
        FT["Templates (HTML)"]:::frontend
        SA["Static Assets (static)"]:::frontend
        AS["Assets (assets)"]:::frontend
    end

    subgraph "Backend Layer"
        DC["Django Project (movieProject)"]:::backend
        AA["Accounts App"]:::backend
        MA["Movie App"]:::backend
    end

    subgraph "ML Pipeline"
        ML["Machine Learning & Sentiment Analysis Pipeline (Notebooks)"]:::machine
    end

    subgraph "Data Storage"
        DB(("SQLite Database")):::database
        Media["Media Assets"]:::database
    end

    %% Relationships between Frontend components
    SA --> FT
    AS --> FT
    User -->|"HTTP_Request"| FT

    %% Frontend to Backend
    FT -->|"HTTP_Request"| DC

    %% Django URL routing to apps
    DC -->|"URL_Routing:Auth"| AA
    DC -->|"URL_Routing:Movies"| MA

    %% Movie App calls ML pipeline
    MA -->|"SentimentAnalysis_Request"| ML
    ML -->|"SentimentAnalysis_Result"| MA

    %% Backend components accessing Data Storage
    DC -->|"DB_Access"| DB
    AA -->|"DB_Access"| DB
    MA -->|"DB_Access"| DB
    MA -->|"Media_Fetch"| Media

    %% Click Events
    click DC "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/movieProject/"
    click AA "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/accounts/"
    click MA "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/movie/"
    click FT "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/templates/"
    click SA "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/static/"
    click AS "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/assets/"
    click ML "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/Notebooks/"
    click DB "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/blob/br/db.sqlite3"
    click Media "https://github.com/highonsemicolon/sentiment-based-movie-rating-system/tree/br/media/"

    %% Styles
    classDef frontend fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef backend fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef machine fill:#c1f0c1,stroke:#333,stroke-width:2px;
    classDef database fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef external fill:#dcdcdc,stroke:#333,stroke-width:2px;
```
