# adityapatel5912/verdict architecture

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

- Interactive diagram: https://gitdiagram.com/adityapatel5912/verdict
- Repository: https://github.com/adityapatel5912/verdict

## Overview

Verdict is a decision stress-testing application: users create a proposal, add source documents, extract claims, model assumptions, and inspect deterministic outcomes before challenging them against reality. The React client presents evidence, scenarios, comparisons, sensitivity analysis, and audit views; the FastAPI backend handles ingestion, extraction, state, and red-team work. Decision history and local persistence preserve reviewable snapshots. The README documents additional integrations and review capabilities whose wiring is not fully visible in the sampled excerpts, so uncertain call edges are omitted.

Main entry points: [`backend/main.py`](https://github.com/adityapatel5912/verdict/blob/main/backend/main.py) (API Application), [`frontend/src/App.tsx`](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/App.tsx) (Workspace App), [`backend/state.py`](https://github.com/adityapatel5912/verdict/blob/main/backend/state.py) (Decision State), [`frontend/src/api.ts`](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/api.ts) (API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Decision Workspace"]
  node_app["Workspace App<br/>[App.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
  node_evidence_ui["Evidence Panel<br/>[EvidencePanel.tsx]"]
  node_model_ui["Decision Model<br/>[DecisionModel.tsx]"]
  node_review_ui["Review Views<br/>[Heatmap.tsx]"]
  node_chat_ui["Decision Chat<br/>[ChatPanel.tsx]"]
  node_worker_client["Calculation Client<br/>[calcClient.ts]"]
  node_history_ui["Decision History"]
end

subgraph group_evidence["Evidence and Modeling"]
  node_calc_worker["Calculation Worker"]
  node_ingestion["File Parsers<br/>[parsers.py]"]
  node_extractor["Claim Extraction<br/>[claim_extractor.py]"]
  node_state["Decision State<br/>[state.py]"]
  node_decision_engine["Decision Engine<br/>[decision_model.py]"]
  node_robustness["Robustness Analysis<br/>[robustness.py]"]
  node_backend_app["API Application<br/>[main.py]"]
end

subgraph group_review["Challenge and Audit"]
  node_chat_handler["Chat Tools<br/>[handler.py]"]
  node_redteam["Red Team<br/>[orchestrator.py]"]
  node_history["History Snapshots<br/>[history_service.py]"]
  node_export["Audit Export<br/>[exporters.py]"]
  node_watchdog["System Watchdog"]
end

subgraph group_platform["Persistence and Integrations"]
  node_database[("SQLite Store<br/>[db.py]")]
  node_provider_router["LLM Router<br/>[provider_router.py]"]
  node_local_persistence["Browser Persistence<br/>[autosave.ts]"]
  node_indexed_db[("IndexedDB<br/>[indexedDb.ts]")]
end

node_decision_maker(("Decision Maker"))
node_llm_providers{{"LLM Providers"}}

node_decision_maker -->|"uses"| node_app
node_app -->|"requests data"| node_api_client
node_app -->|"renders"| node_evidence_ui
node_app -->|"renders"| node_model_ui
node_app -->|"renders"| node_review_ui
node_app -->|"renders"| node_chat_ui
node_app -->|"renders"| node_history_ui
node_model_ui -->|"requests calculations"| node_worker_client
node_worker_client -->|"dispatches calculations"| node_calc_worker
node_api_client -->|"sends API requests"| node_backend_app
node_backend_app -->|"parses uploads"| node_ingestion
node_backend_app -->|"extracts claims"| node_extractor
node_backend_app -->|"reads and updates"| node_state
node_backend_app -->|"runs red team"| node_redteam
node_backend_app -->|"stores decisions"| node_database
node_extractor -->|"stores claims"| node_database
node_state -->|"reads and writes"| node_database
node_state -->|"calculates outcomes"| node_decision_engine
node_state -->|"scores resilience"| node_robustness
node_chat_handler -->|"executes decision tools"| node_state
node_chat_handler -->|"requests language model"| node_provider_router
node_provider_router -.->|"routes model requests"| node_llm_providers
node_redteam -.->|"requests critic analysis"| node_provider_router
node_redteam -->|"stores findings"| node_database
node_history -->|"snapshots decision state"| node_state
node_history -->|"stores history"| node_database
node_history_ui -->|"loads history"| node_api_client
node_backend_app -->|"saves decision history"| node_history
node_backend_app -->|"generates exports"| node_export
node_api_client -->|"loads local decisions"| node_local_persistence
node_local_persistence -->|"persists snapshots"| node_indexed_db
node_api_client -->|"sends telemetry"| node_watchdog

click node_app "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/api.ts"
click node_evidence_ui "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/EvidencePanel.tsx"
click node_model_ui "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/DecisionModel.tsx"
click node_review_ui "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/Heatmap.tsx"
click node_chat_ui "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/ChatPanel.tsx"
click node_worker_client "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/workers/calcClient.ts"
click node_calc_worker "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/workers/verdictCalc.worker.ts"
click node_ingestion "https://github.com/adityapatel5912/verdict/blob/main/backend/ingestion/parsers.py"
click node_extractor "https://github.com/adityapatel5912/verdict/blob/main/backend/extraction/claim_extractor.py"
click node_state "https://github.com/adityapatel5912/verdict/blob/main/backend/state.py"
click node_decision_engine "https://github.com/adityapatel5912/verdict/blob/main/backend/engine/decision_model.py"
click node_robustness "https://github.com/adityapatel5912/verdict/blob/main/backend/engine/robustness.py"
click node_backend_app "https://github.com/adityapatel5912/verdict/blob/main/backend/main.py"
click node_database "https://github.com/adityapatel5912/verdict/blob/main/backend/db.py"
click node_chat_handler "https://github.com/adityapatel5912/verdict/blob/main/backend/chat/handler.py"
click node_redteam "https://github.com/adityapatel5912/verdict/blob/main/backend/redteam/orchestrator.py"
click node_history "https://github.com/adityapatel5912/verdict/blob/main/backend/services/history_service.py"
click node_history_ui "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/DecisionHistory.tsx"
click node_export "https://github.com/adityapatel5912/verdict/blob/main/backend/export/exporters.py"
click node_provider_router "https://github.com/adityapatel5912/verdict/blob/main/backend/llm/provider_router.py"
click node_local_persistence "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/store/autosave.ts"
click node_indexed_db "https://github.com/adityapatel5912/verdict/blob/main/frontend/src/store/indexedDb.ts"
click node_watchdog "https://github.com/adityapatel5912/verdict/blob/main/backend/services/watchdog_service.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_app,node_api_client,node_evidence_ui,node_model_ui,node_review_ui,node_chat_ui,node_worker_client,node_history_ui toneBlue
class node_calc_worker,node_ingestion,node_extractor,node_state,node_decision_engine,node_robustness,node_backend_app toneAmber
class node_chat_handler,node_redteam,node_history,node_export,node_watchdog toneMint
class node_database,node_provider_router,node_local_persistence,node_indexed_db toneRose
class node_decision_maker,node_llm_providers toneIndigo
```

## Components

### Decision Workspace

- [Workspace App](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Evidence Panel](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/EvidencePanel.tsx): `frontend/src/components/EvidencePanel.tsx`
- [Decision Model](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/DecisionModel.tsx): `frontend/src/components/DecisionModel.tsx`
- [Review Views](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/Heatmap.tsx): `frontend/src/components/Heatmap.tsx`
- [Decision Chat](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/ChatPanel.tsx): `frontend/src/components/ChatPanel.tsx`
- [Calculation Client](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/workers/calcClient.ts): `frontend/src/workers/calcClient.ts`
- [Decision History](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/components/DecisionHistory.tsx): `frontend/src/components/DecisionHistory.tsx`

### Evidence and Modeling

- [Calculation Worker](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/workers/verdictCalc.worker.ts): `frontend/src/workers/verdictCalc.worker.ts`
- [File Parsers](https://github.com/adityapatel5912/verdict/blob/main/backend/ingestion/parsers.py): `backend/ingestion/parsers.py`
- [Claim Extraction](https://github.com/adityapatel5912/verdict/blob/main/backend/extraction/claim_extractor.py): `backend/extraction/claim_extractor.py`
- [Decision State](https://github.com/adityapatel5912/verdict/blob/main/backend/state.py): `backend/state.py`
- [Decision Engine](https://github.com/adityapatel5912/verdict/blob/main/backend/engine/decision_model.py): `backend/engine/decision_model.py`
- [Robustness Analysis](https://github.com/adityapatel5912/verdict/blob/main/backend/engine/robustness.py): `backend/engine/robustness.py`
- [API Application](https://github.com/adityapatel5912/verdict/blob/main/backend/main.py): `backend/main.py`

### Challenge and Audit

- [Chat Tools](https://github.com/adityapatel5912/verdict/blob/main/backend/chat/handler.py): `backend/chat/handler.py`
- [Red Team](https://github.com/adityapatel5912/verdict/blob/main/backend/redteam/orchestrator.py): `backend/redteam/orchestrator.py`
- [History Snapshots](https://github.com/adityapatel5912/verdict/blob/main/backend/services/history_service.py): `backend/services/history_service.py`
- [Audit Export](https://github.com/adityapatel5912/verdict/blob/main/backend/export/exporters.py): `backend/export/exporters.py`
- [System Watchdog](https://github.com/adityapatel5912/verdict/blob/main/backend/services/watchdog_service.py): `backend/services/watchdog_service.py`

### Persistence and Integrations

- [SQLite Store](https://github.com/adityapatel5912/verdict/blob/main/backend/db.py): `backend/db.py`
- [LLM Router](https://github.com/adityapatel5912/verdict/blob/main/backend/llm/provider_router.py): `backend/llm/provider_router.py`
- [Browser Persistence](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/store/autosave.ts): `frontend/src/store/autosave.ts`
- [IndexedDB](https://github.com/adityapatel5912/verdict/blob/main/frontend/src/store/indexedDb.ts): `frontend/src/store/indexedDb.ts`

### Other components

- **Decision Maker**
- **LLM Providers**

## Connections

- Decision Maker → Workspace App: uses
- Workspace App → API Client: requests data
- Workspace App → Evidence Panel: renders
- Workspace App → Decision Model: renders
- Workspace App → Review Views: renders
- Workspace App → Decision Chat: renders
- Workspace App → Decision History: renders
- Decision Model → Calculation Client: requests calculations
- Calculation Client → Calculation Worker: dispatches calculations
- API Client → API Application: sends API requests
- API Application → File Parsers: parses uploads
- API Application → Claim Extraction: extracts claims
- API Application → Decision State: reads and updates
- API Application → Red Team: runs red team
- API Application → SQLite Store: stores decisions
- Claim Extraction → SQLite Store: stores claims
- Decision State → SQLite Store: reads and writes
- Decision State → Decision Engine: calculates outcomes
- Decision State → Robustness Analysis: scores resilience
- Chat Tools → Decision State: executes decision tools
- Chat Tools → LLM Router: requests language model
- LLM Router → LLM Providers: routes model requests
- Red Team → LLM Router: requests critic analysis
- Red Team → SQLite Store: stores findings
- History Snapshots → Decision State: snapshots decision state
- History Snapshots → SQLite Store: stores history
- Decision History → API Client: loads history
- API Application → History Snapshots: saves decision history
- API Application → Audit Export: generates exports
- API Client → Browser Persistence: loads local decisions
- Browser Persistence → IndexedDB: persists snapshots
- API Client → System Watchdog: sends telemetry
