# marianassimion/challenge-desinformacao architecture

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

- Interactive diagram: https://gitdiagram.com/marianassimion/challenge-desinformacao
- Repository: https://github.com/marianassimion/challenge-desinformacao

## Overview

Fake News Detector combines a Telegram-facing service and a FastAPI prediction endpoint. Users submit text or a news URL; the API extracts URL content when needed, validates the input, fuses semantic and stylometric features, and returns a classification with confidence and metrics. The Telegram bot can additionally search trusted news sources for corroboration. A separate training path unifies labeled datasets, extracts features, trains a classifier, and saves a model. The graph follows documented and excerpted links; deployment details and unsampled integrations are not expanded.

Main entry points: [`src/fakenews/api/app.py`](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/api/app.py) (Prediction API), [`src/fakenews/training/hybrid_model.py`](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/training/hybrid_model.py) (Hybrid trainer), [`src/bot.py`](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/bot.py) (Telegram bot), [`src/fakenews/core/model_manager.py`](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/model_manager.py) (Model manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_bot["Telegram bot<br/>[bot.py]"]
  node_api["Prediction API<br/>[app.py]"]
end

subgraph group_inference["Prediction pipeline"]
  node_scraper["Article extraction<br/>[scraper.py]"]
  node_features["Feature extraction<br/>[features.py]"]
  node_manager["Model manager<br/>[model_manager.py]"]
  node_config["Model configuration<br/>[config.py]"]
  node_classifier["Trained classifier"]
end

subgraph group_training["Model training"]
  node_trainer["Hybrid trainer<br/>[hybrid_model.py]"]
  node_loader["Dataset loader<br/>[dataloader.py]"]
  node_datasets[("Training datasets")]
end

subgraph group_verification["Source verification"]
  node_factcheck["Trusted-source search<br/>[fact_checker.py]"]
end

node_user(("News submitter"))
node_telegram(("Telegram"))
node_newsweb(("News search"))

node_user -->|"submits news"| node_telegram
node_telegram -->|"delivers messages"| node_bot
node_bot -->|"posts text or URL"| node_api
node_user -.->|"submits news"| node_api
node_api -->|"extracts URL"| node_scraper
node_api -->|"extracts features"| node_features
node_api -->|"loads prediction model"| node_manager
node_features -->|"reuses loaded models"| node_manager
node_manager -->|"reads model settings"| node_config
node_manager -->|"loads classifier"| node_classifier
node_api -->|"returns prediction"| node_bot
node_bot -->|"searches sources"| node_factcheck
node_factcheck -->|"queries RSS"| node_newsweb
node_trainer -->|"loads datasets"| node_loader
node_loader -->|"reads labeled data"| node_datasets
node_trainer -->|"extracts training features"| node_features
node_trainer -->|"reads training settings"| node_config
node_trainer -->|"saves classifier"| node_classifier

click node_bot "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/bot.py"
click node_api "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/api/app.py"
click node_scraper "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/processing/scraper.py"
click node_features "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/features.py"
click node_manager "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/model_manager.py"
click node_config "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/config.py"
click node_classifier "https://github.com/marianassimion/challenge-desinformacao/tree/main/models"
click node_trainer "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/training/hybrid_model.py"
click node_loader "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/processing/dataloader.py"
click node_datasets "https://github.com/marianassimion/challenge-desinformacao/tree/main/data"
click node_factcheck "https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/processing/fact_checker.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_bot,node_api toneBlue
class node_scraper,node_features,node_manager,node_config,node_classifier toneAmber
class node_trainer,node_loader,node_datasets toneMint
class node_factcheck toneRose
class node_user,node_telegram,node_newsweb toneIndigo
```

## Components

### User interfaces

- [Telegram bot](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/bot.py): `src/bot.py`
- [Prediction API](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/api/app.py): `src/fakenews/api/app.py`

### Prediction pipeline

- [Article extraction](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/processing/scraper.py): `src/fakenews/processing/scraper.py`
- [Feature extraction](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/features.py): `src/fakenews/core/features.py`
- [Model manager](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/model_manager.py): `src/fakenews/core/model_manager.py`
- [Model configuration](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/core/config.py): `src/fakenews/core/config.py`
- [Trained classifier](https://github.com/marianassimion/challenge-desinformacao/tree/main/models): `models`

### Model training

- [Hybrid trainer](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/training/hybrid_model.py): `src/fakenews/training/hybrid_model.py`
- [Dataset loader](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/processing/dataloader.py): `src/fakenews/processing/dataloader.py`
- [Training datasets](https://github.com/marianassimion/challenge-desinformacao/tree/main/data): `data`

### Source verification

- [Trusted-source search](https://github.com/marianassimion/challenge-desinformacao/blob/main/src/fakenews/processing/fact_checker.py): `src/fakenews/processing/fact_checker.py`

### Other components

- **News submitter**
- **Telegram**
- **News search**

## Connections

- News submitter → Telegram: submits news
- Telegram → Telegram bot: delivers messages (evidence: `src/bot.py`)
- Telegram bot → Prediction API: posts text or URL (evidence: `src/bot.py`)
- News submitter → Prediction API: submits news
- Prediction API → Article extraction: extracts URL (evidence: `src/fakenews/api/app.py`)
- Prediction API → Feature extraction: extracts features (evidence: `src/fakenews/api/app.py`)
- Prediction API → Model manager: loads prediction model (evidence: `src/fakenews/api/app.py`)
- Feature extraction → Model manager: reuses loaded models (evidence: `src/fakenews/core/features.py`)
- Model manager → Model configuration: reads model settings (evidence: `src/fakenews/core/model_manager.py`)
- Model manager → Trained classifier: loads classifier (evidence: `src/fakenews/core/model_manager.py`)
- Prediction API → Telegram bot: returns prediction (evidence: `src/bot.py`)
- Telegram bot → Trusted-source search: searches sources (evidence: `src/bot.py`)
- Trusted-source search → News search: queries RSS (evidence: `src/fakenews/processing/fact_checker.py`)
- Hybrid trainer → Dataset loader: loads datasets (evidence: `src/fakenews/training/hybrid_model.py`)
- Dataset loader → Training datasets: reads labeled data (evidence: `src/fakenews/processing/dataloader.py`)
- Hybrid trainer → Feature extraction: extracts training features (evidence: `src/fakenews/training/hybrid_model.py`)
- Hybrid trainer → Model configuration: reads training settings (evidence: `src/fakenews/training/hybrid_model.py`)
- Hybrid trainer → Trained classifier: saves classifier (evidence: `src/fakenews/training/hybrid_model.py`)
