# milo80/entitynetworkswos architecture

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

- Interactive diagram: https://gitdiagram.com/milo80/entitynetworkswos
- Repository: https://github.com/milo80/entitynetworkswos

## Overview

Entity Networks converts uploaded Web of Science exports into browsable research networks. The main workflow is upload and profile a dataset, configure a network, run the pipeline, then explore links and underlying records; authentication and the optional assistant support that journey. The graph also retains the documented data-catalog and network-building capabilities. Edges use the supplied excerpts, source-index references, or README statements; unsampled implementation details are not asserted.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/api/client.ts) (Typed API client), [`frontend/src/App.tsx`](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/App.tsx) (Application routes), [`backend/app/main.py`](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/main.py) (FastAPI routers), [`backend/app/worker.py`](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/worker.py) (Run worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_ui["Application routes<br/>[App.tsx]"]
  node_api_client["Typed API client<br/>[client.ts]"]
  node_login["Login and sessions UI<br/>[session.tsx]"]
  node_datasets_ui["Dataset pages<br/>[DatasetsPage.tsx]"]
  node_data_ui["Dataset data catalog"]
  node_build_ui["Network build form"]
  node_explorer_ui["Network explorer<br/>[ExplorerPages.tsx]"]
  node_records_ui["Record browser<br/>[RecordsPage.tsx]"]
  node_assistant_ui["Assistant panel<br/>[AssistantPanel.tsx]"]
end

subgraph group_service["API and services"]
  node_api["FastAPI routers<br/>[main.py]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_datasets_api["Dataset API<br/>[datasets.py]"]
  node_runs_api["Network runs API<br/>[runs.py]"]
  node_auth_sessions["Session and CSRF<br/>[sessions.py]"]
  node_records["Record services<br/>[records.py]"]
  node_storage["Upload storage<br/>[storage.py]"]
  node_worker["Run worker<br/>[worker.py]"]
  node_db_models[("Application data store<br/>[__init__.py]")]
end

subgraph group_pipeline["Network pipeline"]
  node_profile["Dataset profiling<br/>[profile.py]"]
  node_custom["Custom network builder<br/>[custom.py]"]
  node_authors["Author resolution<br/>[authors.py]"]
  node_institutions["Institution networks<br/>[institutions.py]"]
  node_keywords["Keyword processing<br/>[keywords.py]"]
  node_networks["Network generation<br/>[networks.py]"]
end

subgraph group_assistant["Assistant"]
  node_assistant_api["Assistant API<br/>[assistant.py]"]
  node_assistant_tools["Assistant tools<br/>[tools.py]"]
  node_assistant_guide["Network guidance<br/>[guide.py]"]
end

node_researcher(("Researcher"))
node_upload["WoS upload files"]
node_claude{{"Claude API"}}

node_researcher -->|"uses"| node_ui
node_ui -->|"guards routes"| node_login
node_ui -->|"routes to"| node_datasets_ui
node_ui -->|"routes to"| node_data_ui
node_ui -->|"routes to"| node_records_ui
node_ui -->|"routes to"| node_explorer_ui
node_researcher -->|"exports and uploads"| node_upload
node_upload -->|"creates dataset"| node_datasets_ui
node_datasets_ui -.->|"requests data"| node_api_client
node_data_ui -.->|"requests profile"| node_api_client
node_build_ui -->|"submits settings"| node_api_client
node_explorer_ui -.->|"loads run"| node_api_client
node_records_ui -->|"requests records"| node_api_client
node_api_client -->|"calls endpoints"| node_api
node_api -->|"registers router"| node_auth_api
node_api -->|"registers router"| node_datasets_api
node_api -->|"registers router"| node_runs_api
node_auth_api -->|"uses sessions"| node_auth_sessions
node_datasets_api -->|"uses storage"| node_storage
node_datasets_api -->|"uses record service"| node_records
node_datasets_api -->|"reads and writes"| node_db_models
node_runs_api -->|"reads and writes"| node_db_models
node_worker -->|"updates run state"| node_db_models
node_worker -->|"uses file storage"| node_storage
node_worker -->|"profiles dataset"| node_profile
node_worker -->|"builds network"| node_custom
node_custom -->|"uses author data"| node_authors
node_custom -->|"uses institution data"| node_institutions
node_custom -->|"uses keyword data"| node_keywords
node_researcher -->|"asks questions"| node_assistant_ui
node_assistant_ui -.->|"sends chat"| node_api_client
node_api -->|"registers router"| node_assistant_api
node_assistant_api -->|"uses tools"| node_assistant_tools
node_assistant_tools -->|"uses guidance"| node_assistant_guide
node_assistant_api -.->|"sends assistant request"| node_claude
node_researcher -->|"configures network"| node_build_ui
node_researcher -->|"explores results"| node_explorer_ui
node_researcher -->|"inspects records"| node_records_ui

click node_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/api/client.ts"
click node_login "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/auth/session.tsx"
click node_datasets_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/DatasetsPage.tsx"
click node_data_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/DatasetDataPage.tsx"
click node_build_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/BuildNetworkForm.tsx"
click node_explorer_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/ExplorerPages.tsx"
click node_records_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/RecordsPage.tsx"
click node_assistant_ui "https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/components/assistant/AssistantPanel.tsx"
click node_api "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/auth.py"
click node_datasets_api "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/datasets.py"
click node_runs_api "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/runs.py"
click node_auth_sessions "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/auth/sessions.py"
click node_records "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/records.py"
click node_storage "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/storage.py"
click node_worker "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/worker.py"
click node_db_models "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/models/__init__.py"
click node_profile "https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/profile.py"
click node_custom "https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/custom.py"
click node_authors "https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/authors.py"
click node_institutions "https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/institutions.py"
click node_keywords "https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/keywords.py"
click node_networks "https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/networks.py"
click node_assistant_api "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/assistant.py"
click node_assistant_tools "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/assistant/tools.py"
click node_assistant_guide "https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/assistant/guide.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_ui,node_api_client,node_login,node_datasets_ui,node_data_ui,node_build_ui,node_explorer_ui,node_records_ui,node_assistant_ui toneBlue
class node_api,node_auth_api,node_datasets_api,node_runs_api,node_auth_sessions,node_records,node_storage,node_worker,node_db_models toneAmber
class node_profile,node_custom,node_authors,node_institutions,node_keywords,node_networks,node_claude toneMint
class node_assistant_api,node_assistant_tools,node_assistant_guide toneRose
class node_researcher,node_upload toneIndigo
```

## Components

### Web application

- [Application routes](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Typed API client](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Login and sessions UI](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/auth/session.tsx): `frontend/src/auth/session.tsx`
- [Dataset pages](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/DatasetsPage.tsx): `frontend/src/pages/DatasetsPage.tsx`
- [Dataset data catalog](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/DatasetDataPage.tsx): `frontend/src/pages/DatasetDataPage.tsx`
- [Network build form](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/BuildNetworkForm.tsx): `frontend/src/pages/BuildNetworkForm.tsx`
- [Network explorer](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/ExplorerPages.tsx): `frontend/src/pages/ExplorerPages.tsx`
- [Record browser](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/pages/RecordsPage.tsx): `frontend/src/pages/RecordsPage.tsx`
- [Assistant panel](https://github.com/milo80/entitynetworkswos/blob/main/frontend/src/components/assistant/AssistantPanel.tsx): `frontend/src/components/assistant/AssistantPanel.tsx`

### API and services

- [FastAPI routers](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication API](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Dataset API](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/datasets.py): `backend/app/api/datasets.py`
- [Network runs API](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/runs.py): `backend/app/api/runs.py`
- [Session and CSRF](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/auth/sessions.py): `backend/app/auth/sessions.py`
- [Record services](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/records.py): `backend/app/services/records.py`
- [Upload storage](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/storage.py): `backend/app/services/storage.py`
- [Run worker](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/worker.py): `backend/app/worker.py`
- [Application data store](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/models/__init__.py): `backend/app/models/__init__.py`

### Network pipeline

- [Dataset profiling](https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/profile.py): `backend/pipeline/profile.py`
- [Custom network builder](https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/custom.py): `backend/pipeline/custom.py`
- [Author resolution](https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/authors.py): `backend/pipeline/authors.py`
- [Institution networks](https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/institutions.py): `backend/pipeline/institutions.py`
- [Keyword processing](https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/keywords.py): `backend/pipeline/keywords.py`
- [Network generation](https://github.com/milo80/entitynetworkswos/blob/main/backend/pipeline/networks.py): `backend/pipeline/networks.py`

### Assistant

- [Assistant API](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/api/assistant.py): `backend/app/api/assistant.py`
- [Assistant tools](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/assistant/tools.py): `backend/app/services/assistant/tools.py`
- [Network guidance](https://github.com/milo80/entitynetworkswos/blob/main/backend/app/services/assistant/guide.py): `backend/app/services/assistant/guide.py`

### Other components

- **Researcher**
- **WoS upload files**
- **Claude API**

## Connections

- Researcher → Application routes: uses (evidence: `README.md`)
- Application routes → Login and sessions UI: guards routes (evidence: `frontend/src/App.tsx`)
- Application routes → Dataset pages: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Dataset data catalog: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Record browser: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Network explorer: routes to (evidence: `frontend/src/App.tsx`)
- Researcher → WoS upload files: exports and uploads (evidence: `README.md`)
- WoS upload files → Dataset pages: creates dataset (evidence: `README.md`)
- Dataset pages → Typed API client: requests data
- Dataset data catalog → Typed API client: requests profile
- Network build form → Typed API client: submits settings (evidence: `frontend/src/pages/BuildNetworkForm.tsx`)
- Network explorer → Typed API client: loads run
- Record browser → Typed API client: requests records (evidence: `frontend/src/pages/RecordsPage.tsx`)
- Typed API client → FastAPI routers: calls endpoints (evidence: `frontend/src/api/client.ts`)
- FastAPI routers → Authentication API: registers router (evidence: `backend/app/main.py`)
- FastAPI routers → Dataset API: registers router (evidence: `backend/app/main.py`)
- FastAPI routers → Network runs API: registers router (evidence: `backend/app/main.py`)
- Authentication API → Session and CSRF: uses sessions (evidence: `backend/app/api/auth.py`)
- Dataset API → Upload storage: uses storage (evidence: `backend/app/api/datasets.py`)
- Dataset API → Record services: uses record service (evidence: `backend/app/api/datasets.py`)
- Dataset API → Application data store: reads and writes (evidence: `backend/app/api/datasets.py`)
- Network runs API → Application data store: reads and writes (evidence: `backend/app/api/runs.py`)
- Run worker → Application data store: updates run state (evidence: `backend/app/worker.py`)
- Run worker → Upload storage: uses file storage (evidence: `backend/app/worker.py`)
- Run worker → Dataset profiling: profiles dataset (evidence: `backend/app/worker.py`)
- Run worker → Custom network builder: builds network (evidence: `backend/app/worker.py`)
- Custom network builder → Author resolution: uses author data (evidence: `backend/pipeline/custom.py`)
- Custom network builder → Institution networks: uses institution data (evidence: `backend/pipeline/custom.py`)
- Custom network builder → Keyword processing: uses keyword data (evidence: `backend/pipeline/custom.py`)
- Researcher → Assistant panel: asks questions (evidence: `README.md`)
- Assistant panel → Typed API client: sends chat
- FastAPI routers → Assistant API: registers router (evidence: `backend/app/main.py`)
- Assistant API → Assistant tools: uses tools (evidence: `backend/app/api/assistant.py`)
- Assistant tools → Network guidance: uses guidance (evidence: `backend/app/services/assistant/tools.py`)
- Assistant API → Claude API: sends assistant request
- Researcher → Network build form: configures network (evidence: `README.md`)
- Researcher → Network explorer: explores results (evidence: `README.md`)
- Researcher → Record browser: inspects records (evidence: `README.md`)
