# varad-lingayat/epidemic-intervention-planner architecture

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

- Interactive diagram: https://gitdiagram.com/varad-lingayat/epidemic-intervention-planner
- Repository: https://github.com/varad-lingayat/epidemic-intervention-planner

## Overview

EpiGraph is an epidemic-intervention planning simulator for graph-theory teaching. Users configure a city network and epidemic scenario, compare intervention strategies, inspect outcomes and sensitivity, then save or share reports. The sampled simulation engine models discrete-time spread over synthetic city graphs; the repository also contains OpenStreetMap import, explanation, persistence, and visualization capabilities. The README is empty, so capability coverage comes from the source tree and excerpts; links for unsampled feature modules are omitted where invocation evidence is unavailable.

Main entry points: [`client/src/App.tsx`](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/App.tsx) (Web app routes), [`server/routers.ts`](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers.ts) (tRPC API routes), [`server/routers/explanations.ts`](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/explanations.ts) (Explanation API), [`server/db.ts`](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/db.ts) (Scenario database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Scenario application"]
  node_app["Web app routes<br/>[App.tsx]"]
  node_home["Scenario workspace<br/>[Home.tsx]"]
  node_networkviz["Network visualization<br/>[NetworkGraph.tsx]"]
  node_charts["Outcome charts<br/>[ScenarioCharts.tsx]"]
  node_reportpreview["Report preview"]
  node_sharedreport["Shared report view<br/>[SharedReport.tsx]"]
  node_trpcclient["API client<br/>[main.tsx]"]
end

subgraph group_simulation["Epidemic modeling"]
  node_epidemictypes["Graph and epidemic types<br/>[epidemic.ts]"]
  node_engine["SIR simulation engine<br/>[epidemicEngine.ts]"]
  node_interventions["Intervention strategies<br/>[interventions.ts]"]
  node_sensitivity["Sensitivity analysis"]
  node_selection["Initial infection selection"]
end

subgraph group_api["Application services"]
  node_osm["OpenStreetMap import<br/>[osmImport.ts]"]
  node_explanation["Decision explanations"]
  node_summary["Explanation summaries"]
  node_apiroot["tRPC API routes<br/>[routers.ts]"]
  node_scenarioapi["Scenario and report API<br/>[scenarios.ts]"]
  node_osmapi["OSM API<br/>[osm.ts]"]
  node_explanationapi["Explanation API<br/>[explanations.ts]"]
end

subgraph group_persistence["Scenario persistence"]
  node_database[("Scenario database<br/>[db.ts]")]
  node_schema["Persistent data schema<br/>[schema.ts]"]
  node_localstore[("Desktop local store")]
end

node_user(("Planner"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_sharedreport
node_trpcclient -->|"renders"| node_app
node_reportpreview -->|"renders"| node_networkviz
node_reportpreview -->|"renders"| node_charts
node_engine -->|"uses types"| node_epidemictypes
node_interventions -->|"uses"| node_epidemictypes
node_interventions -->|"uses"| node_engine
node_apiroot -->|"registers"| node_osmapi
node_apiroot -->|"registers"| node_scenarioapi
node_apiroot -->|"registers"| node_explanationapi
node_osmapi -->|"calls"| node_osm
node_explanationapi -->|"calls"| node_explanation
node_explanationapi -->|"uses"| node_summary
node_scenarioapi -->|"reads and writes"| node_database
node_database -->|"uses schema"| node_schema
node_database -->|"uses"| node_localstore

click node_app "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/App.tsx"
click node_home "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/pages/Home.tsx"
click node_networkviz "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/components/NetworkGraph.tsx"
click node_charts "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/components/ScenarioCharts.tsx"
click node_reportpreview "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/components/ScenarioReportPreview.tsx"
click node_sharedreport "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/pages/SharedReport.tsx"
click node_epidemictypes "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/epidemic.ts"
click node_engine "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/epidemicEngine.ts"
click node_interventions "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/interventions.ts"
click node_sensitivity "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/sensitivityAnalysis.ts"
click node_selection "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/initialInfectionSelection.ts"
click node_osm "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/osmImport.ts"
click node_explanation "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/decisionExplanation.ts"
click node_summary "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/explanationSummary.ts"
click node_apiroot "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers.ts"
click node_scenarioapi "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/scenarios.ts"
click node_osmapi "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/osm.ts"
click node_explanationapi "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/explanations.ts"
click node_database "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/db.ts"
click node_schema "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/drizzle/schema.ts"
click node_localstore "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/desktopLocalStore.ts"
click node_trpcclient "https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/main.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_app,node_home,node_networkviz,node_charts,node_reportpreview,node_sharedreport,node_trpcclient toneBlue
class node_epidemictypes,node_engine,node_interventions,node_sensitivity,node_selection toneAmber
class node_osm,node_explanation,node_summary,node_apiroot,node_scenarioapi,node_osmapi,node_explanationapi toneMint
class node_database,node_schema,node_localstore toneRose
class node_user toneIndigo
```

## Components

### Scenario application

- [Web app routes](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Scenario workspace](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/pages/Home.tsx): `client/src/pages/Home.tsx`
- [Network visualization](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/components/NetworkGraph.tsx): `client/src/components/NetworkGraph.tsx`
- [Outcome charts](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/components/ScenarioCharts.tsx): `client/src/components/ScenarioCharts.tsx`
- [Report preview](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/components/ScenarioReportPreview.tsx): `client/src/components/ScenarioReportPreview.tsx`
- [Shared report view](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/pages/SharedReport.tsx): `client/src/pages/SharedReport.tsx`
- [API client](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/client/src/main.tsx): `client/src/main.tsx`

### Epidemic modeling

- [Graph and epidemic types](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/epidemic.ts): `shared/epidemic.ts`
- [SIR simulation engine](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/epidemicEngine.ts): `shared/epidemicEngine.ts`
- [Intervention strategies](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/interventions.ts): `shared/interventions.ts`
- [Sensitivity analysis](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/sensitivityAnalysis.ts): `shared/sensitivityAnalysis.ts`
- [Initial infection selection](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/initialInfectionSelection.ts): `shared/initialInfectionSelection.ts`

### Application services

- [OpenStreetMap import](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/osmImport.ts): `server/osmImport.ts`
- [Decision explanations](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/decisionExplanation.ts): `server/decisionExplanation.ts`
- [Explanation summaries](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/shared/explanationSummary.ts): `shared/explanationSummary.ts`
- [tRPC API routes](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers.ts): `server/routers.ts`
- [Scenario and report API](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/scenarios.ts): `server/routers/scenarios.ts`
- [OSM API](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/osm.ts): `server/routers/osm.ts`
- [Explanation API](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/routers/explanations.ts): `server/routers/explanations.ts`

### Scenario persistence

- [Scenario database](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/db.ts): `server/db.ts`
- [Persistent data schema](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/drizzle/schema.ts): `drizzle/schema.ts`
- [Desktop local store](https://github.com/varad-lingayat/epidemic-intervention-planner/blob/main/server/desktopLocalStore.ts): `server/desktopLocalStore.ts`

### Other components

- **Planner**

## Connections

- Planner → Web app routes: opens (evidence: `client/src/App.tsx`)
- Web app routes → Scenario workspace: routes to (evidence: `client/src/App.tsx`)
- Web app routes → Shared report view: routes to (evidence: `client/src/App.tsx`)
- API client → Web app routes: renders (evidence: `client/src/main.tsx`)
- Report preview → Network visualization: renders (evidence: `client/src/components/ScenarioReportPreview.tsx`)
- Report preview → Outcome charts: renders (evidence: `client/src/components/ScenarioReportPreview.tsx`)
- SIR simulation engine → Graph and epidemic types: uses types (evidence: `shared/epidemicEngine.ts`)
- Intervention strategies → Graph and epidemic types: uses (evidence: `shared/interventions.ts`)
- Intervention strategies → SIR simulation engine: uses (evidence: `shared/interventions.ts`)
- tRPC API routes → OSM API: registers (evidence: `server/routers.ts`)
- tRPC API routes → Scenario and report API: registers (evidence: `server/routers.ts`)
- tRPC API routes → Explanation API: registers (evidence: `server/routers.ts`)
- OSM API → OpenStreetMap import: calls (evidence: `server/routers/osm.ts`)
- Explanation API → Decision explanations: calls (evidence: `server/routers/explanations.ts`)
- Explanation API → Explanation summaries: uses (evidence: `server/routers/explanations.ts`)
- Scenario and report API → Scenario database: reads and writes (evidence: `server/routers/scenarios.ts`)
- Scenario database → Persistent data schema: uses schema (evidence: `server/db.ts`)
- Scenario database → Desktop local store: uses (evidence: `server/db.ts`)
