# maxandrews/epstein-doc-explorer architecture

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

- Interactive diagram: https://gitdiagram.com/maxandrews/epstein-doc-explorer
- Repository: https://github.com/maxandrews/epstein-doc-explorer

## Overview

Epstein Document Network Explorer turns source documents into an AI-extracted relationship network, then serves it through an interactive graph, filters, timeline, and document viewer. The documented primary workflow is document extraction and analysis into SQLite, followed by API-backed exploration. The README also describes semantic tagging, tag clustering, entity deduplication, and incremental ingestion. Pipeline internals and server routes were not excerpted, so pipeline links follow documented capabilities; no unshown implementation details are inferred.

Main entry points: [`network-ui/src/App.tsx`](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/App.tsx) (Explorer App), [`network-ui/src/api.ts`](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/api.ts) (API Client), [`analysis_pipeline/analyze_documents.ts`](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/analyze_documents.ts) (Document Analysis), [`community_schema.sql`](https://github.com/maxandrews/epstein-doc-explorer/blob/main/community_schema.sql) (Analysis Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion and Analysis"]
  node_extract["Text Extraction<br/>[extract_data.py]"]
  node_analyze["Document Analysis"]
  node_incremental["Incremental Analysis"]
end

subgraph group_enrichment["Network Enrichment"]
  node_tagging["Semantic Tagging<br/>[analyze_tags.ts]"]
  node_cluster["Tag Clustering<br/>[cluster_tags.ts]"]
  node_cluster_names["Cluster Naming"]
  node_new_cluster_assign["New Tag Assignment"]
  node_dedupe["Entity Deduplication<br/>[dedupe_with_llm.ts]"]
end

subgraph group_backend["Data and API"]
  node_database[("Analysis Database")]
  node_api["HTTP API<br/>[api_server.ts]"]
end

subgraph group_frontend["Interactive Explorer"]
  node_app["Explorer App<br/>[App.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
  node_sidebar["Filters and Search<br/>[Sidebar.tsx]"]
  node_graph["Network Graph<br/>[NetworkGraph.tsx]"]
  node_timeline["Timeline Browser<br/>[RightSidebar.tsx]"]
  node_mobile["Mobile Navigation"]
  node_document_modal["Document Viewer<br/>[DocumentModal.tsx]"]
  node_welcome["Welcome Guide<br/>[WelcomeModal.tsx]"]
end

node_document_sources(("Source Documents"))
node_claude{{"Claude AI"}}
node_user(("Explorer User"))

node_document_sources -->|"provides text"| node_extract
node_extract -->|"supplies documents"| node_analyze
node_analyze -->|"extracts with AI"| node_claude
node_analyze -->|"stores results"| node_database
node_analyze -->|"adds contextual tags"| node_tagging
node_analyze -.->|"supports new documents"| node_incremental
node_database -->|"provides tags"| node_cluster
node_cluster -->|"names clusters"| node_cluster_names
node_cluster -.->|"assigns new tags"| node_new_cluster_assign
node_database -->|"provides entities"| node_dedupe
node_dedupe -->|"merges with LLM"| node_claude
node_dedupe -->|"records aliases"| node_database
node_user -->|"explores network"| node_app
node_app -->|"requests data"| node_api_client
node_api_client -->|"calls endpoints"| node_api
node_api -.->|"queries records"| node_database
node_app -->|"renders filters"| node_sidebar
node_app -->|"renders network"| node_graph
node_app -->|"renders timeline"| node_timeline
node_app -->|"renders navigation"| node_mobile
node_app -->|"renders guide"| node_welcome
node_sidebar -->|"searches actors"| node_api_client
node_mobile -->|"searches actors"| node_api_client
node_timeline -->|"loads documents"| node_api_client
node_timeline -->|"opens document"| node_document_modal
node_mobile -->|"opens document"| node_document_modal
node_document_modal -->|"loads document text"| node_api_client
node_graph -->|"loads actor count"| node_api_client

click node_extract "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/extract_data.py"
click node_analyze "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/analyze_documents.ts"
click node_tagging "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/analyze_tags.ts"
click node_cluster "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/cluster_tags.ts"
click node_cluster_names "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/name_clusters_with_claude.ts"
click node_new_cluster_assign "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/assign_new_tags_to_clusters.ts"
click node_dedupe "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/dedupe_with_llm.ts"
click node_incremental "https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/identify_new_documents.ts"
click node_database "https://github.com/maxandrews/epstein-doc-explorer/blob/main/community_schema.sql"
click node_api "https://github.com/maxandrews/epstein-doc-explorer/blob/main/api_server.ts"
click node_app "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/App.tsx"
click node_api_client "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/api.ts"
click node_sidebar "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/Sidebar.tsx"
click node_graph "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/NetworkGraph.tsx"
click node_timeline "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/RightSidebar.tsx"
click node_mobile "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/MobileBottomNav.tsx"
click node_document_modal "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/DocumentModal.tsx"
click node_welcome "https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/WelcomeModal.tsx"

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_extract,node_analyze,node_incremental,node_user toneBlue
class node_tagging,node_cluster,node_cluster_names,node_new_cluster_assign,node_dedupe toneAmber
class node_database,node_api toneMint
class node_app,node_api_client,node_sidebar,node_graph,node_timeline,node_mobile,node_document_modal,node_welcome toneRose
class node_document_sources,node_claude toneIndigo
```

## Components

### Ingestion and Analysis

- [Text Extraction](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/extract_data.py): `analysis_pipeline/extract_data.py`
- [Document Analysis](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/analyze_documents.ts): `analysis_pipeline/analyze_documents.ts`
- [Incremental Analysis](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/identify_new_documents.ts): `analysis_pipeline/identify_new_documents.ts`

### Network Enrichment

- [Semantic Tagging](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/analyze_tags.ts): `analysis_pipeline/analyze_tags.ts`
- [Tag Clustering](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/cluster_tags.ts): `analysis_pipeline/cluster_tags.ts`
- [Cluster Naming](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/name_clusters_with_claude.ts): `analysis_pipeline/name_clusters_with_claude.ts`
- [New Tag Assignment](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/assign_new_tags_to_clusters.ts): `analysis_pipeline/assign_new_tags_to_clusters.ts`
- [Entity Deduplication](https://github.com/maxandrews/epstein-doc-explorer/blob/main/analysis_pipeline/dedupe_with_llm.ts): `analysis_pipeline/dedupe_with_llm.ts`

### Data and API

- [Analysis Database](https://github.com/maxandrews/epstein-doc-explorer/blob/main/community_schema.sql): `community_schema.sql`
- [HTTP API](https://github.com/maxandrews/epstein-doc-explorer/blob/main/api_server.ts): `api_server.ts`

### Interactive Explorer

- [Explorer App](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/App.tsx): `network-ui/src/App.tsx`
- [API Client](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/api.ts): `network-ui/src/api.ts`
- [Filters and Search](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/Sidebar.tsx): `network-ui/src/components/Sidebar.tsx`
- [Network Graph](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/NetworkGraph.tsx): `network-ui/src/components/NetworkGraph.tsx`
- [Timeline Browser](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/RightSidebar.tsx): `network-ui/src/components/RightSidebar.tsx`
- [Mobile Navigation](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/MobileBottomNav.tsx): `network-ui/src/components/MobileBottomNav.tsx`
- [Document Viewer](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/DocumentModal.tsx): `network-ui/src/components/DocumentModal.tsx`
- [Welcome Guide](https://github.com/maxandrews/epstein-doc-explorer/blob/main/network-ui/src/components/WelcomeModal.tsx): `network-ui/src/components/WelcomeModal.tsx`

### Other components

- **Source Documents**
- **Claude AI**
- **Explorer User**

## Connections

- Source Documents → Text Extraction: provides text (evidence: `README.md`)
- Text Extraction → Document Analysis: supplies documents (evidence: `README.md`)
- Document Analysis → Claude AI: extracts with AI (evidence: `README.md`)
- Document Analysis → Analysis Database: stores results (evidence: `README.md`)
- Document Analysis → Semantic Tagging: adds contextual tags (evidence: `README.md`)
- Document Analysis → Incremental Analysis: supports new documents
- Analysis Database → Tag Clustering: provides tags (evidence: `README.md`)
- Tag Clustering → Cluster Naming: names clusters (evidence: `README.md`)
- Tag Clustering → New Tag Assignment: assigns new tags
- Analysis Database → Entity Deduplication: provides entities (evidence: `README.md`)
- Entity Deduplication → Claude AI: merges with LLM (evidence: `README.md`)
- Entity Deduplication → Analysis Database: records aliases (evidence: `README.md`)
- Explorer User → Explorer App: explores network (evidence: `README.md`)
- Explorer App → API Client: requests data (evidence: `network-ui/src/App.tsx`)
- API Client → HTTP API: calls endpoints (evidence: `network-ui/src/api.ts`)
- HTTP API → Analysis Database: queries records
- Explorer App → Filters and Search: renders filters (evidence: `network-ui/src/App.tsx`)
- Explorer App → Network Graph: renders network (evidence: `network-ui/src/App.tsx`)
- Explorer App → Timeline Browser: renders timeline (evidence: `network-ui/src/App.tsx`)
- Explorer App → Mobile Navigation: renders navigation (evidence: `network-ui/src/App.tsx`)
- Explorer App → Welcome Guide: renders guide (evidence: `network-ui/src/App.tsx`)
- Filters and Search → API Client: searches actors (evidence: `network-ui/src/components/Sidebar.tsx`)
- Mobile Navigation → API Client: searches actors (evidence: `network-ui/src/components/MobileBottomNav.tsx`)
- Timeline Browser → API Client: loads documents (evidence: `network-ui/src/components/RightSidebar.tsx`)
- Timeline Browser → Document Viewer: opens document (evidence: `network-ui/src/components/RightSidebar.tsx`)
- Mobile Navigation → Document Viewer: opens document (evidence: `network-ui/src/components/MobileBottomNav.tsx`)
- Document Viewer → API Client: loads document text (evidence: `network-ui/src/components/DocumentModal.tsx`)
- Network Graph → API Client: loads actor count (evidence: `network-ui/src/components/NetworkGraph.tsx`)
