# khoacao2k4/jobswipe architecture

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

- Interactive diagram: https://gitdiagram.com/khoacao2k4/jobswipe
- Repository: https://github.com/khoacao2k4/jobswipe

## Overview

##### Main Components
- User Interface (UI): The front-end is built using Streamlit (as mentioned in the README). This is most likely driven through main.py and provides the interactive job-swiping experience.
- AI Matching Engine: This involves multiple AI models as seen in the “model” directory. Specifically, modules like jdsrec.py and jobsrec.py implement the smart matching logic for job recommendations. The related_skills.csv file likely provides data for feature enrichment or matching criteria.
- Configuration and Constants: The constants.py file holds configurations or constant values used across the project.
- Data Schemas: The schema.py file is used to structure and validate data, ensuring that job and candidate information meet the required formats.
- Testing Components: test.py and testdb.py indicate that there are unit/integration tests as well as some database-related tests (or mock data setups) to validate the system.

##### Relationships and Interactions
- The UI component (Streamlit interface) located in main.py acts as the entry point, accepting user input (swipes, job search queries) and displaying matched job recommendations.
- Once a user interacts with the UI, main.py routes the job matching requests to the relevant AI model components (jdsrec and jobsrec) contained within the model/ directory.
- The AI models likely use supporting data – for example, related_skills.csv – along with any constants and configuration from constants.py to compute recommendations accurately.
- schema.py may be used at various stages to confirm that incoming data or processed results are in the expected format, ensuring data integrity.
- Testing files (test.py, testdb.py) help ensure that the integration between the UI, AI matching components, and any related data operations are functioning as expected.

##### Architectural Patterns and Design Principles
- Modular Structure: The separation into different files and modules (for the UI, AI models, schemas, and tests) reveals a clean modular design.
- Separation of Concerns: Each module (interface, matching engine, configuration, tests) focuses on a single aspect of the application.
- Extensibility: The clear division between job recommendation models (multiple algorithms in the “model” directory) indicates that the system is designed for comparing and possibly switching between different AI models to balance accuracy with performance.

##### Extra Detail for a Full Picture
- Lay out the user journey: from the Streamlit-based main.py interface receiving user inputs, then passing these inputs to the recommendation modules (AI Matching Engine), which in turn may reference supporting data and configuration before producing a result that’s sent back to be displayed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction Layer
    subgraph "User Interaction"
        UI["Frontend/UI (Streamlit Interface)"]:::frontend
    end

    %% Processing Layer
    subgraph "Processing Layer"
        %% AI Matching Engine Subgraph
        subgraph "AI Matching Engine"
            JDS["jdsrec.py"]:::ai
            JOBS["jobsrec.py"]:::ai
        end
        %% Data Sources & Configuration Subgraph
        subgraph "Data Sources & Configuration"
            CONST["constants.py"]:::data
            SKILLS["related_skills.csv"]:::data
        end
        %% Schema Validator
        SCHEMA["schema.py"]:::schema
    end

    %% Testing Modules Subgraph at the bottom
    subgraph "Testing Modules"
        TEST1["test.py"]:::test
        TEST2["testdb.py"]:::test
    end

    %% Data Flow Connections
    UI -->|"submits-swipe"| JDS
    UI -->|"submits-swipe"| JOBS

    %% AI Matching Engine accesses Data Sources
    JDS -- "fetchesData" --> CONST
    JDS -- "fetchesData" --> SKILLS
    JOBS -- "fetchesData" --> SKILLS
    JOBS -- "fetchesData" --> CONST

    %% AI modules send data for validation
    JDS -->|"validatesData"| SCHEMA
    JOBS -->|"validatesData"| SCHEMA

    %% Schema returns processed recommendations to UI
    SCHEMA -->|"returnsRecos"| UI

    %% Testing Modules interactions (dashed connections)
    TEST1 --- UI
    TEST1 --- JDS
    TEST1 --- SCHEMA
    TEST2 --- CONST
    TEST2 --- SKILLS

    %% Click Events
    click UI "https://github.com/khoacao2k4/jobswipe/blob/main/main.py"
    click JDS "https://github.com/khoacao2k4/jobswipe/blob/main/model/jdsrec.py"
    click JOBS "https://github.com/khoacao2k4/jobswipe/blob/main/model/jobsrec.py"
    click CONST "https://github.com/khoacao2k4/jobswipe/blob/main/constants.py"
    click SKILLS "https://github.com/khoacao2k4/jobswipe/blob/main/model/related_skills.csv"
    click SCHEMA "https://github.com/khoacao2k4/jobswipe/blob/main/schema.py"
    click TEST1 "https://github.com/khoacao2k4/jobswipe/blob/main/test.py"
    click TEST2 "https://github.com/khoacao2k4/jobswipe/blob/main/testdb.py"

    %% Styles
    classDef frontend fill:#B3E5FC,stroke:#0277BD,stroke-width:2px,color:#000;
    classDef ai fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px,color:#000;
    classDef data fill:#FFECB3,stroke:#FBC02D,stroke-width:2px,color:#000;
    classDef schema fill:#D1C4E9,stroke:#512DA8,stroke-width:2px,color:#000;
    classDef test fill:#FFCDD2,stroke:#C62828,stroke-width:2px,color:#000;
```
