# prayesh13/lms architecture

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

## Overview

##### Main Components
- Web Frontend: Represented by the HTML templates (in the templates directory) and CSS styles (in the static directory). This includes the primary views such as homepage, contact, about, course recommendation pages, roadmaps, etc.
- Flask Application (Backend): The central controller is app.py. It manages HTTP requests, routes, and integrates the recommendation logic.
- Recommendation Logic Components: These include:
- recomm_udemy.py: Module handling Udemy course recommendations.
- recommendation_skills_coursera.py: Module handling Coursera recommendations.
- Machine Learning Models: The models in the models directory (skills_matrix.pkl and tfidf_vectorizer.pkl) are used by the recommendation modules to filter and match courses to user skills.
- Data Sources:
- CSV datasets in the data folder (e.g., Coursera.csv, Coursera_cleaned.csv, Udemy_cleaned.csv, and udemy_online_education_courses_dataset.csv).
- Database file (lms_portal.db) which may store user data or course info for dynamic interactions.
- Development and Analysis: Notebooks (in the notebooks folder) that were used for exploration and model development.

##### Relationships and Interactions
- Users interact with the Frontend (web pages) to provide their skills or course preferences.
- The web interface sends this input to the Flask backend (app.py) which acts as the router.
- app.py then invokes the appropriate recommendation module (either recomm_udemy.py or recommendation_skills_coursera.py) based on user interaction.
- These modules access the pre-trained models in the models directory (using the skills_matrix and TF-IDF vectorizer) to process the input and find relevant courses.
- The system also pulls data from CSV files and possibly interacts with the database (lms_portal.db) as required.
- Finally, the recommendation results are rendered back into the web pages for user consumption.

##### Architectural Patterns/Design Principles
- Separation of Concerns: Clearly dividing the user interface (HTML, CSS/Bootstrap), application logic (Flask routing in app.py), and the recommendation engine (separate modules for each course provider) ensures maintainability.
- MVC-like Pattern: The templates act as the View, app.py operates as the Controller, and the recommendation modules/models serve as the Model.
- Dependency Injection and Modular Design: With distinct modules handling specific tasks (e.g., separate files for each course recommendation), future extensions or modifications become easier.
- Use of Pre-trained Models: Incorporating pkl files implies that part of the architecture leverages machine learning for filtering and extracting course relevancy from textual data.

##### Relevant Technologies
- Python/Flask: Central to the web service.
- Pandas and Scikit-learn: For data processing and machine learning respectively.
- Jupyter: Used for development and exploratory data analysis (notebooks).
- SQLite: Likely used as the backend database (lms_portal.db).

##### Elements
- Use clear, descriptive labels: "User Interface", "Flask Server", "Recommendation Engine – Udemy", "Recommendation Engine – Coursera", "ML Models", "Data Sources", etc.
- Interactions explicitly (e.g., show that the model files are loaded by the recommendation modules, and that the Flask app routes request responses to the templates).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    U("User"):::user

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE1("HTML Templates"):::frontend
        FE2("CSS Styles"):::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE("Flask Server (app.py)"):::backend
        subgraph "Recommendation Engines"
            RE1("Udemy Engine (recomm_udemy.py)"):::engine
            RE2("Coursera Engine (recommendation_skills_coursera.py)"):::engine
        end
    end

    %% Data & ML Layer
    subgraph "Data & ML Layer"
        ML("ML Models (models/)"):::data
        DS1("CSV Data (data/)"):::data
        DS2("Database (lms_portal.db)"):::data
    end

    %% Development Layer
    subgraph "Development Layer"
        DEV("Notebooks (notebooks/)"):::dev
    end

    %% Data Flow Connections
    U -->|"requests"| FE1
    FE1 -->|"sends input"| BE
    BE -->|"invokes"| RE1
    BE -->|"invokes"| RE2
    RE1 -->|"loads models"| ML
    RE1 -->|"accesses"| DS1
    RE1 -->|"queries"| DS2
    RE2 -->|"loads models"| ML
    RE2 -->|"accesses"| DS1
    RE2 -->|"queries"| DS2
    RE1 -->|"returns results"| BE
    RE2 -->|"returns results"| BE
    BE -->|"renders response"| FE1
    FE1 -->|"delivers to"| U

    %% Internal Frontend Relationship
    FE1 -->|"uses"| FE2

    %% Notebooks influence on ML Models
    DEV -->|"model tuning"| ML

    %% Click Events for Frontend
    click FE1 "https://github.com/prayesh13/lms/tree/master/templates/"
    click FE2 "https://github.com/prayesh13/lms/blob/master/static/styles.css"

    %% Click Events for Backend
    click BE "https://github.com/prayesh13/lms/blob/master/app.py"

    %% Click Events for Recommendation Engines
    click RE1 "https://github.com/prayesh13/lms/blob/master/recomm_udemy.py"
    click RE2 "https://github.com/prayesh13/lms/blob/master/recommendation_skills_coursera.py"

    %% Click Events for ML Models
    click ML "https://github.com/prayesh13/lms/tree/master/models/"

    %% Click Events for Data Sources
    click DS1 "https://github.com/prayesh13/lms/tree/master/data/"
    click DS2 "https://github.com/prayesh13/lms/blob/master/lms_portal.db"

    %% Click Event for Notebooks
    click DEV "https://github.com/prayesh13/lms/tree/master/notebooks/"

    %% Styles
    classDef user fill:#FFEDB3,stroke:#333,stroke-width:2px;
    classDef frontend fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef backend fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef engine fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef data fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef dev fill:#C0C0C0,stroke:#333,stroke-width:2px;
```
