# the-strategy-unit/nhp_outputs architecture

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

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

## Overview

NHP Outputs is a Shiny app for exploring scenario results from the New Hospital Programme demand model. Its documented user workflow is to open the app and explore interactive charts and tables or download results; upstream, scenarios are created in nhp_inputs, processed by the model, and stored in Azure for the app to read. The tree identifies modules for information, selection, activity, distribution, and principal-impact views. No source excerpts were supplied, so internal module calls and routing are not asserted; those feature modules are shown without speculative edges.

Main entry points: [`R/run_app.R`](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/run_app.R) (NHP Outputs app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_app["NHP Outputs app<br/>[run_app.R]"]
end

subgraph group_information["Information and downloads"]
  node_info_home["Home information"]
  node_info_params["Parameter information"]
  node_info_downloads["Downloads"]
end

subgraph group_results["Scenario result views"]
  node_measure_selection["Measure selection"]
  node_activity_view["Core activity"]
  node_distribution_view["Result distributions"]
  node_principal_summary["Principal summary"]
  node_principal_los["Length of stay"]
  node_principal_detail["Detailed impact"]
  node_change_factors["Change factors"]
end

subgraph group_upstream["Scenario pipeline"]
  node_azure[("Azure results storage")]
  node_scenario_inputs["Scenario inputs app"]
  node_demand_model["NHP demand model"]
end

node_user(("App user"))

node_user -->|"explores results"| node_app
node_scenario_inputs -->|"provides scenarios"| node_demand_model
node_demand_model -->|"stores results"| node_azure
node_azure -->|"app reads"| node_app

click node_app "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/run_app.R"
click node_info_home "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_info_home_server.R"
click node_info_params "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_info_params_server.R"
click node_info_downloads "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_info_downloads_server.R"
click node_measure_selection "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_measure_selection_server.R"
click node_activity_view "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_model_core_activity_server.R"
click node_distribution_view "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_model_results_distribution_server.R"
click node_principal_summary "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_summary_server.R"
click node_principal_los "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_summary_los_server.R"
click node_principal_detail "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_detailed_server.R"
click node_change_factors "https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_change_factor_effects_server.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_app,node_user toneBlue
class node_info_home,node_info_params,node_info_downloads toneAmber
class node_measure_selection,node_activity_view,node_distribution_view,node_principal_summary,node_principal_los,node_principal_detail,node_change_factors toneMint
class node_azure,node_scenario_inputs,node_demand_model toneRose
```

## Components

### App runtime

- [NHP Outputs app](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/run_app.R): `R/run_app.R`

### Information and downloads

- [Home information](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_info_home_server.R): `R/mod_info_home_server.R`
- [Parameter information](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_info_params_server.R): `R/mod_info_params_server.R`
- [Downloads](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_info_downloads_server.R): `R/mod_info_downloads_server.R`

### Scenario result views

- [Measure selection](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_measure_selection_server.R): `R/mod_measure_selection_server.R`
- [Core activity](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_model_core_activity_server.R): `R/mod_model_core_activity_server.R`
- [Result distributions](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_model_results_distribution_server.R): `R/mod_model_results_distribution_server.R`
- [Principal summary](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_summary_server.R): `R/mod_principal_summary_server.R`
- [Length of stay](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_summary_los_server.R): `R/mod_principal_summary_los_server.R`
- [Detailed impact](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_detailed_server.R): `R/mod_principal_detailed_server.R`
- [Change factors](https://github.com/the-strategy-unit/nhp_outputs/blob/main/R/mod_principal_change_factor_effects_server.R): `R/mod_principal_change_factor_effects_server.R`

### Scenario pipeline

- **Azure results storage**
- **Scenario inputs app**
- **NHP demand model**

### Other components

- **App user**

## Connections

- App user → NHP Outputs app: explores results (evidence: `README.md`)
- Scenario inputs app → NHP demand model: provides scenarios (evidence: `README.md`)
- NHP demand model → Azure results storage: stores results (evidence: `README.md`)
- Azure results storage → NHP Outputs app: app reads (evidence: `README.md`)
