# kaviprince/fake-job-posting-detector architecture

> Architecture diagram of the GitHub repository kaviprince/fake-job-posting-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaviprince/fake-job-posting-detector
- Repository: https://github.com/kaviprince/fake-job-posting-detector

## Overview

The product is a Streamlit fake-job detector: users submit posting text, a URL, or an image; the app extracts text, requests a prediction with risk and keyword indicators, and presents a downloadable report. A separate training workflow cleans labeled postings, builds TF-IDF features, and trains a classifier. The README describes Random Forest, but the sampled training code selects Logistic Regression or Naive Bayes; the checked-in model artifact’s internals were not inspected. The dataset and some training outputs are absent from the supplied tree, so their paths and uncertain wiring are left unspecified.

Main entry points: [`app.py`](https://github.com/kaviprince/fake-job-posting-detector/blob/main/app.py) (Streamlit app), [`explain.py`](https://github.com/kaviprince/fake-job-posting-detector/blob/main/explain.py) (Prediction explainer), [`preprocessing.py`](https://github.com/kaviprince/fake-job-posting-detector/blob/main/preprocessing.py) (Dataset cleaning), [`model_train.py`](https://github.com/kaviprince/fake-job-posting-detector/blob/main/model_train.py) (Classifier training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_user_flow["Detection app"]
  node_app["Streamlit app<br/>[app.py]"]
  node_report["Analysis report<br/>[app.py]"]
end

subgraph group_analysis["Prediction analysis"]
  node_explainer["Prediction explainer<br/>[explain.py]"]
  node_cleaner["Text cleaner<br/>[text_utils.py]"]
end

subgraph group_training["Model training"]
  node_preprocess["Dataset cleaning<br/>[preprocessing.py]"]
  node_raw_data["Labeled postings"]
  node_clean_data["Cleaned postings"]
  node_feature_build["Feature extraction"]
  node_trainer["Classifier training<br/>[model_train.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_vectorizer["TF-IDF vectorizer"]
  node_classifier["Classifier model<br/>[fake_job_model.pkl]"]
end

node_user(("Job seeker"))
node_job_site(("Job posting site"))
node_image_ocr["Tesseract OCR"]

node_user -->|"submits input"| node_app
node_app -.->|"fetches URL"| node_job_site
node_job_site -.->|"returns page"| node_app
node_app -.->|"extracts image text"| node_image_ocr
node_app -->|"requests prediction"| node_explainer
node_explainer -->|"cleans text"| node_cleaner
node_explainer -->|"transforms text"| node_vectorizer
node_explainer -->|"predicts probability"| node_classifier
node_app -->|"renders and offers"| node_report
node_raw_data -->|"loads postings"| node_preprocess
node_preprocess -->|"cleans fields"| node_cleaner
node_preprocess -->|"writes cleaned rows"| node_clean_data
node_clean_data -->|"loads text"| node_feature_build
node_feature_build -->|"fits and saves"| node_vectorizer
node_clean_data -->|"loads labels and text"| node_trainer
node_trainer -->|"loads for transform"| node_vectorizer
node_trainer -->|"trains and saves"| node_classifier

click node_app "https://github.com/kaviprince/fake-job-posting-detector/blob/main/app.py"
click node_report "https://github.com/kaviprince/fake-job-posting-detector/blob/main/app.py"
click node_explainer "https://github.com/kaviprince/fake-job-posting-detector/blob/main/explain.py"
click node_cleaner "https://github.com/kaviprince/fake-job-posting-detector/blob/main/text_utils.py"
click node_vectorizer "https://github.com/kaviprince/fake-job-posting-detector/blob/main/main/models/tfidf_vectorizer.pkl"
click node_classifier "https://github.com/kaviprince/fake-job-posting-detector/blob/main/main/models/fake_job_model.pkl"
click node_preprocess "https://github.com/kaviprince/fake-job-posting-detector/blob/main/preprocessing.py"
click node_feature_build "https://github.com/kaviprince/fake-job-posting-detector/blob/main/feature_extraction.py"
click node_trainer "https://github.com/kaviprince/fake-job-posting-detector/blob/main/model_train.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_app,node_report toneBlue
class node_explainer,node_cleaner toneAmber
class node_preprocess,node_raw_data,node_clean_data,node_feature_build,node_trainer toneMint
class node_vectorizer,node_classifier toneRose
class node_user,node_job_site,node_image_ocr toneIndigo
```

## Components

### Detection app

- [Streamlit app](https://github.com/kaviprince/fake-job-posting-detector/blob/main/app.py): `app.py`
- [Analysis report](https://github.com/kaviprince/fake-job-posting-detector/blob/main/app.py): `app.py`

### Prediction analysis

- [Prediction explainer](https://github.com/kaviprince/fake-job-posting-detector/blob/main/explain.py): `explain.py`
- [Text cleaner](https://github.com/kaviprince/fake-job-posting-detector/blob/main/text_utils.py): `text_utils.py`

### Model training

- [Dataset cleaning](https://github.com/kaviprince/fake-job-posting-detector/blob/main/preprocessing.py): `preprocessing.py`
- **Labeled postings**
- **Cleaned postings**
- [Feature extraction](https://github.com/kaviprince/fake-job-posting-detector/blob/main/feature_extraction.py): `feature_extraction.py`
- [Classifier training](https://github.com/kaviprince/fake-job-posting-detector/blob/main/model_train.py): `model_train.py`

### Model artifacts

- [TF-IDF vectorizer](https://github.com/kaviprince/fake-job-posting-detector/blob/main/main/models/tfidf_vectorizer.pkl): `main/models/tfidf_vectorizer.pkl`
- [Classifier model](https://github.com/kaviprince/fake-job-posting-detector/blob/main/main/models/fake_job_model.pkl): `main/models/fake_job_model.pkl`

### Other components

- **Job seeker**
- **Job posting site**
- **Tesseract OCR**

## Connections

- Job seeker → Streamlit app: submits input
- Streamlit app → Job posting site: fetches URL
- Job posting site → Streamlit app: returns page
- Streamlit app → Tesseract OCR: extracts image text
- Streamlit app → Prediction explainer: requests prediction
- Prediction explainer → Text cleaner: cleans text
- Prediction explainer → TF-IDF vectorizer: transforms text
- Prediction explainer → Classifier model: predicts probability
- Streamlit app → Analysis report: renders and offers
- Labeled postings → Dataset cleaning: loads postings
- Dataset cleaning → Text cleaner: cleans fields
- Dataset cleaning → Cleaned postings: writes cleaned rows
- Cleaned postings → Feature extraction: loads text
- Feature extraction → TF-IDF vectorizer: fits and saves
- Cleaned postings → Classifier training: loads labels and text
- Classifier training → TF-IDF vectorizer: loads for transform
- Classifier training → Classifier model: trains and saves
