# asantemaicenne/fake_job_detector architecture

> Architecture diagram of the GitHub repository asantemaicenne/fake_job_detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/asantemaicenne/fake_job_detector
- Repository: https://github.com/asantemaicenne/fake_job_detector

## Overview

The product is a Flask-based fake-job-ad checker. A user submits pasted or structured job text, an image for OCR, or a public job-post URL; the Flask handler obtains text, classifies it into a risk band, saves the analysis, and returns a result. Separate branches cover OCR and guarded URL fetching, while model training is a supporting product capability. The sampled sources show the handler’s calls and MongoDB write; the README documents the browser workflow and safety limits. Training data and model artifacts are not runtime services.

Main entry points: [`app.py`](https://github.com/asantemaicenne/fake_job_detector/blob/main/app.py) (Flask endpoints), [`templates/index.html`](https://github.com/asantemaicenne/fake_job_detector/blob/main/templates/index.html) (Checker page), [`fake_job_detector/classifier.py`](https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/classifier.py) (Risk classifier), [`train_model.py`](https://github.com/asantemaicenne/fake_job_detector/blob/main/train_model.py) (Training command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_ui["Checker page<br/>[index.html]"]
  node_web_app["Flask endpoints<br/>[app.py]"]
end

subgraph group_intake["Text intake"]
  node_text_input["Text submission<br/>[app.py]"]
  node_image_ocr["Image OCR<br/>[sources.py]"]
  node_url_fetch["URL extraction<br/>[sources.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_classifier["Risk classifier<br/>[classifier.py]"]
  node_prediction_store["Prediction store<br/>[database.py]"]
end

subgraph group_training["Model training"]
  node_training_data["Labeled jobs CSV<br/>[sample_jobs.csv]"]
  node_training_cli["Training command<br/>[train_model.py]"]
end

node_user(("Job checker"))
node_mongo[("MongoDB")]

node_user -->|"uses"| node_web_ui
node_web_ui -->|"submits checks"| node_web_app
node_web_app -->|"validates text"| node_text_input
node_web_app -->|"requests OCR"| node_image_ocr
node_web_app -->|"fetches page text"| node_url_fetch
node_web_app -->|"requests prediction"| node_classifier
node_web_app -->|"saves result"| node_prediction_store
node_prediction_store -->|"inserts prediction"| node_mongo
node_web_app -->|"returns results"| node_web_ui
node_user -->|"starts training"| node_training_cli
node_training_data -->|"provides examples"| node_training_cli
node_training_cli -->|"trains model"| node_classifier
node_classifier -->|"loads model"| node_web_app

click node_web_ui "https://github.com/asantemaicenne/fake_job_detector/blob/main/templates/index.html"
click node_web_app "https://github.com/asantemaicenne/fake_job_detector/blob/main/app.py"
click node_text_input "https://github.com/asantemaicenne/fake_job_detector/blob/main/app.py"
click node_image_ocr "https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/sources.py"
click node_url_fetch "https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/sources.py"
click node_classifier "https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/classifier.py"
click node_prediction_store "https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/database.py"
click node_training_data "https://github.com/asantemaicenne/fake_job_detector/blob/main/data/sample_jobs.csv"
click node_training_cli "https://github.com/asantemaicenne/fake_job_detector/blob/main/train_model.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_ui,node_web_app toneBlue
class node_text_input,node_image_ocr,node_url_fetch,node_mongo toneAmber
class node_classifier,node_prediction_store toneMint
class node_training_data,node_training_cli toneRose
class node_user toneIndigo
```

## Components

### Web experience

- [Checker page](https://github.com/asantemaicenne/fake_job_detector/blob/main/templates/index.html): `templates/index.html`
- [Flask endpoints](https://github.com/asantemaicenne/fake_job_detector/blob/main/app.py): `app.py`

### Text intake

- [Text submission](https://github.com/asantemaicenne/fake_job_detector/blob/main/app.py): `app.py`
- [Image OCR](https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/sources.py): `fake_job_detector/sources.py`
- [URL extraction](https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/sources.py): `fake_job_detector/sources.py`

### Risk analysis

- [Risk classifier](https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/classifier.py): `fake_job_detector/classifier.py`
- [Prediction store](https://github.com/asantemaicenne/fake_job_detector/blob/main/fake_job_detector/database.py): `fake_job_detector/database.py`

### Model training

- [Labeled jobs CSV](https://github.com/asantemaicenne/fake_job_detector/blob/main/data/sample_jobs.csv): `data/sample_jobs.csv`
- [Training command](https://github.com/asantemaicenne/fake_job_detector/blob/main/train_model.py): `train_model.py`

### Other components

- **Job checker**
- **MongoDB**

## Connections

- Job checker → Checker page: uses (evidence: `README.md`)
- Checker page → Flask endpoints: submits checks (evidence: `README.md`)
- Flask endpoints → Text submission: validates text (evidence: `app.py`)
- Flask endpoints → Image OCR: requests OCR (evidence: `app.py`)
- Flask endpoints → URL extraction: fetches page text (evidence: `app.py`)
- Flask endpoints → Risk classifier: requests prediction (evidence: `app.py`)
- Flask endpoints → Prediction store: saves result (evidence: `app.py`)
- Prediction store → MongoDB: inserts prediction (evidence: `fake_job_detector/database.py`)
- Flask endpoints → Checker page: returns results (evidence: `README.md`)
- Job checker → Training command: starts training (evidence: `README.md`)
- Labeled jobs CSV → Training command: provides examples (evidence: `README.md`)
- Training command → Risk classifier: trains model (evidence: `train_model.py`)
- Risk classifier → Flask endpoints: loads model (evidence: `app.py`)
