# zegdane1998/fake-news-mlops architecture

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

- Interactive diagram: https://gitdiagram.com/zegdane1998/fake-news-mlops
- Repository: https://github.com/zegdane1998/fake-news-mlops

## Overview

FakeShield is an end-to-end fake-news detection and MLOps project. Its user-facing path is a headline submitted to the dashboard, scored by the BERTweet model, and returned as a verdict; the dashboard also presents scraped-news and monitoring information. Separate operational paths collect and preprocess data, train and benchmark models, monitor drift, and support pseudo-label retraining. The README documents the broad pipeline and integrations; sampled source confirms scraper, preprocessing, prediction, monitoring, and retraining behavior, but does not expose all workflow wiring.

Main entry points: [`data`](https://github.com/zegdane1998/fake-news-mlops/tree/master/data) (Versioned datasets), [`src/app.py`](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/app.py) (Prediction and dashboard), [`src/monitor.py`](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/monitor.py) (Drift monitor), [`src/compare_retraining.py`](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/compare_retraining.py) (Retraining comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_pheme["PHEME acquisition<br/>[download_pheme.py]"]
  node_scraper["Live news scraper"]
  node_preprocess["Text preprocessing<br/>[preprocessing.py]"]
end

subgraph group_modeling["Modeling"]
  node_training["BERTweet training<br/>[train_bertweet.py]"]
  node_baselines["Model benchmarks<br/>[baselines.py]"]
  node_comparison["Retraining comparison"]
end

subgraph group_operations["Monitoring and retraining"]
  node_drift_validation["Drift validation<br/>[drift_analysis.py]"]
  node_drift_injection["Drift injection<br/>[inject_drift.py]"]
  node_monitor["Drift monitor<br/>[monitor.py]"]
  node_workflow["Automated retraining<br/>[retrain_vastai.yml]"]
end

subgraph group_serving["Serving and dashboard"]
  node_app["Prediction and dashboard<br/>[app.py]"]
  node_template["Dashboard view<br/>[index.html]"]
  node_style["Dashboard styling<br/>[style.css]"]
end

subgraph group_tracking["Experiment and version tracking"]
  node_datasets[("Versioned datasets")]
  node_artifacts[("Model artifacts")]
  node_metrics[("Metrics and drift reports")]
end

node_user(("Analyst"))
node_cloud{{"Vast.ai training"}}
node_mlflow[("MLflow tracking")]

node_pheme -->|"writes data"| node_datasets
node_scraper -->|"writes tweets"| node_datasets
node_datasets -->|"supplies data"| node_preprocess
node_preprocess -->|"writes cleaned data"| node_datasets
node_datasets -->|"supplies training data"| node_training
node_training -->|"saves model"| node_artifacts
node_training -->|"logs experiments"| node_mlflow
node_baselines -->|"tracks runs"| node_mlflow
node_baselines -->|"writes benchmark results"| node_metrics
node_artifacts -->|"provides model"| node_app
node_user -->|"submits headline"| node_app
node_app -->|"returns verdict"| node_user
node_app -->|"renders dashboard"| node_template
node_template -.->|"uses styles"| node_style
node_datasets -->|"provides live data"| node_monitor
node_artifacts -.->|"provides model"| node_monitor
node_monitor -->|"writes drift reports"| node_metrics
node_monitor -->|"triggers on drift"| node_workflow
node_workflow -->|"provisions training"| node_cloud
node_workflow -.->|"runs retraining"| node_comparison
node_comparison -->|"uses pseudo-label data"| node_datasets
node_comparison -->|"updates model"| node_artifacts
node_drift_validation -.->|"records analysis"| node_metrics
node_drift_injection -->|"runs detection"| node_monitor
node_app -->|"reads status"| node_metrics
node_datasets -->|"supplies training data"| node_comparison

click node_pheme "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/download_pheme.py"
click node_scraper "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/realtime_scraper.py"
click node_preprocess "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/preprocessing.py"
click node_training "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/train_bertweet.py"
click node_baselines "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/baselines.py"
click node_comparison "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/compare_retraining.py"
click node_drift_validation "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/drift_analysis.py"
click node_drift_injection "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/inject_drift.py"
click node_monitor "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/monitor.py"
click node_workflow "https://github.com/zegdane1998/fake-news-mlops/blob/master/.github/workflows/retrain_vastai.yml"
click node_app "https://github.com/zegdane1998/fake-news-mlops/blob/master/src/app.py"
click node_template "https://github.com/zegdane1998/fake-news-mlops/blob/master/templates/index.html"
click node_style "https://github.com/zegdane1998/fake-news-mlops/blob/master/static/style.css"
click node_datasets "https://github.com/zegdane1998/fake-news-mlops/tree/master/data"
click node_artifacts "https://github.com/zegdane1998/fake-news-mlops/tree/master/models"
click node_metrics "https://github.com/zegdane1998/fake-news-mlops/tree/master/metrics"

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_pheme,node_scraper,node_preprocess toneBlue
class node_training,node_baselines,node_comparison,node_mlflow toneAmber
class node_drift_validation,node_drift_injection,node_monitor,node_workflow toneMint
class node_app,node_template,node_style toneRose
class node_datasets,node_artifacts,node_metrics,node_user,node_cloud toneIndigo
```

## Components

### Data collection

- [PHEME acquisition](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/download_pheme.py): `src/download_pheme.py`
- [Live news scraper](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/realtime_scraper.py): `src/realtime_scraper.py`
- [Text preprocessing](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/preprocessing.py): `src/preprocessing.py`

### Modeling

- [BERTweet training](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/train_bertweet.py): `src/train_bertweet.py`
- [Model benchmarks](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/baselines.py): `src/baselines.py`
- [Retraining comparison](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/compare_retraining.py): `src/compare_retraining.py`

### Monitoring and retraining

- [Drift validation](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/drift_analysis.py): `src/drift_analysis.py`
- [Drift injection](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/inject_drift.py): `src/inject_drift.py`
- [Drift monitor](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/monitor.py): `src/monitor.py`
- [Automated retraining](https://github.com/zegdane1998/fake-news-mlops/blob/master/.github/workflows/retrain_vastai.yml): `.github/workflows/retrain_vastai.yml`

### Serving and dashboard

- [Prediction and dashboard](https://github.com/zegdane1998/fake-news-mlops/blob/master/src/app.py): `src/app.py`
- [Dashboard view](https://github.com/zegdane1998/fake-news-mlops/blob/master/templates/index.html): `templates/index.html`
- [Dashboard styling](https://github.com/zegdane1998/fake-news-mlops/blob/master/static/style.css): `static/style.css`

### Experiment and version tracking

- [Versioned datasets](https://github.com/zegdane1998/fake-news-mlops/tree/master/data): `data`
- [Model artifacts](https://github.com/zegdane1998/fake-news-mlops/tree/master/models): `models`
- [Metrics and drift reports](https://github.com/zegdane1998/fake-news-mlops/tree/master/metrics): `metrics`

### Other components

- **Analyst**
- **Vast.ai training**
- **MLflow tracking**

## Connections

- PHEME acquisition → Versioned datasets: writes data (evidence: `README.md`)
- Live news scraper → Versioned datasets: writes tweets (evidence: `src/realtime_scraper.py`)
- Versioned datasets → Text preprocessing: supplies data (evidence: `README.md`)
- Text preprocessing → Versioned datasets: writes cleaned data (evidence: `src/preprocessing.py`)
- Versioned datasets → BERTweet training: supplies training data (evidence: `src/train_bertweet.py`)
- BERTweet training → Model artifacts: saves model (evidence: `src/train_bertweet.py`)
- BERTweet training → MLflow tracking: logs experiments (evidence: `README.md`)
- Model benchmarks → MLflow tracking: tracks runs (evidence: `README.md`)
- Model benchmarks → Metrics and drift reports: writes benchmark results (evidence: `src/baselines.py`)
- Model artifacts → Prediction and dashboard: provides model (evidence: `README.md`)
- Analyst → Prediction and dashboard: submits headline (evidence: `src/app.py`)
- Prediction and dashboard → Analyst: returns verdict (evidence: `src/app.py`)
- Prediction and dashboard → Dashboard view: renders dashboard (evidence: `src/app.py`)
- Dashboard view → Dashboard styling: uses styles
- Versioned datasets → Drift monitor: provides live data (evidence: `src/monitor.py`)
- Model artifacts → Drift monitor: provides model
- Drift monitor → Metrics and drift reports: writes drift reports (evidence: `README.md`)
- Drift monitor → Automated retraining: triggers on drift (evidence: `README.md`)
- Automated retraining → Vast.ai training: provisions training (evidence: `README.md`)
- Automated retraining → Retraining comparison: runs retraining
- Retraining comparison → Versioned datasets: uses pseudo-label data (evidence: `src/compare_retraining.py`)
- Retraining comparison → Model artifacts: updates model (evidence: `README.md`)
- Drift validation → Metrics and drift reports: records analysis
- Drift injection → Drift monitor: runs detection (evidence: `src/inject_drift.py`)
- Prediction and dashboard → Metrics and drift reports: reads status (evidence: `src/app.py`)
- Versioned datasets → Retraining comparison: supplies training data (evidence: `src/compare_retraining.py`)
