# woolball/job-catcher architecture

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

- Interactive diagram: https://gitdiagram.com/woolball/job-catcher
- Repository: https://github.com/woolball/job-catcher

## Overview

##### Project Type and Purpose
- Job Catcher is a full-stack web application that serves as a job aggregator and matching platform. Its primary function is to retrieve job postings using different fetchers (e.g., a custom scraper or the JSearch API) and then re-rank them using various matching strategies (semantic similarity, TF-IDF, keyword scoring).
- The README emphasizes that the application deals with job retrieval, ranking, and display via a web interface, along with supporting backend components like rate limiting via Redis and storage of results in CSV files.

##### Main Components
a. Web Interface (Frontend)
- The “templates” folder holds HTML files (e.g., home.html) and the “static” directory contains assets (JavaScript and CSS). These represent the presentation layer through which users interact with the application via their browser.
b. Application Server (Backend)
- The “app.py” file is the main Flask application serving as the HTTP server.
- The “config.py” file, environment variables (from the .env instructions), and the Procfile (for deployment) are configuration elements.
c. Business Logic Layer
- Inside the “src/” directory:
- "src/fetchers" – Contains modules such as “scraper.py”, “jsearch.py” responsible for retrieving job postings from external sources.
- "src/ranking.py" – Contains the logic to rerank the job listings using various scoring methods.
- "src/utils.py" – Contains helper functions.
d. External Services and Dependencies
- Redis: Used for managing API rate limiting.
- External APIs: Google’s job search API and the JSearch service (for which the user must supply an API key) via the respective fetchers.
- CSV Storage: Results are stored in a CSV file under the “data/” directory; although it is created at runtime, it’s part of the data persistence.
e. Tests
- The “tests/” directory includes end-to-end, integration, and unit tests highlighting the layered testing strategy covering different aspects of the application.

##### Interactions and Relationships
- The application server (Flask) internally invokes the business logic layers:
- It calls functions in “src/fetchers” to retrieve job postings.
- It passes retrieved data to “src/ranking” for combining semantic, TF-IDF, and keyword scoring.
- It may then store or log results (in CSV under the “data/” directory) and eventually render the processed results via templates.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly differentiate between the presentation, business logic (fetchers and ranking), and auxiliary components (like Redis and CSV persistence).
- Modularity: Emphasize how the “fetchers” directory supports multiple job retrieval methods, making the system easily extensible to add new scrapers or API integrations.
- Configurability: Highlight the importance of the .env and config.py files in managing environment-specific parameters such as API keys, rate limits, and fetcher selection.

##### Relevant Technologies and Frameworks
- Flask as the web application framework.
- Python for the business logic.
- Redis for rate limiting.
- Frontend technologies: HTML (templates), CSS, and JavaScript (static assets).
- External libraries (e.g., SentenceTransformers) for semantic similarity computations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        client["Client (Browser)"]:::client
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        templates["Templates"]:::frontend
        static["Static Assets"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        flask["Flask Server"]:::backend
        config["Configuration"]:::backend
        procfile["Deployment Config"]:::backend
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        fetchers["Job Fetchers"]:::logic
        ranking["Ranking Module"]:::logic
        utils["Utilities Module"]:::logic
    end

    %% External Services
    subgraph "External Services"
        redis["Redis"]:::external
        externalAPI["External API: JSearch"]:::external
        csv["CSV Storage"]:::external
    end

    %% Testing
    subgraph "Testing"
        tests["Tests"]:::tests
    end

    %% Relationships
    client -->|"HTTP_Request"| flask
    flask -->|"Render_HTML"| templates
    flask -->|"Load_Assets"| static
    flask -->|"Load_Config"| config
    config -->|"Deployment"| procfile
    flask -->|"Fetch_Job_Data"| fetchers
    fetchers -->|"Call_API"| externalAPI
    flask -->|"Compute_Ranking"| ranking
    ranking -->|"Store_Results"| csv
    flask -->|"Rate_Limit"| redis
    redis -->|"Throttle_Info"| flask
    fetchers -->|"Utilize"| utils
    ranking -->|"Utilize"| utils
    tests ---|"Test_Target"| flask
    tests ---|"Test_Target"| fetchers
    tests ---|"Test_Target"| ranking

    %% Click Events
    click templates "https://github.com/woolball/job-catcher/blob/master/templates/home.html"
    click static "https://github.com/woolball/job-catcher/tree/master/static/"
    click flask "https://github.com/woolball/job-catcher/blob/master/app.py"
    click config "https://github.com/woolball/job-catcher/blob/master/config.py"
    click procfile "https://github.com/woolball/job-catcher/tree/master/Procfile"
    click fetchers "https://github.com/woolball/job-catcher/tree/master/src/fetchers/"
    click ranking "https://github.com/woolball/job-catcher/blob/master/src/ranking.py"
    click utils "https://github.com/woolball/job-catcher/blob/master/src/utils.py"
    click tests "https://github.com/woolball/job-catcher/tree/master/tests/"

    %% Styles
    classDef client fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef frontend fill:#c4f0ff,stroke:#333,stroke-width:2px;
    classDef backend fill:#ffd1dc,stroke:#333,stroke-width:2px;
    classDef logic fill:#d1ffd1,stroke:#333,stroke-width:2px;
    classDef external fill:#fceabb,stroke:#333,stroke-width:2px;
    classDef tests fill:#e0e0e0,stroke:#333,stroke-width:2px;
```
