# tanushg07/citeguard architecture

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

- Interactive diagram: https://gitdiagram.com/tanushg07/citeguard
- Repository: https://github.com/tanushg07/citeguard

## Overview

CiteGuard is a research-citation verification application: a user submits a paper, then reviews citation-by-citation judgments traced to passages from identified sources. The documented workflow parses the whole paper, associates sentence-local claims with references, checks source identity, retrieves and reranks source passages, applies NLI and numerical checks, and produces a report with JSON/CSV export. The graph also includes the frontend, job/report API, and evaluation capability. Detailed stage links follow the README; some internal calls are only established by the orchestrator’s imports, so unsampled implementation details are not expanded.

Main entry points: [`app/services/orchestrator.py`](https://github.com/tanushg07/citeguard/blob/main/app/services/orchestrator.py) (Pipeline orchestrator), [`app/services/verifier.py`](https://github.com/tanushg07/citeguard/blob/main/app/services/verifier.py) (Claim verification), [`app/api/routes.py`](https://github.com/tanushg07/citeguard/blob/main/app/api/routes.py) (Job and report API), [`citeguard-frontend/src/services/api.ts`](https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/services/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webapp["CiteGuard UI<br/>[App.tsx]"]
  node_submission["Upload and progress<br/>[ProcessingView.tsx]"]
  node_resultsview["Results dashboard<br/>[DashboardView.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_intake["Paper and claims"]
  node_parser["Document structure parser<br/>[document_parser.py]"]
  node_extractor["Claim and citation extraction<br/>[extractor.py]"]
  node_pipeline["Pipeline orchestrator<br/>[orchestrator.py]"]
end

subgraph group_sources["Source discovery"]
  node_metadata["Bibliography enrichment"]
  node_crossref["Crossref enrichment"]
  node_resolver["Source identity resolver<br/>[source_resolver.py]"]
  node_downloader["PDF retrieval and cache<br/>[downloader.py]"]
end

subgraph group_verification["Evidence and decisions"]
  node_retriever["Passage retrieval and reranking<br/>[retriever.py]"]
  node_verifier["Claim verification<br/>[verifier.py]"]
  node_nli["NLI model<br/>[nli_verifier.py]"]
  node_numerical["Numerical checks<br/>[numerical.py]"]
end

subgraph group_reports["Reports and evaluation"]
  node_api["Job and report API<br/>[routes.py]"]
  node_schemas["Analysis schemas<br/>[schemas.py]"]
  node_report[("Persisted report and exports<br/>[models.py]")]
  node_evaluation["Evaluation metrics<br/>[evaluator.py]"]
end

node_user(("Researcher"))
node_scholarly(("Scholarly metadata services"))
node_public_pdfs(("Public source PDFs"))
node_groq(("Optional Groq explanations"))

node_user -->|"submits paper"| node_webapp
node_webapp -->|"opens analysis"| node_submission
node_submission -->|"requests analysis"| node_api_client
node_api_client -->|"calls API"| node_api
node_api -->|"runs job"| node_pipeline
node_pipeline -->|"parses document"| node_parser
node_parser -->|"splits sentences"| node_extractor
node_pipeline -->|"extracts claims"| node_extractor
node_pipeline -->|"resolves references"| node_resolver
node_resolver -->|"checks identity"| node_metadata
node_metadata -->|"enriches metadata"| node_crossref
node_metadata -->|"queries providers"| node_scholarly
node_resolver -->|"retrieves PDFs"| node_downloader
node_downloader -->|"fetches source"| node_public_pdfs
node_pipeline -->|"retrieves evidence"| node_retriever
node_retriever -->|"provides passages"| node_verifier
node_pipeline -->|"verifies claims"| node_verifier
node_verifier -->|"checks entailment"| node_nli
node_verifier -->|"checks quantities"| node_numerical
node_verifier -.->|"requests explanations"| node_groq
node_pipeline -->|"builds results"| node_report
node_api -->|"persists and exports"| node_report
node_api_client -->|"loads results"| node_resultsview
node_resultsview -->|"shows judgments"| node_user
node_api -.->|"validates responses"| node_schemas
node_evaluation -->|"evaluates outputs"| node_pipeline
node_api_client -->|"requests metrics"| node_api

click node_webapp "https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/App.tsx"
click node_submission "https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/components/ProcessingView.tsx"
click node_resultsview "https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/components/DashboardView.tsx"
click node_api_client "https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/services/api.ts"
click node_api "https://github.com/tanushg07/citeguard/blob/main/app/api/routes.py"
click node_schemas "https://github.com/tanushg07/citeguard/blob/main/app/core/schemas.py"
click node_parser "https://github.com/tanushg07/citeguard/blob/main/app/services/document_parser.py"
click node_extractor "https://github.com/tanushg07/citeguard/blob/main/app/services/extractor.py"
click node_pipeline "https://github.com/tanushg07/citeguard/blob/main/app/services/orchestrator.py"
click node_metadata "https://github.com/tanushg07/citeguard/blob/main/app/services/reference_metadata.py"
click node_crossref "https://github.com/tanushg07/citeguard/blob/main/backend/modules/citation_extractor.py"
click node_resolver "https://github.com/tanushg07/citeguard/blob/main/app/services/source_resolver.py"
click node_downloader "https://github.com/tanushg07/citeguard/blob/main/app/services/downloader.py"
click node_retriever "https://github.com/tanushg07/citeguard/blob/main/app/services/retriever.py"
click node_verifier "https://github.com/tanushg07/citeguard/blob/main/app/services/verifier.py"
click node_nli "https://github.com/tanushg07/citeguard/blob/main/backend/modules/nli_verifier.py"
click node_numerical "https://github.com/tanushg07/citeguard/blob/main/app/services/numerical.py"
click node_report "https://github.com/tanushg07/citeguard/blob/main/app/core/models.py"
click node_evaluation "https://github.com/tanushg07/citeguard/blob/main/app/evaluation/evaluator.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_webapp,node_submission,node_resultsview,node_api_client toneBlue
class node_parser,node_extractor,node_pipeline toneAmber
class node_metadata,node_crossref,node_resolver,node_downloader toneMint
class node_retriever,node_verifier,node_nli,node_numerical toneRose
class node_api,node_schemas,node_report,node_evaluation,node_user,node_scholarly,node_public_pdfs,node_groq toneIndigo
```

## Components

### User interface

- [CiteGuard UI](https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/App.tsx): `citeguard-frontend/src/App.tsx`
- [Upload and progress](https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/components/ProcessingView.tsx): `citeguard-frontend/src/components/ProcessingView.tsx`
- [Results dashboard](https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/components/DashboardView.tsx): `citeguard-frontend/src/components/DashboardView.tsx`
- [API client](https://github.com/tanushg07/citeguard/blob/main/citeguard-frontend/src/services/api.ts): `citeguard-frontend/src/services/api.ts`

### Paper and claims

- [Document structure parser](https://github.com/tanushg07/citeguard/blob/main/app/services/document_parser.py): `app/services/document_parser.py`
- [Claim and citation extraction](https://github.com/tanushg07/citeguard/blob/main/app/services/extractor.py): `app/services/extractor.py`
- [Pipeline orchestrator](https://github.com/tanushg07/citeguard/blob/main/app/services/orchestrator.py): `app/services/orchestrator.py`

### Source discovery

- [Bibliography enrichment](https://github.com/tanushg07/citeguard/blob/main/app/services/reference_metadata.py): `app/services/reference_metadata.py`
- [Crossref enrichment](https://github.com/tanushg07/citeguard/blob/main/backend/modules/citation_extractor.py): `backend/modules/citation_extractor.py`
- [Source identity resolver](https://github.com/tanushg07/citeguard/blob/main/app/services/source_resolver.py): `app/services/source_resolver.py`
- [PDF retrieval and cache](https://github.com/tanushg07/citeguard/blob/main/app/services/downloader.py): `app/services/downloader.py`

### Evidence and decisions

- [Passage retrieval and reranking](https://github.com/tanushg07/citeguard/blob/main/app/services/retriever.py): `app/services/retriever.py`
- [Claim verification](https://github.com/tanushg07/citeguard/blob/main/app/services/verifier.py): `app/services/verifier.py`
- [NLI model](https://github.com/tanushg07/citeguard/blob/main/backend/modules/nli_verifier.py): `backend/modules/nli_verifier.py`
- [Numerical checks](https://github.com/tanushg07/citeguard/blob/main/app/services/numerical.py): `app/services/numerical.py`

### Reports and evaluation

- [Job and report API](https://github.com/tanushg07/citeguard/blob/main/app/api/routes.py): `app/api/routes.py`
- [Analysis schemas](https://github.com/tanushg07/citeguard/blob/main/app/core/schemas.py): `app/core/schemas.py`
- [Persisted report and exports](https://github.com/tanushg07/citeguard/blob/main/app/core/models.py): `app/core/models.py`
- [Evaluation metrics](https://github.com/tanushg07/citeguard/blob/main/app/evaluation/evaluator.py): `app/evaluation/evaluator.py`

### Other components

- **Researcher**
- **Scholarly metadata services**
- **Public source PDFs**
- **Optional Groq explanations**

## Connections

- Researcher → CiteGuard UI: submits paper
- CiteGuard UI → Upload and progress: opens analysis (evidence: `citeguard-frontend/src/App.tsx`)
- Upload and progress → API client: requests analysis (evidence: `citeguard-frontend/src/services/api.ts`)
- API client → Job and report API: calls API
- Job and report API → Pipeline orchestrator: runs job (evidence: `app/api/routes.py`)
- Pipeline orchestrator → Document structure parser: parses document (evidence: `app/services/orchestrator.py`)
- Document structure parser → Claim and citation extraction: splits sentences (evidence: `app/services/document_parser.py`)
- Pipeline orchestrator → Claim and citation extraction: extracts claims (evidence: `app/services/orchestrator.py`)
- Pipeline orchestrator → Source identity resolver: resolves references (evidence: `app/services/orchestrator.py`)
- Source identity resolver → Bibliography enrichment: checks identity (evidence: `app/services/source_resolver.py`)
- Bibliography enrichment → Crossref enrichment: enriches metadata (evidence: `app/services/reference_metadata.py`)
- Bibliography enrichment → Scholarly metadata services: queries providers
- Source identity resolver → PDF retrieval and cache: retrieves PDFs (evidence: `app/services/source_resolver.py`)
- PDF retrieval and cache → Public source PDFs: fetches source
- Pipeline orchestrator → Passage retrieval and reranking: retrieves evidence (evidence: `app/services/orchestrator.py`)
- Passage retrieval and reranking → Claim verification: provides passages
- Pipeline orchestrator → Claim verification: verifies claims (evidence: `app/services/orchestrator.py`)
- Claim verification → NLI model: checks entailment (evidence: `app/services/verifier.py`)
- Claim verification → Numerical checks: checks quantities (evidence: `app/services/verifier.py`)
- Claim verification → Optional Groq explanations: requests explanations
- Pipeline orchestrator → Persisted report and exports: builds results (evidence: `app/services/orchestrator.py`)
- Job and report API → Persisted report and exports: persists and exports (evidence: `app/api/routes.py`)
- API client → Results dashboard: loads results (evidence: `citeguard-frontend/src/components/DashboardView.tsx`)
- Results dashboard → Researcher: shows judgments
- Job and report API → Analysis schemas: validates responses
- Evaluation metrics → Pipeline orchestrator: evaluates outputs (evidence: `app/evaluation/evaluator.py`)
- API client → Job and report API: requests metrics (evidence: `citeguard-frontend/src/services/api.ts`)
