# sajid097141/fake-news-detection-capstone architecture

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

- Interactive diagram: https://gitdiagram.com/sajid097141/fake-news-detection-capstone
- Repository: https://github.com/sajid097141/fake-news-detection-capstone

## Overview

VERITAS is an educational news-text pattern classifier, not a fact-checker. Its primary runtime path is browser input, Flask validation, prediction through a saved scikit-learn pipeline, and display of a label with probability estimates. The repository also contains a separate WELFake data-preparation and model-development workflow, including comparison and evaluation tools. Edges reflect calls or file use shown in excerpts and documented behavior; unsampled template and styling connections are limited to what the README establishes.

Main entry points: [`webapp/app.py`](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/app.py) (Flask API), [`webapp/templates/index.html`](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/templates/index.html) (News interface), [`webapp/static/js/app.js`](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/static/js/app.js) (Form and results), [`clean_data.py`](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/clean_data.py) (Text cleaning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_browser["News interface<br/>[index.html]"]
  node_browser_logic["Form and results<br/>[app.js]"]
  node_styling["Interface styling<br/>[style.css]"]
  node_flask["Flask API<br/>[app.py]"]
end

subgraph group_inference["Prediction pipeline"]
  node_predictor["Prediction adapter<br/>[predictor.py]"]
  node_pipeline["Saved TF-IDF model"]
end

subgraph group_data["Dataset preparation"]
  node_dataset["WELFake data"]
  node_data_audit["Dataset audit<br/>[audit_data.py]"]
  node_data_inspect["Dataset inspection<br/>[inspect_data.py]"]
  node_cleaning["Text cleaning<br/>[clean_data.py]"]
  node_cleaned["Cleaned dataset"]
end

subgraph group_ml["Model development"]
  node_training["Pipeline training<br/>[train_model.py]"]
  node_comparison["Model comparison<br/>[compare_models.py]"]
  node_evaluation["Model evaluation<br/>[evaluate_model.py]"]
  node_saved_inspection["Saved model inspection"]
  node_visualization["Performance visuals<br/>[model_visuals.py]"]
end

node_user(("Article submitter"))

node_user -->|"enters article"| node_browser
node_browser -->|"handles form"| node_browser_logic
node_browser_logic -->|"POSTs prediction"| node_flask
node_flask -->|"serves interface"| node_browser
node_flask -->|"calls prediction"| node_predictor
node_predictor -->|"loads and predicts"| node_pipeline
node_flask -->|"returns result"| node_browser_logic
node_data_audit -->|"reads dataset"| node_dataset
node_data_inspect -->|"reads dataset"| node_dataset
node_cleaning -->|"reads dataset"| node_dataset
node_cleaning -->|"writes cleaned data"| node_cleaned
node_training -->|"reads training data"| node_cleaned
node_training -->|"saves trained model"| node_pipeline
node_comparison -->|"reads training data"| node_cleaned
node_evaluation -->|"reads evaluation data"| node_cleaned
node_evaluation -->|"loads model"| node_pipeline
node_saved_inspection -->|"loads model"| node_pipeline

click node_browser "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/templates/index.html"
click node_browser_logic "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/static/js/app.js"
click node_styling "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/static/css/style.css"
click node_flask "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/app.py"
click node_predictor "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/predictor.py"
click node_data_audit "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/audit_data.py"
click node_data_inspect "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/inspect_data.py"
click node_cleaning "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/clean_data.py"
click node_training "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/train_model.py"
click node_comparison "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/compare_models.py"
click node_evaluation "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/evaluate_model.py"
click node_saved_inspection "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/inspect_saved_model.py"
click node_visualization "https://github.com/sajid097141/fake-news-detection-capstone/blob/main/model_visuals.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_browser,node_browser_logic,node_styling,node_flask toneBlue
class node_predictor,node_pipeline toneAmber
class node_dataset,node_data_audit,node_data_inspect,node_cleaning,node_cleaned toneMint
class node_training,node_comparison,node_evaluation,node_saved_inspection,node_visualization toneRose
class node_user toneIndigo
```

## Components

### Web application

- [News interface](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/templates/index.html): `webapp/templates/index.html`
- [Form and results](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/static/js/app.js): `webapp/static/js/app.js`
- [Interface styling](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/static/css/style.css): `webapp/static/css/style.css`
- [Flask API](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/app.py): `webapp/app.py`

### Prediction pipeline

- [Prediction adapter](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/webapp/predictor.py): `webapp/predictor.py`
- **Saved TF-IDF model**

### Dataset preparation

- **WELFake data**
- [Dataset audit](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/audit_data.py): `audit_data.py`
- [Dataset inspection](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/inspect_data.py): `inspect_data.py`
- [Text cleaning](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/clean_data.py): `clean_data.py`
- **Cleaned dataset**

### Model development

- [Pipeline training](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/train_model.py): `train_model.py`
- [Model comparison](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/compare_models.py): `compare_models.py`
- [Model evaluation](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/evaluate_model.py): `evaluate_model.py`
- [Saved model inspection](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/inspect_saved_model.py): `inspect_saved_model.py`
- [Performance visuals](https://github.com/sajid097141/fake-news-detection-capstone/blob/main/model_visuals.py): `model_visuals.py`

### Other components

- **Article submitter**

## Connections

- Article submitter → News interface: enters article (evidence: `README.md`)
- News interface → Form and results: handles form (evidence: `README.md`)
- Form and results → Flask API: POSTs prediction (evidence: `webapp/static/js/app.js`)
- Flask API → News interface: serves interface (evidence: `README.md`)
- Flask API → Prediction adapter: calls prediction (evidence: `webapp/app.py`)
- Prediction adapter → Saved TF-IDF model: loads and predicts (evidence: `webapp/predictor.py`)
- Flask API → Form and results: returns result (evidence: `README.md`)
- Dataset audit → WELFake data: reads dataset (evidence: `audit_data.py`)
- Dataset inspection → WELFake data: reads dataset (evidence: `inspect_data.py`)
- Text cleaning → WELFake data: reads dataset (evidence: `clean_data.py`)
- Text cleaning → Cleaned dataset: writes cleaned data (evidence: `clean_data.py`)
- Pipeline training → Cleaned dataset: reads training data (evidence: `train_model.py`)
- Pipeline training → Saved TF-IDF model: saves trained model (evidence: `train_model.py`)
- Model comparison → Cleaned dataset: reads training data (evidence: `compare_models.py`)
- Model evaluation → Cleaned dataset: reads evaluation data (evidence: `evaluate_model.py`)
- Model evaluation → Saved TF-IDF model: loads model (evidence: `evaluate_model.py`)
- Saved model inspection → Saved TF-IDF model: loads model (evidence: `inspect_saved_model.py`)
