# ynkcc/auto_get_jobs architecture

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

## Overview

##### Main Components
- Configuration Management: This covers the configuration files stored in the config directory (with YAML and JSON samples) and the ConfigManager module (src/utils/config_manager.py) that loads and manages these settings.
- Job Handling/Core Logic: The heart of the application revolves around job handling. This is implemented in src/job_handler.py and triggered from src/main.py. This component manages job search parameters, filtering out duplicate submissions, and managing application logic.
- AI Analysis: The AI component is responsible for generating greeting messages and assessing job-candidate compatibility. This can be found in src/utils/ai_analyzer.py.
- Session and Database Management: Managed by modules like SessionManager (src/utils/session_manager.py) and db_utils (src/utils/db_utils.py). These handle session persistence (cookie management and API sessions) and data storage/lookup using SQLite.
- MQTT/WS Client: The ws_client folder in src contains modules (like mqtt_websocket_mitmproxy.py and ws_client.py) for handling MQTT and WebSocket communications, which enables real-time messaging (e.g., heartbeats, external triggers, or further enhancements like handling resume image submissions).
- Utility Functions: General supportive functions are organized under src/utils/general.py, providing common operations.
- Testing Suite: The tests folder includes unit and integration tests that mimic various workflows (such as job detail retrieval, playwright demos, database tests, and even token bucket demos).

##### Relationships and Interactions
- The Configuration Manager initializes settings from the config files (copied from config_sample.yaml) and feeds relevant data (job parameters, API keys, etc.) to other modules.
- The Job Handler module uses these settings to construct queries, filter jobs based on search parameters (from both job_handler.py and tests), and call session utilities.
- The Session Manager and Database Utilities work together to manage network session reuse (via cookies or API sessions) and persist job data in SQLite. Note that the README even recommends a plugin (SQLite Viewer) for viewing the database.
- The AI Analyzer is invoked during the application process to generate or customize greeting messages based on job data.
- The MQTT Client (together with WebSocket patches) sends/receives external messages, integrates with the rest of the system, and in the future, is intended for functionalities beyond greeting and image resume sending.
- Testing is deeply integrated; tests simulate multiple workflows (playwright demos, async operations, parsing databases, etc.) to ensure all components interoperate correctly.

##### Architectural Patterns and Design Principles
- Modular Separation: The project is organized into clear modules for configuration, business logic (job searching and applying), utility functions, and external communication (MQTT/websockets). This separation supports maintainability and extensibility.
- Integration of External Libraries: Emphasize the use of third-party frameworks such as playwright (replacing selenium) for browser automation, SQLite for storage, and possibly Azure SDK or OpenAI’s API for AI functionalities.

##### Essential Elements
- Integration points: Lines showing how automated browser control (playwright) interacts with the main job application flow.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Configuration Layer
    subgraph "Configuration Layer"
        A1["config_sample.yaml"]:::config
        A2["search_params_config.json"]:::config
        A3["ConfigManager"]:::config
    end

    %% Core Processing Layer
    subgraph "Core Processing Layer"
        subgraph "Job Handling"
            B1["main.py"]:::core
            B2["job_handler.py"]:::core
        end
        C1["AI Analyzer (ai_analyzer.py)"]:::core
    end

    %% Session & Database Layer
    subgraph "Session & Database Layer"
        D1["Session Manager (session_manager.py)"]:::session
        D2["DB Utils (db_utils.py)"]:::session
    end

    %% External Communication Layer
    subgraph "External Communication Layer"
        E1["MQTT & WS Client"]:::mqtt
    end

    %% Support Layer
    subgraph "Support Layer"
        F1["Utility Functions (general.py)"]:::utility
    end

    %% Testing Suite
    subgraph "Testing Suite"
        G1["Testing Suite"]:::test
    end

    %% Data Flow Connections
    A1 --> A3
    A2 --> A3
    A3 -->|"provides_config"| B2
    A3 -->|"provides_config"| D1
    A3 -->|"provides_config"| C1
    B1 -->|"triggers"| B2
    C1 -->|"generates_AI"| B2
    B2 -->|"stores_data"| D2
    B2 -->|"sends_notifications"| E1
    D1 -->|"manages_session"| D2

    %% Testing interacts with components
    G1 -.->|"tests"| A3
    G1 -.->|"tests"| B2
    G1 -.->|"tests"| C1
    G1 -.->|"tests"| D1
    G1 -.->|"tests"| D2
    G1 -.->|"tests"| E1
    G1 -.->|"tests"| F1

    %% Click Events
    click A1 "https://github.com/ynkcc/auto_get_jobs/blob/main/config/config_sample.yaml"
    click A2 "https://github.com/ynkcc/auto_get_jobs/blob/main/config/search_params_config.json"
    click A3 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/utils/config_manager.py"
    click B1 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/main.py"
    click B2 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/job_handler.py"
    click C1 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/utils/ai_analyzer.py"
    click D1 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/utils/session_manager.py"
    click D2 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/utils/db_utils.py"
    click E1 "https://github.com/ynkcc/auto_get_jobs/tree/main/src/ws_client/"
    click F1 "https://github.com/ynkcc/auto_get_jobs/blob/main/src/utils/general.py"
    click G1 "https://github.com/ynkcc/auto_get_jobs/tree/main/tests/"

    %% Styles
    classDef config fill:#f9c,stroke:#333,stroke-width:2px;
    classDef core fill:#ccf,stroke:#333,stroke-width:2px;
    classDef session fill:#cfc,stroke:#333,stroke-width:2px;
    classDef mqtt fill:#fcf,stroke:#333,stroke-width:2px;
    classDef utility fill:#ffc,stroke:#333,stroke-width:2px;
    classDef test fill:#eee,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5;
```
