# reeper316099/pathogenexplorer architecture

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

- Interactive diagram: https://gitdiagram.com/reeper316099/pathogenexplorer
- Repository: https://github.com/reeper316099/pathogenexplorer

## Overview

PathogenExplorer is a desktop infectious-organism reference. The main workflow runs from a user's search through taxon resolution, multi-source profile assembly, and a provenance-rich profile displayed in the UI. Separate branches support browsing, comparison, exports, and a saved-organism dashboard. The graph reflects the README’s documented capabilities and shown package references; several UI views and source adapters were not sampled, so their internal call details are not inferred.

Main entry points: [`app.go`](https://github.com/reeper316099/pathogenexplorer/blob/main/app.go) (App service), [`frontend/src/ui`](https://github.com/reeper316099/pathogenexplorer/tree/main/frontend/src/ui) (UI shell and views), [`internal/profile/builder.go`](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/profile/builder.go) (Profile builder), [`frontend/src/api/wailsBackend.ts`](https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/wailsBackend.ts) (Wails adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Desktop interface"]
  node_ui_shell["UI shell and views"]
  node_ui_router["Hash router<br/>[router.ts]"]
  node_ui_api["Backend contract<br/>[backend.ts]"]
  node_ui_wails["Wails adapter<br/>[wailsBackend.ts]"]
  node_ui_schemas["Reply validation<br/>[schemas.ts]"]
end

subgraph group_domain["Organism services"]
  node_app["App service<br/>[app.go]"]
  node_resolve["Search and resolution<br/>[resolve.go]"]
  node_ranking["Search ranking<br/>[rank.go]"]
  node_profile["Profile builder<br/>[builder.go]"]
  node_merge["Profile merge<br/>[merge.go]"]
  node_coverage["Coverage calculation<br/>[coverage.go]"]
  node_browse["Organism browse<br/>[browse.go]"]
  node_compare["Profile comparison<br/>[compare.go]"]
  node_safety["Treatment safety<br/>[safety.go]"]
end

subgraph group_data["Sources and transport"]
  node_source_adapters["Source adapters"]
  node_network["HTTPS policy client<br/>[client.go]"]
  node_fetch["Fetch and cache<br/>[fetch.go]"]
end

subgraph group_state["Local state and output"]
  node_cache[("Disk cache<br/>[cache.go]")]
  node_library[("Organism library<br/>[library.go]")]
  node_export["Profile export<br/>[export.go]"]
end

node_user(("User"))
node_external_sources{{"Public data sources"}}
node_os_browser(("System browser"))

node_user -->|"uses"| node_ui_shell
node_ui_shell -->|"navigates"| node_ui_router
node_ui_shell -->|"requests data"| node_ui_api
node_ui_api -->|"implemented by"| node_ui_wails
node_ui_wails -->|"calls bound methods"| node_app
node_ui_wails -->|"validates replies"| node_ui_schemas
node_app -->|"resolves queries"| node_resolve
node_app -->|"builds profiles"| node_profile
node_app -->|"serves browse data"| node_browse
node_app -->|"compares profiles"| node_compare
node_app -->|"records viewed"| node_library
node_app -->|"exports profiles"| node_export
node_resolve -->|"ranks candidates"| node_ranking
node_resolve -->|"queries taxonomy"| node_source_adapters
node_profile -->|"collects source data"| node_source_adapters
node_profile -->|"fetches responses"| node_fetch
node_profile -->|"merges results"| node_merge
node_merge -.->|"counts completeness"| node_coverage
node_merge -.->|"filters treatment text"| node_safety
node_source_adapters -->|"sends requests"| node_network
node_network -->|"HTTPS requests"| node_external_sources
node_fetch -->|"reads and writes"| node_cache
node_ui_shell -->|"shows attribution"| node_external_sources
node_ui_shell -->|"opens source links"| node_os_browser

click node_ui_shell "https://github.com/reeper316099/pathogenexplorer/tree/main/frontend/src/ui"
click node_ui_router "https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/router.ts"
click node_ui_api "https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/backend.ts"
click node_ui_wails "https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/wailsBackend.ts"
click node_ui_schemas "https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/schemas.ts"
click node_app "https://github.com/reeper316099/pathogenexplorer/blob/main/app.go"
click node_resolve "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/resolve/resolve.go"
click node_ranking "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/search/rank.go"
click node_profile "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/profile/builder.go"
click node_merge "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/merge/merge.go"
click node_coverage "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/model/coverage.go"
click node_browse "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/browse/browse.go"
click node_compare "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/compare/compare.go"
click node_safety "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/safety/safety.go"
click node_source_adapters "https://github.com/reeper316099/pathogenexplorer/tree/main/internal/sources"
click node_network "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/netlayer/client.go"
click node_fetch "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/fetch/fetch.go"
click node_cache "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/cache/cache.go"
click node_library "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/library/library.go"
click node_export "https://github.com/reeper316099/pathogenexplorer/blob/main/internal/export/export.go"

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_shell,node_ui_router,node_ui_api,node_ui_wails,node_ui_schemas,node_user,node_os_browser toneBlue
class node_app,node_resolve,node_ranking,node_profile,node_merge,node_coverage,node_browse,node_compare,node_safety toneAmber
class node_source_adapters,node_network,node_fetch toneMint
class node_cache,node_library,node_export toneRose
class node_external_sources toneIndigo
```

## Components

### Desktop interface

- [UI shell and views](https://github.com/reeper316099/pathogenexplorer/tree/main/frontend/src/ui): `frontend/src/ui`
- [Hash router](https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/router.ts): `frontend/src/router.ts`
- [Backend contract](https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/backend.ts): `frontend/src/api/backend.ts`
- [Wails adapter](https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/wailsBackend.ts): `frontend/src/api/wailsBackend.ts`
- [Reply validation](https://github.com/reeper316099/pathogenexplorer/blob/main/frontend/src/api/schemas.ts): `frontend/src/api/schemas.ts`

### Organism services

- [App service](https://github.com/reeper316099/pathogenexplorer/blob/main/app.go): `app.go`
- [Search and resolution](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/resolve/resolve.go): `internal/resolve/resolve.go`
- [Search ranking](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/search/rank.go): `internal/search/rank.go`
- [Profile builder](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/profile/builder.go): `internal/profile/builder.go`
- [Profile merge](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/merge/merge.go): `internal/merge/merge.go`
- [Coverage calculation](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/model/coverage.go): `internal/model/coverage.go`
- [Organism browse](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/browse/browse.go): `internal/browse/browse.go`
- [Profile comparison](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/compare/compare.go): `internal/compare/compare.go`
- [Treatment safety](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/safety/safety.go): `internal/safety/safety.go`

### Sources and transport

- [Source adapters](https://github.com/reeper316099/pathogenexplorer/tree/main/internal/sources): `internal/sources`
- [HTTPS policy client](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/netlayer/client.go): `internal/netlayer/client.go`
- [Fetch and cache](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/fetch/fetch.go): `internal/fetch/fetch.go`

### Local state and output

- [Disk cache](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/cache/cache.go): `internal/cache/cache.go`
- [Organism library](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/library/library.go): `internal/library/library.go`
- [Profile export](https://github.com/reeper316099/pathogenexplorer/blob/main/internal/export/export.go): `internal/export/export.go`

### Other components

- **User**
- **Public data sources**
- **System browser**

## Connections

- User → UI shell and views: uses
- UI shell and views → Hash router: navigates (evidence: `frontend/src/ui/shell.ts`)
- UI shell and views → Backend contract: requests data (evidence: `frontend/src/ui/shell.ts`)
- Backend contract → Wails adapter: implemented by (evidence: `frontend/src/api/wailsBackend.ts`)
- Wails adapter → App service: calls bound methods
- Wails adapter → Reply validation: validates replies (evidence: `frontend/src/api/wailsBackend.ts`)
- App service → Search and resolution: resolves queries (evidence: `app.go`)
- App service → Profile builder: builds profiles
- App service → Organism browse: serves browse data (evidence: `app.go`)
- App service → Profile comparison: compares profiles
- App service → Organism library: records viewed (evidence: `app.go`)
- App service → Profile export: exports profiles
- Search and resolution → Search ranking: ranks candidates (evidence: `internal/resolve/resolve.go`)
- Search and resolution → Source adapters: queries taxonomy (evidence: `internal/resolve/resolve.go`)
- Profile builder → Source adapters: collects source data (evidence: `internal/profile/builder.go`)
- Profile builder → Fetch and cache: fetches responses (evidence: `internal/profile/builder.go`)
- Profile builder → Profile merge: merges results (evidence: `internal/profile/builder.go`)
- Profile merge → Coverage calculation: counts completeness
- Profile merge → Treatment safety: filters treatment text
- Source adapters → HTTPS policy client: sends requests (evidence: `internal/sources/ncbitax/ncbitax.go`)
- HTTPS policy client → Public data sources: HTTPS requests
- Fetch and cache → Disk cache: reads and writes (evidence: `internal/fetch/fetch.go`)
- UI shell and views → Public data sources: shows attribution
- UI shell and views → System browser: opens source links
