# bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling- architecture

> Architecture diagram of the GitHub repository bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-
- Repository: https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-

## Overview

This repository is an R analysis of ward-level temperature-related mortality in Birmingham. Its principal workflow converts gridded temperatures and registered deaths into ward-level analysis inputs, fits a spatial Bayesian distributed-lag model, derives ward-specific minimum-mortality-temperature estimates, and calculates attributable mortality. Separate DPH scripts support report-period exposure, attribution, baseline mortality, heatwave analysis, and static figures. The README documents these capabilities and the main workflow; source excerpts were unavailable, so uncertain implementation links are omitted.

Main entry points: [`figs`](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/tree/main/figs) (Analysis figures), [`R/04_plot_inla_res.R`](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/04_plot_inla_res.R) (INLA results plots), [`R/01_raster_to_time_series_ward.R`](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/01_raster_to_time_series_ward.R) (Ward temperature series), [`R/03_bayesain_spatial_dnlm.R`](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/03_bayesain_spatial_dnlm.R) (Spatial Bayesian DLNM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_exposure["Exposure data"]
  node_temperature_series["Ward temperature series"]
end

subgraph group_model["Mortality modelling"]
  node_mortality_inputs["Daily ward deaths"]
  node_spatial_model["Spatial Bayesian DLNM"]
  node_inla_results["INLA results plots<br/>[04_plot_inla_res.R]"]
end

subgraph group_attribution["Attribution analysis"]
  node_excess_mortality["Excess mortality"]
  node_baseline["Baseline mortality"]
end

subgraph group_reporting["DPH reporting"]
  node_dph_temperature["DPH temperature series"]
  node_mmt_draws["DPH MMT draws"]
  node_dph_attribution["DPH attribution"]
  node_heatwave["Heatwave excess deaths"]
  node_static_graphs["DPH static graphs"]
end

node_haduk[("HadUK-Grid")]
node_ward_boundaries["Ward boundaries"]
node_death_register[("BCC death register")]
node_population[("ONS population")]
node_figures["Analysis figures"]

node_haduk -->|"provides raster"| node_temperature_series
node_ward_boundaries -->|"defines wards"| node_temperature_series
node_haduk -->|"provides raster"| node_dph_temperature
node_ward_boundaries -->|"defines wards"| node_dph_temperature
node_death_register -->|"provides deaths"| node_mortality_inputs
node_population -->|"rate denominator"| node_excess_mortality
node_temperature_series -->|"provides exposure"| node_spatial_model
node_mortality_inputs -->|"provides outcomes"| node_spatial_model
node_spatial_model -->|"provides results"| node_inla_results
node_inla_results -->|"provides MMT estimates"| node_excess_mortality
node_dph_temperature -->|"provides exposure"| node_dph_attribution
node_mmt_draws -->|"provides MMT draws"| node_dph_attribution
node_excess_mortality -->|"writes plots"| node_figures
node_inla_results -->|"writes plots"| node_figures
node_dph_attribution -->|"writes plots"| node_figures
node_heatwave -->|"writes plots"| node_figures
node_static_graphs -->|"writes plots"| node_figures

click node_temperature_series "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/01_raster_to_time_series_ward.R"
click node_dph_temperature "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/06a_DPH_raster_to_time_series_ward_2026.R"
click node_mortality_inputs "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/02_all_cause_mortality_process_ward.R"
click node_spatial_model "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/03_bayesain_spatial_dnlm.R"
click node_inla_results "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/04_plot_inla_res.R"
click node_mmt_draws "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/06_DPH_mmt_draws_0_3.R"
click node_excess_mortality "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/05_excess_mort_attr.R"
click node_dph_attribution "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/07_DPH_efficient_excess_mort_attr.R"
click node_baseline "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/08_baseline_mort_ward.R"
click node_heatwave "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/09_DPH_heatwave_em2026.R"
click node_static_graphs "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/10_DPH_report_static_graphs.R"
click node_figures "https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/tree/main/figs"

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_temperature_series toneBlue
class node_mortality_inputs,node_spatial_model,node_inla_results,node_haduk,node_death_register,node_population toneAmber
class node_excess_mortality,node_baseline toneMint
class node_dph_temperature,node_mmt_draws,node_dph_attribution,node_heatwave,node_static_graphs toneRose
class node_ward_boundaries toneIndigo
class node_figures toneTeal
```

## Components

### Exposure data

- [Ward temperature series](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/01_raster_to_time_series_ward.R): `R/01_raster_to_time_series_ward.R`

### Mortality modelling

- [Daily ward deaths](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/02_all_cause_mortality_process_ward.R): `R/02_all_cause_mortality_process_ward.R`
- [Spatial Bayesian DLNM](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/03_bayesain_spatial_dnlm.R): `R/03_bayesain_spatial_dnlm.R`
- [INLA results plots](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/04_plot_inla_res.R): `R/04_plot_inla_res.R`

### Attribution analysis

- [Excess mortality](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/05_excess_mort_attr.R): `R/05_excess_mort_attr.R`
- [Baseline mortality](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/08_baseline_mort_ward.R): `R/08_baseline_mort_ward.R`

### DPH reporting

- [DPH temperature series](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/06a_DPH_raster_to_time_series_ward_2026.R): `R/06a_DPH_raster_to_time_series_ward_2026.R`
- [DPH MMT draws](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/06_DPH_mmt_draws_0_3.R): `R/06_DPH_mmt_draws_0_3.R`
- [DPH attribution](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/07_DPH_efficient_excess_mort_attr.R): `R/07_DPH_efficient_excess_mort_attr.R`
- [Heatwave excess deaths](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/09_DPH_heatwave_em2026.R): `R/09_DPH_heatwave_em2026.R`
- [DPH static graphs](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/blob/main/R/10_DPH_report_static_graphs.R): `R/10_DPH_report_static_graphs.R`

### Other components

- **HadUK-Grid**
- **Ward boundaries**
- **BCC death register**
- **ONS population**
- [Analysis figures](https://github.com/bcc-phm/spatial-bayesian-dlnm-extreme-heat-and-cold-modelling-/tree/main/figs): `figs`

## Connections

- HadUK-Grid → Ward temperature series: provides raster
- Ward boundaries → Ward temperature series: defines wards
- HadUK-Grid → DPH temperature series: provides raster
- Ward boundaries → DPH temperature series: defines wards
- BCC death register → Daily ward deaths: provides deaths
- ONS population → Excess mortality: rate denominator
- Ward temperature series → Spatial Bayesian DLNM: provides exposure
- Daily ward deaths → Spatial Bayesian DLNM: provides outcomes
- Spatial Bayesian DLNM → INLA results plots: provides results
- INLA results plots → Excess mortality: provides MMT estimates
- DPH temperature series → DPH attribution: provides exposure
- DPH MMT draws → DPH attribution: provides MMT draws
- Excess mortality → Analysis figures: writes plots
- INLA results plots → Analysis figures: writes plots
- DPH attribution → Analysis figures: writes plots
- Heatwave excess deaths → Analysis figures: writes plots
- DPH static graphs → Analysis figures: writes plots
