# lisamehta0791/tracehold architecture

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

- Interactive diagram: https://gitdiagram.com/lisamehta0791/tracehold
- Repository: https://github.com/lisamehta0791/tracehold

## Overview

TraceHold is a decision-support application that checks a reported fraud request, reconstructs the money trail, sizes traceable funds, and presents a reviewable hold basis. Officers can also review existing liens, inspect audit and performance information, and ask questions of results. The README documents these capabilities; sampled backend excerpts show the SQL engine and live-analysis orchestration, while the frontend excerpt shows route ownership. Many feature-specific implementations were not sampled, so some connections are omitted or marked unverified.

Main entry points: [`backend/app/main.py`](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/main.py) (API routes), [`frontend/src/App.tsx`](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/App.tsx) (Web application), [`backend/app/engine.py`](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/engine.py) (Analysis engine), [`frontend/src/pages/System.tsx`](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/System.tsx) (System console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User application"]
  node_browser["Web application<br/>[App.tsx]"]
  node_analyze_ui["Live analysis<br/>[Analyze.tsx]"]
  node_case_ui["Case details<br/>[CaseDetail.tsx]"]
end

subgraph group_analysis["Case analysis"]
  node_api["API routes<br/>[main.py]"]
  node_playground["Live case setup<br/>[playground.py]"]
  node_engine["Analysis engine<br/>[engine.py]"]
  node_basis["Request checks<br/>[basis.py]"]
  node_trail_sizing["Trail and sizing<br/>[engine.py]"]
  node_evaluation["Scope evaluation<br/>[evaluation.py]"]
  node_packet["Evidence packet<br/>[packet_html.py]"]
  node_generator["Synthetic records<br/>[generate.py]"]
end

subgraph group_review["Review and oversight"]
  node_lien_ui["Lien review<br/>[LienReview.tsx]"]
end

subgraph group_ai["AI assistance"]
  node_ask_ui["Ask results<br/>[Ask.tsx]"]
  node_ask["Result questions<br/>[ask.py]"]
  node_extract["Letter extraction<br/>[extract.py]"]
  node_reword["Explanation rewording<br/>[reword.py]"]
  node_llm["Groq client<br/>[llm.py]"]
  node_letters["Synthetic letters<br/>[letters.py]"]
end

subgraph group_trust["Audit and transparency"]
  node_system_ui["System console<br/>[System.tsx]"]
  node_runs[("Run history<br/>[db.py]")]
  node_retrace["Live re-trace<br/>[retrace.py]"]
  node_insights["Insights and accuracy<br/>[ai_eval.py]"]
end

node_officer(("Officer"))
node_exasol[("Exasol")]
node_mcp["Exasol MCP"]

node_officer -->|"uses"| node_browser
node_browser -->|"routes to"| node_analyze_ui
node_browser -->|"routes to"| node_case_ui
node_browser -->|"routes to"| node_lien_ui
node_browser -->|"routes to"| node_system_ui
node_browser -->|"routes to"| node_ask_ui
node_analyze_ui -.->|"submits case"| node_api
node_case_ui -.->|"loads results"| node_api
node_lien_ui -.->|"loads review"| node_api
node_system_ui -.->|"loads system data"| node_api
node_ask_ui -.->|"asks questions"| node_api
node_api -->|"runs live case"| node_playground
node_playground -->|"runs analysis"| node_engine
node_api -->|"starts analysis"| node_engine
node_engine -->|"executes SQL"| node_exasol
node_engine -->|"computes trail and sizing"| node_trail_sizing
node_engine -->|"checks requests"| node_basis
node_engine -->|"reviews scope"| node_evaluation
node_api -->|"exports packet"| node_packet
node_api -->|"extracts letter fields"| node_extract
node_api -->|"rewords explanation"| node_reword
node_api -->|"answers result questions"| node_ask
node_ask -->|"queries through"| node_mcp
node_extract -.->|"requests extraction"| node_llm
node_reword -.->|"requests rewording"| node_llm
node_api -->|"re-traces case"| node_retrace
node_api -.->|"records run"| node_runs
node_system_ui -.->|"shows analysis"| node_insights
node_generator -.->|"loads synthetic data"| node_exasol
node_letters -.->|"provides sample letters"| node_exasol

click node_browser "https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/App.tsx"
click node_analyze_ui "https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/Analyze.tsx"
click node_case_ui "https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/CaseDetail.tsx"
click node_api "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/main.py"
click node_playground "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/playground.py"
click node_engine "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/engine.py"
click node_basis "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/basis.py"
click node_trail_sizing "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/engine.py"
click node_evaluation "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/evaluation.py"
click node_packet "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/packet_html.py"
click node_lien_ui "https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/LienReview.tsx"
click node_system_ui "https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/System.tsx"
click node_ask_ui "https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/Ask.tsx"
click node_ask "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/ask.py"
click node_extract "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/extract.py"
click node_reword "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/reword.py"
click node_llm "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/llm.py"
click node_runs "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/db.py"
click node_retrace "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/retrace.py"
click node_insights "https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai_eval.py"
click node_generator "https://github.com/lisamehta0791/tracehold/blob/main/backend/generator/generate.py"
click node_letters "https://github.com/lisamehta0791/tracehold/blob/main/backend/generator/letters.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_browser,node_analyze_ui,node_case_ui toneBlue
class node_api,node_playground,node_engine,node_basis,node_trail_sizing,node_evaluation,node_packet,node_generator,node_exasol toneAmber
class node_lien_ui toneMint
class node_ask_ui,node_ask,node_extract,node_reword,node_llm,node_letters toneRose
class node_system_ui,node_runs,node_retrace,node_insights,node_officer,node_mcp toneIndigo
```

## Components

### User application

- [Web application](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Live analysis](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/Analyze.tsx): `frontend/src/pages/Analyze.tsx`
- [Case details](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/CaseDetail.tsx): `frontend/src/pages/CaseDetail.tsx`

### Case analysis

- [API routes](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/main.py): `backend/app/main.py`
- [Live case setup](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/playground.py): `backend/app/playground.py`
- [Analysis engine](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Request checks](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/basis.py): `backend/app/basis.py`
- [Trail and sizing](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/engine.py): `backend/app/engine.py`
- [Scope evaluation](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/evaluation.py): `backend/app/evaluation.py`
- [Evidence packet](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/packet_html.py): `backend/app/packet_html.py`
- [Synthetic records](https://github.com/lisamehta0791/tracehold/blob/main/backend/generator/generate.py): `backend/generator/generate.py`

### Review and oversight

- [Lien review](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/LienReview.tsx): `frontend/src/pages/LienReview.tsx`

### AI assistance

- [Ask results](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/Ask.tsx): `frontend/src/pages/Ask.tsx`
- [Result questions](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/ask.py): `backend/app/ai/ask.py`
- [Letter extraction](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/extract.py): `backend/app/ai/extract.py`
- [Explanation rewording](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/reword.py): `backend/app/ai/reword.py`
- [Groq client](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai/llm.py): `backend/app/ai/llm.py`
- [Synthetic letters](https://github.com/lisamehta0791/tracehold/blob/main/backend/generator/letters.py): `backend/generator/letters.py`

### Audit and transparency

- [System console](https://github.com/lisamehta0791/tracehold/blob/main/frontend/src/pages/System.tsx): `frontend/src/pages/System.tsx`
- [Run history](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/db.py): `backend/app/db.py`
- [Live re-trace](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/retrace.py): `backend/app/retrace.py`
- [Insights and accuracy](https://github.com/lisamehta0791/tracehold/blob/main/backend/app/ai_eval.py): `backend/app/ai_eval.py`

### Other components

- **Officer**
- **Exasol**
- **Exasol MCP**

## Connections

- Officer → Web application: uses
- Web application → Live analysis: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Case details: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Lien review: routes to (evidence: `frontend/src/App.tsx`)
- Web application → System console: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Ask results: routes to (evidence: `frontend/src/App.tsx`)
- Live analysis → API routes: submits case
- Case details → API routes: loads results
- Lien review → API routes: loads review
- System console → API routes: loads system data
- Ask results → API routes: asks questions
- API routes → Live case setup: runs live case (evidence: `backend/app/main.py`)
- Live case setup → Analysis engine: runs analysis (evidence: `backend/app/playground.py`)
- API routes → Analysis engine: starts analysis (evidence: `backend/app/main.py`)
- Analysis engine → Exasol: executes SQL (evidence: `backend/app/engine.py`)
- Analysis engine → Trail and sizing: computes trail and sizing (evidence: `backend/app/engine.py`)
- Analysis engine → Request checks: checks requests
- Analysis engine → Scope evaluation: reviews scope
- API routes → Evidence packet: exports packet (evidence: `backend/app/main.py`)
- API routes → Letter extraction: extracts letter fields (evidence: `backend/app/main.py`)
- API routes → Explanation rewording: rewords explanation (evidence: `backend/app/main.py`)
- API routes → Result questions: answers result questions (evidence: `backend/app/main.py`)
- Result questions → Exasol MCP: queries through
- Letter extraction → Groq client: requests extraction
- Explanation rewording → Groq client: requests rewording
- API routes → Live re-trace: re-traces case (evidence: `backend/app/main.py`)
- API routes → Run history: records run (evidence: `backend/app/main.py`)
- System console → Insights and accuracy: shows analysis
- Synthetic records → Exasol: loads synthetic data
- Synthetic letters → Exasol: provides sample letters
