# ad-h/verilingo architecture

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

- Interactive diagram: https://gitdiagram.com/ad-h/verilingo
- Repository: https://github.com/ad-h/verilingo

## Overview

VeriLingo is a claim-verification application with a React workspace and FastAPI backend. Users submit text claims or an image containing a claim; image uploads are OCR-processed, then both paths retrieve and rank live-web evidence, assess support or contradiction, and return a report. The backend also persists report JSON and searchable history. The graph follows relationships shown in the provided excerpts and SOURCE INDEX; unsampled capabilities or links are omitted rather than inferred.

Main entry points: [`main.py`](https://github.com/ad-h/verilingo/blob/main/main.py) (API routes), [`web_retrieval.py`](https://github.com/ad-h/verilingo/blob/main/web_retrieval.py) (Evidence retrieval and ranking), [`frontend/src/App.jsx`](https://github.com/ad-h/verilingo/blob/main/frontend/src/App.jsx) (Verification workspace), [`web_search.py`](https://github.com/ad-h/verilingo/blob/main/web_search.py) (Web search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User workspace"]
  node_workspace["Verification workspace<br/>[App.jsx]"]
end

subgraph group_api["Verification API"]
  node_api_entry["API routes<br/>[main.py]"]
  node_ocr["Image OCR<br/>[main.py]"]
end

subgraph group_retrieval["Evidence retrieval"]
  node_query_analysis["Claim analysis<br/>[claim_analyzer.py]"]
  node_web_search["Web search<br/>[web_search.py]"]
  node_web_evidence["Evidence retrieval and ranking<br/>[web_retrieval.py]"]
  node_page_fetch["Page extraction"]
  node_chunking["Text chunking"]
end

subgraph group_assessment["Claim assessment"]
  node_verifier["Evidence assessment<br/>[demo_verifier.py]"]
end

subgraph group_persistence["Report persistence"]
  node_s3[("Report archive<br/>[s3_storage.py]")]
  node_history[("Verification history")]
end

node_user(("Investigator"))
node_aws["Amazon Web Services"]
node_search_service["Web search service"]

node_user -->|"submits claim"| node_workspace
node_workspace -->|"calls API"| node_api_entry
node_api_entry -->|"retrieves evidence"| node_web_evidence
node_api_entry -->|"assesses evidence"| node_verifier
node_api_entry -->|"extracts image text"| node_ocr
node_ocr -->|"retrieves for text"| node_web_evidence
node_web_evidence -->|"searches claim"| node_web_search
node_web_search -->|"builds queries"| node_query_analysis
node_web_search -->|"queries"| node_search_service
node_web_evidence -->|"fetches pages"| node_page_fetch
node_web_evidence -->|"chunks text"| node_chunking
node_api_entry -->|"saves report"| node_s3
node_api_entry -->|"saves metadata"| node_history
node_workspace -->|"loads history"| node_api_entry
node_api_entry -->|"reads history"| node_history
node_s3 -->|"writes object"| node_aws
node_history -->|"queries table"| node_aws

click node_workspace "https://github.com/ad-h/verilingo/blob/main/frontend/src/App.jsx"
click node_api_entry "https://github.com/ad-h/verilingo/blob/main/main.py"
click node_ocr "https://github.com/ad-h/verilingo/blob/main/main.py"
click node_query_analysis "https://github.com/ad-h/verilingo/blob/main/claim_analyzer.py"
click node_web_search "https://github.com/ad-h/verilingo/blob/main/web_search.py"
click node_web_evidence "https://github.com/ad-h/verilingo/blob/main/web_retrieval.py"
click node_page_fetch "https://github.com/ad-h/verilingo/blob/main/source_retriever.py"
click node_chunking "https://github.com/ad-h/verilingo/blob/main/document_processor.py"
click node_verifier "https://github.com/ad-h/verilingo/blob/main/demo_verifier.py"
click node_s3 "https://github.com/ad-h/verilingo/blob/main/s3_storage.py"
click node_history "https://github.com/ad-h/verilingo/blob/main/dynamodb_storage.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_workspace toneBlue
class node_api_entry,node_ocr toneAmber
class node_query_analysis,node_web_search,node_web_evidence,node_page_fetch,node_chunking toneMint
class node_verifier toneRose
class node_s3,node_history,node_user,node_aws,node_search_service toneIndigo
```

## Components

### User workspace

- [Verification workspace](https://github.com/ad-h/verilingo/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Verification API

- [API routes](https://github.com/ad-h/verilingo/blob/main/main.py): `main.py`
- [Image OCR](https://github.com/ad-h/verilingo/blob/main/main.py): `main.py`

### Evidence retrieval

- [Claim analysis](https://github.com/ad-h/verilingo/blob/main/claim_analyzer.py): `claim_analyzer.py`
- [Web search](https://github.com/ad-h/verilingo/blob/main/web_search.py): `web_search.py`
- [Evidence retrieval and ranking](https://github.com/ad-h/verilingo/blob/main/web_retrieval.py): `web_retrieval.py`
- [Page extraction](https://github.com/ad-h/verilingo/blob/main/source_retriever.py): `source_retriever.py`
- [Text chunking](https://github.com/ad-h/verilingo/blob/main/document_processor.py): `document_processor.py`

### Claim assessment

- [Evidence assessment](https://github.com/ad-h/verilingo/blob/main/demo_verifier.py): `demo_verifier.py`

### Report persistence

- [Report archive](https://github.com/ad-h/verilingo/blob/main/s3_storage.py): `s3_storage.py`
- [Verification history](https://github.com/ad-h/verilingo/blob/main/dynamodb_storage.py): `dynamodb_storage.py`

### Other components

- **Investigator**
- **Amazon Web Services**
- **Web search service**

## Connections

- Investigator → Verification workspace: submits claim (evidence: `frontend/src/App.jsx`)
- Verification workspace → API routes: calls API (evidence: `frontend/src/App.jsx`)
- API routes → Evidence retrieval and ranking: retrieves evidence (evidence: `main.py`)
- API routes → Evidence assessment: assesses evidence (evidence: `main.py`)
- API routes → Image OCR: extracts image text (evidence: `main.py`)
- Image OCR → Evidence retrieval and ranking: retrieves for text (evidence: `main.py`)
- Evidence retrieval and ranking → Web search: searches claim (evidence: `web_retrieval.py`)
- Web search → Claim analysis: builds queries (evidence: `web_search.py`)
- Web search → Web search service: queries (evidence: `web_search.py`)
- Evidence retrieval and ranking → Page extraction: fetches pages (evidence: `web_retrieval.py`)
- Evidence retrieval and ranking → Text chunking: chunks text (evidence: `web_retrieval.py`)
- API routes → Report archive: saves report (evidence: `main.py`)
- API routes → Verification history: saves metadata (evidence: `main.py`)
- Verification workspace → API routes: loads history (evidence: `frontend/src/App.jsx`)
- API routes → Verification history: reads history (evidence: `main.py`)
- Report archive → Amazon Web Services: writes object (evidence: `s3_storage.py`)
- Verification history → Amazon Web Services: queries table (evidence: `dynamodb_storage.py`)
