# gpaulovit/res-ia-challenge-1 architecture

> Architecture diagram of the GitHub repository gpaulovit/res-ia-challenge-1, 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/gpaulovit/res-ia-challenge-1
- Repository: https://github.com/gpaulovit/res-ia-challenge-1

## Overview

Checa Aí is a Telegram bot that helps users find existing fact-checks and see linguistic warning signals; it explicitly does not issue its own truth verdict. The main workflow runs from a submitted text or link through bot handling, the two intelligence layers, and transparent response formatting. The repository also contains dataset preparation and model-training/evaluation capabilities. Edges below use README statements or SOURCE INDEX references; unsampled runtime details are omitted where relationships cannot be verified.

Main entry points: [`src/checagens/bot.py`](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bot.py) (Bot handlers), [`src/inteligencia/busca.py`](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/busca.py) (Fact-check search), [`src/checagens/bases/treino.py`](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/treino.py) (Training dataset prep), [`src/inteligencia/classificador.py`](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/classificador.py) (Alert classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Bot experience"]
  node_botapp["Bot handlers<br/>[bot.py]"]
  node_responses["Response rules<br/>[mensagens.py]"]
  node_records[("Anonymous records<br/>[registros.py]")]
end

subgraph group_intelligence["Intelligence layers"]
  node_search["Fact-check search<br/>[busca.py]"]
  node_classifier["Alert classifier<br/>[classificador.py]"]
  node_normalization["Query normalization<br/>[normalizacao.py]"]
  node_textutils["Text utilities<br/>[texto.py]"]
  node_modeltraining["Classifier training<br/>[treino.py]"]
end

subgraph group_data["Data preparation"]
  node_trainingdata["Training dataset prep<br/>[treino.py]"]
  node_datasetsources["Dataset sources<br/>[fontes.py]"]
  node_datasettext["Dataset text cleanup<br/>[texto.py]"]
end

subgraph group_experiments["Model research"]
  node_corpora["Research corpora<br/>[corpora.py]"]
  node_cleaning["Research cleaning<br/>[limpeza.py]"]
  node_models["Model experiments<br/>[modelos.py]"]
  node_rewriting["Claim rewriting<br/>[reescrita.py]"]
end

node_user(("Telegram user"))
node_telegram(("Telegram API"))

node_user -->|"sends message"| node_telegram
node_telegram -->|"delivers updates"| node_botapp
node_botapp -->|"calls search"| node_search
node_botapp -->|"calls classifier"| node_classifier
node_botapp -->|"formats replies"| node_responses
node_botapp -->|"records consultations and votes"| node_records
node_search -->|"normalizes query"| node_normalization
node_search -->|"uses text utilities"| node_textutils
node_modeltraining -->|"trains model"| node_classifier
node_trainingdata -->|"uses source definitions"| node_datasetsources
node_trainingdata -->|"uses text processing"| node_datasettext
node_corpora -->|"imports cleaning"| node_cleaning
node_models -.->|"evaluates rewrites"| node_rewriting

click node_botapp "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bot.py"
click node_responses "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/mensagens.py"
click node_records "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/registros.py"
click node_search "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/busca.py"
click node_classifier "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/classificador.py"
click node_normalization "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/normalizacao.py"
click node_textutils "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/texto.py"
click node_modeltraining "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/treino.py"
click node_trainingdata "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/treino.py"
click node_datasetsources "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/fontes.py"
click node_datasettext "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/texto.py"
click node_corpora "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/corpora.py"
click node_cleaning "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/limpeza.py"
click node_models "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/modelos.py"
click node_rewriting "https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/reescrita.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_botapp,node_responses,node_records,node_user toneBlue
class node_search,node_classifier,node_normalization,node_textutils,node_modeltraining toneAmber
class node_trainingdata,node_datasetsources,node_datasettext,node_telegram toneMint
class node_corpora,node_cleaning,node_models,node_rewriting toneRose
```

## Components

### Bot experience

- [Bot handlers](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bot.py): `src/checagens/bot.py`
- [Response rules](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/mensagens.py): `src/checagens/mensagens.py`
- [Anonymous records](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/registros.py): `src/checagens/registros.py`

### Intelligence layers

- [Fact-check search](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/busca.py): `src/inteligencia/busca.py`
- [Alert classifier](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/classificador.py): `src/inteligencia/classificador.py`
- [Query normalization](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/normalizacao.py): `src/inteligencia/normalizacao.py`
- [Text utilities](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/texto.py): `src/inteligencia/texto.py`
- [Classifier training](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/inteligencia/treino.py): `src/inteligencia/treino.py`

### Data preparation

- [Training dataset prep](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/treino.py): `src/checagens/bases/treino.py`
- [Dataset sources](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/fontes.py): `src/checagens/bases/fontes.py`
- [Dataset text cleanup](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/src/checagens/bases/texto.py): `src/checagens/bases/texto.py`

### Model research

- [Research corpora](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/corpora.py): `experiments/corpora.py`
- [Research cleaning](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/limpeza.py): `experiments/limpeza.py`
- [Model experiments](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/modelos.py): `experiments/modelos.py`
- [Claim rewriting](https://github.com/gpaulovit/res-ia-challenge-1/blob/main/experiments/reescrita.py): `experiments/reescrita.py`

### Other components

- **Telegram user**
- **Telegram API**

## Connections

- Telegram user → Telegram API: sends message (evidence: `README.md`)
- Telegram API → Bot handlers: delivers updates (evidence: `README.md`)
- Bot handlers → Fact-check search: calls search (evidence: `README.md`)
- Bot handlers → Alert classifier: calls classifier (evidence: `README.md`)
- Bot handlers → Response rules: formats replies (evidence: `README.md`)
- Bot handlers → Anonymous records: records consultations and votes (evidence: `src/checagens/bot.py`)
- Fact-check search → Query normalization: normalizes query (evidence: `src/inteligencia/busca.py`)
- Fact-check search → Text utilities: uses text utilities (evidence: `src/inteligencia/busca.py`)
- Classifier training → Alert classifier: trains model (evidence: `src/inteligencia/treino.py`)
- Training dataset prep → Dataset sources: uses source definitions (evidence: `src/checagens/bases/treino.py`)
- Training dataset prep → Dataset text cleanup: uses text processing (evidence: `src/checagens/bases/treino.py`)
- Research corpora → Research cleaning: imports cleaning (evidence: `experiments/corpora.py`)
- Model experiments → Claim rewriting: evaluates rewrites
