From 9e5ca7b372ddb338db4bc3c71d5dc91e15229496 Mon Sep 17 00:00:00 2001
From: Matt Dray <18232097+matt-dray@users.noreply.github.com>
Date: Wed, 4 Feb 2026 15:58:52 +0000
Subject: [PATCH 1/5] Add info tooltips above select inputs
---
R/mod_select_geography.R | 8 +++++++-
R/mod_select_provider.R | 17 +++++++----------
R/mod_select_strategy.R | 16 ++++++++++++++--
inst/app/text/sidebar-selections.md | 2 ++
4 files changed, 30 insertions(+), 13 deletions(-)
create mode 100644 inst/app/text/sidebar-selections.md
diff --git a/R/mod_select_geography.R b/R/mod_select_geography.R
index 2223aee..e86fe85 100644
--- a/R/mod_select_geography.R
+++ b/R/mod_select_geography.R
@@ -5,7 +5,13 @@ mod_select_geography_ui <- function(id) {
ns <- shiny::NS(id)
shiny::selectInput(
ns("geography_select"),
- "Filter by geography:",
+ label = bslib::tooltip(
+ trigger = list(
+ "Filter by geography",
+ bsicons::bs_icon("info-circle")
+ ),
+ md_file_to_html("app", "text", "sidebar-selections.md"),
+ ),
choices = NULL
)
}
diff --git a/R/mod_select_provider.R b/R/mod_select_provider.R
index 3e99622..367e74f 100644
--- a/R/mod_select_provider.R
+++ b/R/mod_select_provider.R
@@ -5,7 +5,13 @@ mod_select_provider_ui <- function(id) {
ns <- shiny::NS(id)
shiny::selectInput(
ns("provider_select"),
- "Choose a statistical unit:",
+ label = bslib::tooltip(
+ trigger = list(
+ "Choose a statistical unit",
+ bsicons::bs_icon("info-circle")
+ ),
+ md_file_to_html("app", "text", "sidebar-selections.md"),
+ ),
choices = NULL
)
}
@@ -34,21 +40,12 @@ mod_select_provider_server <- function(id, selected_geography) {
shiny::bindEvent(selected_geography())
shiny::observe({
- sg <- shiny::req(selected_geography())
providers <- shiny::req(providers())
-
provider_choices <- purrr::set_names(names(providers), providers)
- provider_label <- switch(
- sg,
- "nhp" = "Choose a trust:",
- "la" = "Choose an LA:"
- )
-
shiny::updateSelectInput(
session,
"provider_select",
- label = provider_label,
choices = provider_choices
)
})
diff --git a/R/mod_select_strategy.R b/R/mod_select_strategy.R
index 3e7b4f6..76be8e7 100644
--- a/R/mod_select_strategy.R
+++ b/R/mod_select_strategy.R
@@ -6,7 +6,13 @@ mod_select_strategy_ui <- function(id) {
shiny::tagList(
shiny::selectInput(
ns("strategy_category_select"),
- "Filter by activity type:",
+ label = bslib::tooltip(
+ trigger = list(
+ "Filter by activity type",
+ bsicons::bs_icon("info-circle")
+ ),
+ md_file_to_html("app", "text", "sidebar-selections.md"),
+ ),
choices = c(
"Inpatients" = "ip",
"Outpatients" = "op",
@@ -15,7 +21,13 @@ mod_select_strategy_ui <- function(id) {
),
shiny::selectInput(
ns("strategy_select"),
- "Choose a TPMA:",
+ label = bslib::tooltip(
+ trigger = list(
+ "Choose a TPMA",
+ bsicons::bs_icon("info-circle")
+ ),
+ md_file_to_html("app", "text", "sidebar-selections.md"),
+ ),
choices = NULL
)
)
diff --git a/inst/app/text/sidebar-selections.md b/inst/app/text/sidebar-selections.md
new file mode 100644
index 0000000..0e5333d
--- /dev/null
+++ b/inst/app/text/sidebar-selections.md
@@ -0,0 +1,2 @@
+Choose an option from the dropdown.
+Delete the current selection and start typing to begin a search.
From b6e856598979ff4cbb86518fb2cdd09727e01432 Mon Sep 17 00:00:00 2001
From: Matt Dray <18232097+matt-dray@users.noreply.github.com>
Date: Wed, 4 Feb 2026 19:27:02 +0000
Subject: [PATCH 2/5] Fill out info tab more, add icons
---
DESCRIPTION | 4 ++--
R/app_ui.R | 5 ++++-
inst/app/text/info-data.md | 10 +++++++++-
inst/app/text/info-definitions.md | 4 ++--
inst/app/text/info-interface.md | 10 ++++++----
inst/app/text/info-navigation.md | 17 ++++++-----------
inst/app/text/info-purpose.md | 4 +++-
inst/app/text/viz-diagnoses.md | 4 ++--
8 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 9e568d1..8133f19 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,12 +1,12 @@
Package: tpma.explorer
Title: Explore TPMA Data
-Version: 0.2.0.9000
+Version: 0.3.3.
Authors@R: c(
person("Matt", "Dray", , "matt.dray@nhs.net", role = c("aut", "cre")),
person("Tom", "Jemmett", , "thomas.jemmett@nhs.net", role = "aut")
)
Description: A Shiny-app-in-a-package to explore data related to Types of
- Potentially Mitigatable Activity (TPMAs).
+ Potentially-Mitigatable Activity (TPMAs).
License: MIT + file LICENSE
URL: https://github.com/The-Strategy-Unit/tpma-explorer
BugReports: https://github.com/The-Strategy-Unit/tpma-explorer/issues
diff --git a/R/app_ui.R b/R/app_ui.R
index 388f0db..2de2858 100644
--- a/R/app_ui.R
+++ b/R/app_ui.R
@@ -11,6 +11,7 @@ app_ui <- function(request) {
bslib::nav_panel(
id = "nav_panel_viz",
title = "Visualisations",
+ icon = bsicons::bs_icon("graph-up"),
bslib::card(
fill = FALSE,
@@ -49,6 +50,8 @@ app_ui <- function(request) {
bslib::nav_panel(
id = "nav_panel_info",
title = "Information",
+ icon = bsicons::bs_icon("book"),
+
bslib::layout_columns(
bslib::layout_columns(
col_widths = c(12, 12),
@@ -107,7 +110,7 @@ app_ui <- function(request) {
mod_select_provider_ui("mod_select_provider"),
),
bslib::accordion_panel(
- title = "Types of Potentially Mitigatable Activity (TPMAs)",
+ title = "Types of Potentially-Mitigatable Activity (TPMAs)",
icon = bsicons::bs_icon("hospital"),
mod_select_strategy_ui("mod_select_strategy")
)
diff --git a/inst/app/text/info-data.md b/inst/app/text/info-data.md
index 75ed9b6..a74fa1e 100644
--- a/inst/app/text/info-data.md
+++ b/inst/app/text/info-data.md
@@ -1 +1,9 @@
-Placeholder.
+The majority of the data underpinning this app is a by-product of the modelling process for the New Hospital Programme (NHP).
+
+The primary data source is [Hospital Episode Statistics (HES)](https://digital.nhs.uk/data-and-information/data-tools-and-services/data-services/hospital-episode-statistics).
+Data is suppressed in visualisations where counts are less thatn five.
+
+More information is available on [the NHP model project information website](https://connect.strategyunitwm.nhs.uk/nhp/project_information/).
+That includes detail on [age-sex standardisation](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/direct_standardisation_of_tpmas.html) of TPMAs and how we [derive hospital catchments](https://connect.strategyunitwm.nhs.uk/nhp/project_information/data_extraction/deriving_hospital_catchments.html) for rate calculations.
+
+You can find the Python source code in [the inputs_data scripts](https://github.com/The-Strategy-Unit/nhp_data/tree/main/src/nhp/data/inputs_data) of [the open nhp_data GitHub repository](https://github.com/The-Strategy-Unit/nhp_data).
diff --git a/inst/app/text/info-definitions.md b/inst/app/text/info-definitions.md
index a64a069..5f87822 100644
--- a/inst/app/text/info-definitions.md
+++ b/inst/app/text/info-definitions.md
@@ -1,4 +1,4 @@
-Visit the New Hospital Programme (NHP) project information website to:
+Visit [the New Hospital Programme (NHP) project information website](https://connect.strategyunitwm.nhs.uk/nhp/project_information/) to:
-* view definitions of TPMAs related to the activity types of [inpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/inpatient_activity_mitigators.html), [outpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/outpatient_activity_mitigators.html) and [A&E](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/ae_activity_mitigators.html)
+* view definitions of TPMAs related to [inpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/inpatient_activity_mitigators.html), [outpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/outpatient_activity_mitigators.html) and [A&E](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/ae_activity_mitigators.html) activity types
* see a [TPMA lookup](https://connect.strategyunitwm.nhs.uk/nhp/project_information/user_guide/mitigators_lookup.html), including names, codes and deprecation status
diff --git a/inst/app/text/info-interface.md b/inst/app/text/info-interface.md
index 90db539..8d4980f 100644
--- a/inst/app/text/info-interface.md
+++ b/inst/app/text/info-interface.md
@@ -1,6 +1,8 @@
-You can hover over the **information symbol** () for further information about a visualisation.
+You can hover over the **information symbol** for further details.
-To maximise the space for visualisations, you can:
+To maximise space, you can click the:
-* click the **expand** button () in the lower-right of a plot to expand to full screen
-* collapse the sidebar by clicking the **toggle sidebar** chevron in its upper-right corner
+* **expand** buttons (lower-left of visualisations) to open in fullscreen
+* **toggle-sidebar** chevron (upper-left of sidebar) to collapse/expand the sidebar
+* **toggle-section** chevrons (upper-left of sidebar sections) to collapse/expand sidebar sections
diff --git a/inst/app/text/info-navigation.md b/inst/app/text/info-navigation.md
index a85b696..876b8a6 100644
--- a/inst/app/text/info-navigation.md
+++ b/inst/app/text/info-navigation.md
@@ -1,11 +1,6 @@
-First, make selections in the left-hand panel:
-
-1. From the **Visualisations** section:
- - Select from the **Filter by geography** dropdown to choose a geographical categorisation.
- - Select a statistical unit from the **Choose** dropdown to view its data.
-2. From the **Types of potentially mitigatable activity (TPMAs)** section:
- - Select from the **Filter by activity type** dropdown to choose from a category of TPMAs.
- - Select a TPMA from the **Choose a TPMA** dropdown to view data for that TPMA (your selections will automatically update the content of the **Data** section of the app).
-3. Use the navigation bar at the top to visit different sections of the app. Visit the:
- - **Information** tab (current tab) for background information and instructions.
- - **Visualisations** tab to view a description of the selected TPMA
+1. Use the left-hand sidebar to select (or delete and search for) options under:
+ - **Datasets** section, with a geographical filter
+ - **Types of potentially-mitigatable activity (TPMAs)** section, with an activity-type filter
+2. Use the top navigation bar to visit the:
+ - **Visualisations** tab for summaries of your selected dataset and TPMA
+ - **Information** tab (current tab) for context and instructions
diff --git a/inst/app/text/info-purpose.md b/inst/app/text/info-purpose.md
index 60a3a35..0b53b2f 100644
--- a/inst/app/text/info-purpose.md
+++ b/inst/app/text/info-purpose.md
@@ -1 +1,3 @@
-View summaries of data for **Types of Potentially-Mitigatable Activity (TPMAs)** for statistical units within different geographical categories.
+View data summaries for **Types of Potentially-Mitigatable Activity (TPMAs)** for statistical units within different geographies.
+
+This may help identify opportunities or set parameters for New Hospital Programme (NHP) modelling.
diff --git a/inst/app/text/viz-diagnoses.md b/inst/app/text/viz-diagnoses.md
index 35d4f68..4bf2916 100644
--- a/inst/app/text/viz-diagnoses.md
+++ b/inst/app/text/viz-diagnoses.md
@@ -1,3 +1,3 @@
-Top six diagnoses by activity count for the selected unit and TPMA.
+Top-six diagnoses by activity count for the selected unit and TPMA.
Remaining diagnoses and those with a count less than 5 are absorbed into 'Other'.
-The table may show fewer than six diagnoses or be fully suppressed.
+The table may show fewer than six diagnosis categories, or be fully suppressed.
From 44146180968cf5fb479450de863f497e54637762 Mon Sep 17 00:00:00 2001
From: Matt Dray <18232097+matt-dray@users.noreply.github.com>
Date: Wed, 4 Feb 2026 19:29:17 +0000
Subject: [PATCH 3/5] Revert version for now, until certain
---
DESCRIPTION | 2 +-
man/tpma.explorer-package.Rd | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 8133f19..c5d3d6a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: tpma.explorer
Title: Explore TPMA Data
-Version: 0.3.3.
+Version: 0.2.0.9000
Authors@R: c(
person("Matt", "Dray", , "matt.dray@nhs.net", role = c("aut", "cre")),
person("Tom", "Jemmett", , "thomas.jemmett@nhs.net", role = "aut")
diff --git a/man/tpma.explorer-package.Rd b/man/tpma.explorer-package.Rd
index 5196a8c..565f70c 100644
--- a/man/tpma.explorer-package.Rd
+++ b/man/tpma.explorer-package.Rd
@@ -6,7 +6,7 @@
\alias{tpma.explorer-package}
\title{tpma.explorer: Explore TPMA Data}
\description{
-A Shiny-app-in-a-package to explore data related to Types of Potentially Mitigatable Activity (TPMAs).
+A Shiny-app-in-a-package to explore data related to Types of Potentially-Mitigatable Activity (TPMAs).
}
\seealso{
Useful links:
From b29e416fbfdafe9545b332255d6aa1782dc08992 Mon Sep 17 00:00:00 2001
From: Matt Dray <18232097+matt-dray@users.noreply.github.com>
Date: Thu, 5 Feb 2026 11:47:33 +0000
Subject: [PATCH 4/5] Tweak information card text
---
R/app_ui.R | 9 +++++----
inst/app/text/info-data.md | 11 +++++------
inst/app/text/info-definitions.md | 7 +++++--
inst/app/text/info-navigation.md | 13 +++++++------
inst/app/text/info-purpose.md | 4 +---
inst/app/text/viz-trend.md | 1 +
6 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/R/app_ui.R b/R/app_ui.R
index 2de2858..6e163da 100644
--- a/R/app_ui.R
+++ b/R/app_ui.R
@@ -62,13 +62,13 @@ app_ui <- function(request) {
),
bslib::card(
id = "card_data",
- bslib::card_header("Definitions"),
- md_file_to_html("app", "text", "info-definitions.md")
+ bslib::card_header("Data"),
+ md_file_to_html("app", "text", "info-data.md")
),
bslib::card(
id = "card_data",
- bslib::card_header("Data"),
- md_file_to_html("app", "text", "info-data.md")
+ bslib::card_header("Definitions"),
+ md_file_to_html("app", "text", "info-definitions.md")
)
),
bslib::layout_columns(
@@ -101,6 +101,7 @@ app_ui <- function(request) {
sidebar = bslib::sidebar(
bslib::accordion(
id = "sidebar_accordion",
+
open = FALSE,
multiple = TRUE,
bslib::accordion_panel(
diff --git a/inst/app/text/info-data.md b/inst/app/text/info-data.md
index a74fa1e..6bdbee8 100644
--- a/inst/app/text/info-data.md
+++ b/inst/app/text/info-data.md
@@ -1,9 +1,8 @@
-The majority of the data underpinning this app is a by-product of the modelling process for the New Hospital Programme (NHP).
+The primary data source is [**Hospital Episode Statistics (HES)**](https://digital.nhs.uk/data-and-information/data-tools-and-services/data-services/hospital-episode-statistics).
-The primary data source is [Hospital Episode Statistics (HES)](https://digital.nhs.uk/data-and-information/data-tools-and-services/data-services/hospital-episode-statistics).
-Data is suppressed in visualisations where counts are less thatn five.
-
-More information is available on [the NHP model project information website](https://connect.strategyunitwm.nhs.uk/nhp/project_information/).
-That includes detail on [age-sex standardisation](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/direct_standardisation_of_tpmas.html) of TPMAs and how we [derive hospital catchments](https://connect.strategyunitwm.nhs.uk/nhp/project_information/data_extraction/deriving_hospital_catchments.html) for rate calculations.
+Data is shown for a given **baseline** financial year, which is currently 2023/24, though trend information is also shown.
+Counts of less than five are **suppressed**.
+The data was **prepared** as part of the modelling process for the New Hospital Programme (NHP).
+The [model project information website](https://connect.strategyunitwm.nhs.uk/nhp/project_information/) contains further details, such as [age-sex standardisation](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/direct_standardisation_of_tpmas.html) of TPMAs and how we [derive hospital catchments](https://connect.strategyunitwm.nhs.uk/nhp/project_information/data_extraction/deriving_hospital_catchments.html) for rate calculations.
You can find the Python source code in [the inputs_data scripts](https://github.com/The-Strategy-Unit/nhp_data/tree/main/src/nhp/data/inputs_data) of [the open nhp_data GitHub repository](https://github.com/The-Strategy-Unit/nhp_data).
diff --git a/inst/app/text/info-definitions.md b/inst/app/text/info-definitions.md
index 5f87822..2f4afb4 100644
--- a/inst/app/text/info-definitions.md
+++ b/inst/app/text/info-definitions.md
@@ -1,4 +1,7 @@
Visit [the New Hospital Programme (NHP) project information website](https://connect.strategyunitwm.nhs.uk/nhp/project_information/) to:
-* view definitions of TPMAs related to [inpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/inpatient_activity_mitigators.html), [outpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/outpatient_activity_mitigators.html) and [A&E](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/ae_activity_mitigators.html) activity types
-* see a [TPMA lookup](https://connect.strategyunitwm.nhs.uk/nhp/project_information/user_guide/mitigators_lookup.html), including names, codes and deprecation status
+* view **definitions** for TPMAs related to [inpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/inpatient_activity_mitigators.html), [outpatients](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/outpatient_activity_mitigators.html) and [A&E](https://connect.strategyunitwm.nhs.uk/nhp/project_information/modelling_methodology/activity_mitigators/ae_activity_mitigators.html) activity types
+* see a [**TPMA lookup**](https://connect.strategyunitwm.nhs.uk/nhp/project_information/user_guide/mitigators_lookup.html), including names, codes and deprecation status
+
+**Peers** are nearest statistical neighbours to the chosen unit.
+Peers for NHS provider trusts are from [the NHP Trust Peer Finder Tool](https://app.powerbi.com/view?r=eyJrIjoiMjdiOWQ4YTktNmNiNC00MmIwLThjNzktNWVmMmJmMzllNmViIiwidCI6IjUwZjYwNzFmLWJiZmUtNDAxYS04ODAzLTY3Mzc0OGU2MjllMiIsImMiOjh9) and for local authorities from the [ONS](https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthandwellbeing/adhocs/3048statisticalnearestneighboursforenglishuppertierandlowertierlocalauthorities)
diff --git a/inst/app/text/info-navigation.md b/inst/app/text/info-navigation.md
index 876b8a6..7743e8e 100644
--- a/inst/app/text/info-navigation.md
+++ b/inst/app/text/info-navigation.md
@@ -1,6 +1,7 @@
-1. Use the left-hand sidebar to select (or delete and search for) options under:
- - **Datasets** section, with a geographical filter
- - **Types of potentially-mitigatable activity (TPMAs)** section, with an activity-type filter
-2. Use the top navigation bar to visit the:
- - **Visualisations** tab for summaries of your selected dataset and TPMA
- - **Information** tab (current tab) for context and instructions
+Use the left-hand sidebar to select (or delete and search for) options under:
+* **Datasets** section, with a geographical filter
+* **Types of potentially-mitigatable activity (TPMAs)** section, with an activity-type filter
+
+Use the top navigation bar to visit the:
+* **Visualisations** tab for summaries of your selected dataset and TPMA
+* **Information** tab (current tab) for context and instructions
diff --git a/inst/app/text/info-purpose.md b/inst/app/text/info-purpose.md
index 0b53b2f..f4c17ce 100644
--- a/inst/app/text/info-purpose.md
+++ b/inst/app/text/info-purpose.md
@@ -1,3 +1 @@
-View data summaries for **Types of Potentially-Mitigatable Activity (TPMAs)** for statistical units within different geographies.
-
-This may help identify opportunities or set parameters for New Hospital Programme (NHP) modelling.
+View data summaries for **Types of Potentially-Mitigatable Activity (TPMAs)** for statistical units within different geographies. This may, for example, help set parameters for New Hospital Programme (NHP) modelling or identify care-shift opportunities.
diff --git a/inst/app/text/viz-trend.md b/inst/app/text/viz-trend.md
index 6367840..a5b4129 100644
--- a/inst/app/text/viz-trend.md
+++ b/inst/app/text/viz-trend.md
@@ -1,2 +1,3 @@
How activity has changed over time for the selected TPMA.
Years of availability will depend on the selected unit and TPMA.
+The baseline year is highlighted as a red point.
From 1f0521358bff34ec7b575f39b2093e3bff22d3c5 Mon Sep 17 00:00:00 2001
From: Matt Dray <18232097+matt-dray@users.noreply.github.com>
Date: Thu, 5 Feb 2026 14:39:36 +0000
Subject: [PATCH 5/5] Add author card to information section
---
R/app_ui.R | 5 +++++
inst/app/text/info-author.md | 2 ++
2 files changed, 7 insertions(+)
create mode 100644 inst/app/text/info-author.md
diff --git a/R/app_ui.R b/R/app_ui.R
index 6e163da..cdc2a6a 100644
--- a/R/app_ui.R
+++ b/R/app_ui.R
@@ -82,6 +82,11 @@ app_ui <- function(request) {
id = "card_how_to_use",
bslib::card_header("Interface"),
md_file_to_html("app", "text", "info-interface.md")
+ ),
+ bslib::card(
+ id = "card_author",
+ bslib::card_header("Author"),
+ md_file_to_html("app", "text", "info-author.md")
)
)
)
diff --git a/inst/app/text/info-author.md b/inst/app/text/info-author.md
new file mode 100644
index 0000000..159a053
--- /dev/null
+++ b/inst/app/text/info-author.md
@@ -0,0 +1,2 @@
+This app was built and is maintained by [The Strategy Unit](https://www.strategyunitwm.nhs.uk/).
+The source code can be found in [the open tpma-explorer GitHub repository](https://github.com/The-Strategy-Unit/tpma-explorer/).