# chaimaebouyarmane/job-recommendation-system-ml-nlp architecture

> Architecture diagram of the GitHub repository chaimaebouyarmane/job-recommendation-system-ml-nlp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chaimaebouyarmane/job-recommendation-system-ml-nlp
- Repository: https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp

## Overview

##### Main Components
- Web Application (Frontend):
- Templates folder: Contains HTML files (index.html, index_cv.html, etc.) that render the user interface.
- Static assets: CSS (including Bootstrap and SCSS files), JavaScript, and images that style and add interactivity.
- Backend Application (Flask-based Server):
- app.py: The entry point for the Flask web application.
- Login.py, GetCvData.py, GetOffreData.py, and processing.py: Components handling requests, authentication, data retrieval, and processing.
- Machine Learning & NLP Modules:
- Models directory: Contains modules such as CV.py, OffreEmploi.py, User.py, similarityOffre.py, skills.py, plus test and training scripts.
- training.py: Script for model training.
- Database & External Services:
- README points to MongoDB for data storage (connection parameters mentioned in config.py as per instructions).
- External libraries: Spacy, Scikit-learn, BeautifulSoup for NLP/ML and data extraction.
- Supporting Files:
- requirements.txt: Lists project dependencies.
- CV directory: Stores a collection of CV PDFs used as input data.

##### Relationships and Interactions
- User Interaction:
- Users interact via the web interface (HTML pages, forms) rendered by Flask.
- Request Handling:
- The Flask server (app.py) routes user requests to specific endpoints, which may involve login, data fetching (for CVs or job offers), and recommendations.
- Data Processing:
- Upon receiving a request, the backend calls functions/scripts (e.g., processing.py and modules within Models/) that perform NLP processing and use machine learning algorithms to determine skill similarity.
- Data Storage:
- The system likely logs user data, CV information, and job offers in a MongoDB database.
- Model Training:
- The training.py script is used to train the underlying ML model that computes recommendations by analyzing the content of CVs and job offers.
- Asset Delivery:
- Static assets (CSS, JavaScript) are served to the client to ensure a responsive UI.

##### Architectural Patterns & Design Principles
- Separation of Concerns:
- The project clearly separates the user interface (templates, static assets) from the backend processing (Flask server, ML modules) and the data/modeling layer.
- MVC-Like Structure:
- Though not a strict MVC architecture, the organization suggests a division between the view (templates), controller (Flask routing, app.py, Login.py), and model (ML models in Models/).
- Modular Design:
- Individual Python modules for database connections (Connexion.py), data extraction, and similarity computation ensure each component has a focused responsibility.
- Reusability and Extensibility:
- The system could be extended by adding more ML models or additional endpoints due to its modular layout.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User (Web Browser)"]:::external

    %% Frontend/UI Layer
    subgraph "Frontend/UI"
        Templ["HTML Templates"]:::frontend
        Static["Static Assets"]:::frontend
    end

    %% Backend Application Layer
    subgraph "Backend Application"
        Flask["Flask Server (app.py)"]:::backend
        Login["Login (Login.py)"]:::backend
        CvData["CV Data Handler (GetCvData.py)"]:::backend
        OffreData["Job Offer Handler (GetOffreData.py)"]:::backend
        Proc["Processing Module (processing.py)"]:::backend
    end

    %% Machine Learning & NLP Modules
    subgraph "ML & NLP Modules"
        CVModel["CV Model (CV.py)"]:::ml
        OffreModel["Job Offer Model (OffreEmploi.py)"]:::ml
        UserModule["User Module (User.py)"]:::ml
        Similarity["Similarity Computation (similarityOffre.py)"]:::ml
        Skills["Skills Processing (skills.py)"]:::ml
        Training["Model Training (training.py)"]:::ml
    end

    %% Database & External Services
    subgraph "Database & External Services"
        DBConn["DB Connection (Connexion.py)"]:::database
        Mongo["MongoDB"]:::database
    end

    %% Supporting Files
    subgraph "Supporting Files"
        Req["Requirements (requirements.txt)"]:::support
        Doc["Project Documentation (README.md)"]:::support
        CVPd["CV PDFs (CV/)"]:::support
    end

    %% Connections
    User -->|"sendsRequest"| Templ
    User -->|"sendsRequest"| Static

    Templ -->|"requests"| Flask
    Static -->|"loads"| Flask

    Flask -->|"handles"| Login
    Flask -->|"handles"| CvData
    Flask -->|"handles"| OffreData
    Flask -->|"routesTo"| Proc

    Proc -->|"calls"| CVModel
    Proc -->|"calls"| OffreModel
    Proc -->|"calls"| UserModule
    Proc -->|"calls"| Similarity
    Proc -->|"calls"| Skills
    Proc -->|"queries"| DBConn
    DBConn -->|"accesses"| Mongo

    %% Click Events
    click Templ "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/tree/main/templates/"
    click Static "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/tree/main/Backend/static/"
    click Flask "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/app.py"
    click Login "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/Login.py"
    click CvData "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/GetCvData.py"
    click OffreData "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/GetOffreData.py"
    click Proc "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/processing.py"
    click CVModel "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/Models/CV.py"
    click OffreModel "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/Models/OffreEmploi.py"
    click UserModule "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/Models/User.py"
    click Similarity "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/Models/similarityOffre.py"
    click Skills "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/Models/skills.py"
    click Training "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/training.py"
    click DBConn "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/BD/Connexion.py"
    click Req "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/Backend/requirements.txt"
    click Doc "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/blob/main/README.md"
    click CVPd "https://github.com/chaimaebouyarmane/job-recommendation-system-ml-nlp/tree/main/CV/"

    %% Styles
    classDef external fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef frontend fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef backend fill:#a9dfbf,stroke:#333,stroke-width:2px;
    classDef ml fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef database fill:#f5b7b1,stroke:#333,stroke-width:2px;
    classDef support fill:#d7bde2,stroke:#333,stroke-width:2px;
```
