# reeper316099/resistancescope architecture

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

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

## Overview

ResistanceScope is an offline desktop explorer for antibiotic-resistance data. Its data workflow turns public NCBI files into normalized, aggregated, validated JSON; the app embeds that data, serves Go-backed queries and statistics, and presents organism, gene, drug-class, and overview views for users. The graph keeps the Python data pipeline distinct from the desktop runtime and groups related core calculations. Some pipeline and core modules were not excerpted, so their relationships are shown only where the README or indexed references support them.

Main entry points: [`go/shell/api.go`](https://github.com/reeper316099/resistancescope/blob/main/go/shell/api.go) (Shell API), [`go/frontend/web/app.js`](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/app.js) (Web app controller), [`pipeline/aggregate.py`](https://github.com/reeper316099/resistancescope/blob/main/pipeline/aggregate.py) (Aggregate isolates), [`go/frontend/web/api.js`](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/api.js) (Page API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Data pipeline"]
  node_download["Download inputs<br/>[download.py]"]
  node_parse["Parse records<br/>[parse_pathogen.py]"]
  node_catalog["Parse gene catalog<br/>[parse_catalog.py]"]
  node_normalize["Normalize data<br/>[normalizers.py]"]
  node_aggregate["Aggregate isolates<br/>[aggregate.py]"]
  node_country["Country mapping<br/>[countries.py]"]
  node_validate["Validate outputs<br/>[validate.py]"]
  node_data[("Shipped JSON data<br/>[config.py]")]
end

subgraph group_core["Go data and analysis"]
  node_store[("Data store<br/>[store.go]")]
  node_validation["Data validation<br/>[validate.go]"]
  node_queries["Query and statistics<br/>[queries.go]"]
  node_organism["Organism analysis<br/>[organismview.go]"]
  node_gene["Gene analysis<br/>[geneview.go]"]
  node_overview["Overview analysis<br/>[overview.go]"]
  node_search["Search<br/>[search.go]"]
  node_export["CSV export<br/>[export.go]"]
  node_narrative["Narrative summaries<br/>[narrative.go]"]
  node_worldmap["Map and country data<br/>[worldmap.go]"]
end

subgraph group_runtime["Desktop runtime"]
  node_embedded["Embedded data access<br/>[embed.go]"]
  node_api["Shell API<br/>[api.go]"]
  node_desktop["Wails desktop app<br/>[main.go]"]
end

subgraph group_web["Explorer interface"]
  node_web["Web app controller<br/>[app.js]"]
  node_api_client["Page API client<br/>[api.js]"]
  node_organism_view["Organism view<br/>[organism.js]"]
  node_gene_view["Gene view<br/>[gene.js]"]
  node_drug_view["Drug class view<br/>[drugClass.js]"]
  node_overview_view["Overview view<br/>[overview.js]"]
  node_charts["Charts and visuals"]
  node_preferences[("Local preferences<br/>[storage.js]")]
end

node_user(("Explorer user"))
node_ncbi[("NCBI data")]

node_ncbi -->|"provides files"| node_download
node_download -.->|"feeds records"| node_parse
node_parse -->|"yields isolates"| node_aggregate
node_catalog -->|"supplies catalog"| node_aggregate
node_normalize -->|"filters calls"| node_aggregate
node_country -->|"maps countries"| node_normalize
node_aggregate -.->|"checks output"| node_validate
node_aggregate -->|"writes JSON"| node_data
node_validate -->|"validates files"| node_data
node_data -->|"ships within app"| node_embedded
node_embedded -->|"loads data"| node_store
node_store -.->|"validates dataset"| node_validation
node_desktop -->|"creates API"| node_api
node_api -->|"uses data store"| node_store
node_api -->|"serves queries"| node_queries
node_api -.->|"serves organism data"| node_organism
node_api -.->|"serves gene data"| node_gene
node_api -.->|"serves overview"| node_overview
node_api -.->|"serves search"| node_search
node_api -.->|"serves exports"| node_export
node_api -.->|"serves summaries"| node_narrative
node_api -.->|"serves map data"| node_worldmap
node_user -->|"explores data"| node_web
node_web -->|"routes requests"| node_api_client
node_api_client -->|"calls methods"| node_api
node_web -.->|"renders view"| node_organism_view
node_web -.->|"renders view"| node_gene_view
node_web -.->|"renders view"| node_drug_view
node_web -.->|"renders view"| node_overview_view
node_organism_view -->|"requests data"| node_api_client
node_gene_view -->|"requests data"| node_api_client
node_organism_view -->|"renders charts"| node_charts
node_gene_view -->|"renders charts"| node_charts
node_web -->|"reads preferences"| node_preferences
node_user -->|"opens app"| node_desktop

click node_download "https://github.com/reeper316099/resistancescope/blob/main/pipeline/download.py"
click node_parse "https://github.com/reeper316099/resistancescope/blob/main/pipeline/parse_pathogen.py"
click node_catalog "https://github.com/reeper316099/resistancescope/blob/main/pipeline/parse_catalog.py"
click node_normalize "https://github.com/reeper316099/resistancescope/blob/main/pipeline/normalizers.py"
click node_aggregate "https://github.com/reeper316099/resistancescope/blob/main/pipeline/aggregate.py"
click node_country "https://github.com/reeper316099/resistancescope/blob/main/pipeline/countries.py"
click node_validate "https://github.com/reeper316099/resistancescope/blob/main/pipeline/validate.py"
click node_data "https://github.com/reeper316099/resistancescope/blob/main/pipeline/config.py"
click node_embedded "https://github.com/reeper316099/resistancescope/blob/main/go/embeddata/embed.go"
click node_store "https://github.com/reeper316099/resistancescope/blob/main/go/core/store.go"
click node_validation "https://github.com/reeper316099/resistancescope/blob/main/go/core/validate.go"
click node_queries "https://github.com/reeper316099/resistancescope/blob/main/go/core/queries.go"
click node_organism "https://github.com/reeper316099/resistancescope/blob/main/go/core/organismview.go"
click node_gene "https://github.com/reeper316099/resistancescope/blob/main/go/core/geneview.go"
click node_overview "https://github.com/reeper316099/resistancescope/blob/main/go/core/overview.go"
click node_search "https://github.com/reeper316099/resistancescope/blob/main/go/core/search.go"
click node_export "https://github.com/reeper316099/resistancescope/blob/main/go/core/export.go"
click node_narrative "https://github.com/reeper316099/resistancescope/blob/main/go/core/narrative.go"
click node_worldmap "https://github.com/reeper316099/resistancescope/blob/main/go/core/worldmap.go"
click node_api "https://github.com/reeper316099/resistancescope/blob/main/go/shell/api.go"
click node_desktop "https://github.com/reeper316099/resistancescope/blob/main/go/main.go"
click node_web "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/app.js"
click node_api_client "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/api.js"
click node_organism_view "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/organism.js"
click node_gene_view "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/gene.js"
click node_drug_view "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/drugClass.js"
click node_overview_view "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/overview.js"
click node_charts "https://github.com/reeper316099/resistancescope/tree/main/go/frontend/web/charts"
click node_preferences "https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/storage.js"

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_download,node_parse,node_catalog,node_normalize,node_aggregate,node_country,node_validate,node_data,node_user toneBlue
class node_store,node_validation,node_queries,node_organism,node_gene,node_overview,node_search,node_export,node_narrative,node_worldmap,node_ncbi toneAmber
class node_embedded,node_api,node_desktop toneMint
class node_web,node_api_client,node_organism_view,node_gene_view,node_drug_view,node_overview_view,node_charts,node_preferences toneRose
```

## Components

### Data pipeline

- [Download inputs](https://github.com/reeper316099/resistancescope/blob/main/pipeline/download.py): `pipeline/download.py`
- [Parse records](https://github.com/reeper316099/resistancescope/blob/main/pipeline/parse_pathogen.py): `pipeline/parse_pathogen.py`
- [Parse gene catalog](https://github.com/reeper316099/resistancescope/blob/main/pipeline/parse_catalog.py): `pipeline/parse_catalog.py`
- [Normalize data](https://github.com/reeper316099/resistancescope/blob/main/pipeline/normalizers.py): `pipeline/normalizers.py`
- [Aggregate isolates](https://github.com/reeper316099/resistancescope/blob/main/pipeline/aggregate.py): `pipeline/aggregate.py`
- [Country mapping](https://github.com/reeper316099/resistancescope/blob/main/pipeline/countries.py): `pipeline/countries.py`
- [Validate outputs](https://github.com/reeper316099/resistancescope/blob/main/pipeline/validate.py): `pipeline/validate.py`
- [Shipped JSON data](https://github.com/reeper316099/resistancescope/blob/main/pipeline/config.py): `pipeline/config.py`

### Go data and analysis

- [Data store](https://github.com/reeper316099/resistancescope/blob/main/go/core/store.go): `go/core/store.go`
- [Data validation](https://github.com/reeper316099/resistancescope/blob/main/go/core/validate.go): `go/core/validate.go`
- [Query and statistics](https://github.com/reeper316099/resistancescope/blob/main/go/core/queries.go): `go/core/queries.go`
- [Organism analysis](https://github.com/reeper316099/resistancescope/blob/main/go/core/organismview.go): `go/core/organismview.go`
- [Gene analysis](https://github.com/reeper316099/resistancescope/blob/main/go/core/geneview.go): `go/core/geneview.go`
- [Overview analysis](https://github.com/reeper316099/resistancescope/blob/main/go/core/overview.go): `go/core/overview.go`
- [Search](https://github.com/reeper316099/resistancescope/blob/main/go/core/search.go): `go/core/search.go`
- [CSV export](https://github.com/reeper316099/resistancescope/blob/main/go/core/export.go): `go/core/export.go`
- [Narrative summaries](https://github.com/reeper316099/resistancescope/blob/main/go/core/narrative.go): `go/core/narrative.go`
- [Map and country data](https://github.com/reeper316099/resistancescope/blob/main/go/core/worldmap.go): `go/core/worldmap.go`

### Desktop runtime

- [Embedded data access](https://github.com/reeper316099/resistancescope/blob/main/go/embeddata/embed.go): `go/embeddata/embed.go`
- [Shell API](https://github.com/reeper316099/resistancescope/blob/main/go/shell/api.go): `go/shell/api.go`
- [Wails desktop app](https://github.com/reeper316099/resistancescope/blob/main/go/main.go): `go/main.go`

### Explorer interface

- [Web app controller](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/app.js): `go/frontend/web/app.js`
- [Page API client](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/api.js): `go/frontend/web/api.js`
- [Organism view](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/organism.js): `go/frontend/web/views/organism.js`
- [Gene view](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/gene.js): `go/frontend/web/views/gene.js`
- [Drug class view](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/drugClass.js): `go/frontend/web/views/drugClass.js`
- [Overview view](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/views/overview.js): `go/frontend/web/views/overview.js`
- [Charts and visuals](https://github.com/reeper316099/resistancescope/tree/main/go/frontend/web/charts): `go/frontend/web/charts`
- [Local preferences](https://github.com/reeper316099/resistancescope/blob/main/go/frontend/web/storage.js): `go/frontend/web/storage.js`

### Other components

- **Explorer user**
- **NCBI data**

## Connections

- NCBI data → Download inputs: provides files (evidence: `README.md`)
- Download inputs → Parse records: feeds records
- Parse records → Aggregate isolates: yields isolates (evidence: `pipeline/aggregate.py`)
- Parse gene catalog → Aggregate isolates: supplies catalog (evidence: `pipeline/aggregate.py`)
- Normalize data → Aggregate isolates: filters calls (evidence: `pipeline/aggregate.py`)
- Country mapping → Normalize data: maps countries (evidence: `pipeline/normalizers.py`)
- Aggregate isolates → Validate outputs: checks output
- Aggregate isolates → Shipped JSON data: writes JSON (evidence: `pipeline/aggregate.py`)
- Validate outputs → Shipped JSON data: validates files (evidence: `pipeline/validate.py`)
- Shipped JSON data → Embedded data access: ships within app (evidence: `README.md`)
- Embedded data access → Data store: loads data
- Data store → Data validation: validates dataset
- Wails desktop app → Shell API: creates API (evidence: `go/main.go`)
- Shell API → Data store: uses data store
- Shell API → Query and statistics: serves queries (evidence: `go/shell/api.go`)
- Shell API → Organism analysis: serves organism data
- Shell API → Gene analysis: serves gene data
- Shell API → Overview analysis: serves overview
- Shell API → Search: serves search
- Shell API → CSV export: serves exports
- Shell API → Narrative summaries: serves summaries
- Shell API → Map and country data: serves map data
- Explorer user → Web app controller: explores data (evidence: `README.md`)
- Web app controller → Page API client: routes requests (evidence: `go/frontend/web/app.js`)
- Page API client → Shell API: calls methods (evidence: `go/frontend/web/api.js`)
- Web app controller → Organism view: renders view (evidence: `go/frontend/web/app.js`)
- Web app controller → Gene view: renders view (evidence: `go/frontend/web/app.js`)
- Web app controller → Drug class view: renders view (evidence: `go/frontend/web/app.js`)
- Web app controller → Overview view: renders view (evidence: `go/frontend/web/app.js`)
- Organism view → Page API client: requests data (evidence: `go/frontend/web/views/organism.js`)
- Gene view → Page API client: requests data (evidence: `go/frontend/web/views/gene.js`)
- Organism view → Charts and visuals: renders charts (evidence: `go/frontend/web/views/organism.js`)
- Gene view → Charts and visuals: renders charts (evidence: `go/frontend/web/views/gene.js`)
- Web app controller → Local preferences: reads preferences (evidence: `go/frontend/web/app.js`)
- Explorer user → Wails desktop app: opens app (evidence: `README.md`)
