# the-strategy-unit/tpma-explorer architecture

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

- Interactive diagram: https://gitdiagram.com/the-strategy-unit/tpma-explorer
- Repository: https://github.com/the-strategy-unit/tpma-explorer

## Overview

TPMA Explorer is a Shiny app for exploring hospital activity that may be mitigated. The documented workflow is to launch the app, fetch versioned parquet inputs from Azure, and explore them through interactive views. The tree identifies selection, visualization, table, and strategy-text modules; the README describes these as Shiny modules and names the main data and output layers. No source excerpts were provided, so internal call ownership and links among individual views are not verified; those relationships are omitted.

Main entry points: [`R/run_app.R`](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/run_app.R) (App launcher), [`R/app_ui.R`](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/app_ui.R) (App interface), [`R/utils_data.R`](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/utils_data.R) (Data preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_launcher["App launcher<br/>[run_app.R]"]
  node_app_ui["App interface<br/>[app_ui.R]"]
  node_app_server["App server<br/>[app_server.R]"]
end

subgraph group_inputs["Data inputs"]
  node_data_helpers["Data preparation<br/>[utils_data.R]"]
  node_azure[("Azure parquet inputs")]
  node_reference[("Reference lookups")]
end

subgraph group_selection["User selections"]
  node_geography["Geography selection"]
  node_provider["Provider selection"]
  node_strategy["Strategy selection"]
end

subgraph group_exploration["Exploration views"]
  node_overview["Activity overview<br/>[mod_overview.R]"]
  node_age_sex["Age-sex pyramid"]
  node_nee["NEE view<br/>[mod_plot_nee.R]"]
  node_rates["Rates view<br/>[mod_plot_rates.R]"]
  node_rates_box["Rates box plot"]
  node_rates_funnel["Rates funnel"]
  node_rates_trend["Rates trend"]
  node_diagnoses["Diagnosis table"]
  node_procedures["Procedure table"]
  node_strategy_text["Strategy descriptions"]
end

node_user(("App user"))

node_user -->|"uses"| node_app_ui
node_launcher -->|"downloads inputs"| node_azure
node_azure -->|"provides parquet"| node_data_helpers

click node_launcher "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/run_app.R"
click node_app_ui "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/app_ui.R"
click node_app_server "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/app_server.R"
click node_data_helpers "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/utils_data.R"
click node_reference "https://github.com/the-strategy-unit/tpma-explorer/tree/main/inst/app/reference"
click node_geography "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_select_geography.R"
click node_provider "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_select_provider.R"
click node_strategy "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_select_strategy.R"
click node_overview "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_overview.R"
click node_age_sex "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_age_sex_pyramid.R"
click node_nee "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_nee.R"
click node_rates "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates.R"
click node_rates_box "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates_box.R"
click node_rates_funnel "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates_funnel.R"
click node_rates_trend "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates_trend.R"
click node_diagnoses "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_table_diagnoses.R"
click node_procedures "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_table_procedures.R"
click node_strategy_text "https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_show_strategy_text.R"

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_launcher,node_app_ui,node_app_server,node_user toneBlue
class node_data_helpers,node_azure,node_reference toneAmber
class node_geography,node_provider,node_strategy toneMint
class node_overview,node_age_sex,node_nee,node_rates,node_rates_box,node_rates_funnel,node_rates_trend,node_diagnoses,node_procedures,node_strategy_text toneRose
```

## Components

### App runtime

- [App launcher](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/run_app.R): `R/run_app.R`
- [App interface](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/app_ui.R): `R/app_ui.R`
- [App server](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/app_server.R): `R/app_server.R`

### Data inputs

- [Data preparation](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/utils_data.R): `R/utils_data.R`
- **Azure parquet inputs**
- [Reference lookups](https://github.com/the-strategy-unit/tpma-explorer/tree/main/inst/app/reference): `inst/app/reference`

### User selections

- [Geography selection](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_select_geography.R): `R/mod_select_geography.R`
- [Provider selection](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_select_provider.R): `R/mod_select_provider.R`
- [Strategy selection](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_select_strategy.R): `R/mod_select_strategy.R`

### Exploration views

- [Activity overview](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_overview.R): `R/mod_overview.R`
- [Age-sex pyramid](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_age_sex_pyramid.R): `R/mod_plot_age_sex_pyramid.R`
- [NEE view](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_nee.R): `R/mod_plot_nee.R`
- [Rates view](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates.R): `R/mod_plot_rates.R`
- [Rates box plot](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates_box.R): `R/mod_plot_rates_box.R`
- [Rates funnel](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates_funnel.R): `R/mod_plot_rates_funnel.R`
- [Rates trend](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_plot_rates_trend.R): `R/mod_plot_rates_trend.R`
- [Diagnosis table](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_table_diagnoses.R): `R/mod_table_diagnoses.R`
- [Procedure table](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_table_procedures.R): `R/mod_table_procedures.R`
- [Strategy descriptions](https://github.com/the-strategy-unit/tpma-explorer/blob/main/R/mod_show_strategy_text.R): `R/mod_show_strategy_text.R`

### Other components

- **App user**

## Connections

- App user → App interface: uses (evidence: `README.md`)
- App launcher → Azure parquet inputs: downloads inputs (evidence: `README.md`)
- Azure parquet inputs → Data preparation: provides parquet (evidence: `README.md`)
