Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Authors@R: c(
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
Expand Down
19 changes: 14 additions & 5 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand All @@ -59,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(
Expand All @@ -79,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")
)
)
)
Expand All @@ -98,6 +106,7 @@ app_ui <- function(request) {
sidebar = bslib::sidebar(
bslib::accordion(
id = "sidebar_accordion",

open = FALSE,
multiple = TRUE,
bslib::accordion_panel(
Expand All @@ -107,7 +116,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")
)
Expand Down
8 changes: 7 additions & 1 deletion R/mod_select_geography.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = c(
"NHS provider trusts" = "nhp",
"Local authorities (LAs)" = "la"
Expand Down
17 changes: 7 additions & 10 deletions R/mod_select_provider.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
Expand Down Expand Up @@ -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
)
})
Expand Down
16 changes: 14 additions & 2 deletions R/mod_select_strategy.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
)
)
Expand Down
2 changes: 2 additions & 0 deletions inst/app/text/info-author.md
Original file line number Diff line number Diff line change
@@ -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/).
9 changes: 8 additions & 1 deletion inst/app/text/info-data.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
Placeholder.
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 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).
9 changes: 6 additions & 3 deletions inst/app/text/info-definitions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
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)
* 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)
10 changes: 6 additions & 4 deletions inst/app/text/info-interface.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
You can hover over the **information symbol** (<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-info-circle " style="height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;" aria-hidden="true" role="img" ><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"></path></svg>) for further information about a visualisation.
You can hover over the **information symbol** <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-info-circle " style="height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;" aria-hidden="true" role="img" ><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"></path></svg> for further details.

To maximise the space for visualisations, you can:
To maximise space, you can click the:

* click the **expand** button (<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-chevron-expand " style="height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;" aria-hidden="true" role="img" ><path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708zm0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708z"></path></svg>) in the lower-right of a plot to expand to full screen
* collapse the sidebar by clicking the **toggle sidebar** chevron <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-chevron-left " style="height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;" aria-hidden="true" role="img" ><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"></path></svg> in its upper-right corner
* <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-expand" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708"/>
</svg> **expand** buttons (lower-left of visualisations) to open in fullscreen
* <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="bi bi-chevron-left " style="height:1em;width:1em;fill:currentColor;vertical-align:-0.125em;" aria-hidden="true" role="img" ><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"></path></svg> **toggle-sidebar** chevron (upper-left of sidebar) to collapse/expand the sidebar
* <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-up" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z"/></svg> **toggle-section** chevrons (upper-left of sidebar sections) to collapse/expand sidebar sections
16 changes: 6 additions & 10 deletions inst/app/text/info-navigation.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
First, make selections in the left-hand panel:
Use the left-hand sidebar to select (or delete and search for) options under:
* <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-table" viewBox="0 0 16 16"><path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z"/></svg> **Datasets** section, with a geographical filter
* <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hospital" viewBox="0 0 16 16"><path d="M8.5 5.034v1.1l.953-.55.5.867L9 7l.953.55-.5.866-.953-.55v1.1h-1v-1.1l-.953.55-.5-.866L7 7l-.953-.55.5-.866.953.55v-1.1zM13.25 9a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25zM13 11.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25zm.25 1.75a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25zm-11-4a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 3 9.75v-.5A.25.25 0 0 0 2.75 9zm0 2a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25zM2 13.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25z"/><path d="M5 1a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1 1 1v4h3a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h3V3a1 1 0 0 1 1-1zm2 14h2v-3H7zm3 0h1V3H5v12h1v-3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1zm0-14H6v1h4zm2 7v7h3V8zm-8 7V8H1v7z"/></svg> **Types of potentially-mitigatable activity (TPMAs)** section, with an activity-type filter

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
Use the top navigation bar to visit the:
* <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-graph-up" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M0 0h1v15h15v1H0zm14.817 3.113a.5.5 0 0 1 .07.704l-4.5 5.5a.5.5 0 0 1-.74.037L7.06 6.767l-3.656 5.027a.5.5 0 0 1-.808-.588l4-5.5a.5.5 0 0 1 .758-.06l2.609 2.61 4.15-5.073a.5.5 0 0 1 .704-.07"/></svg> **Visualisations** tab for summaries of your selected dataset and TPMA
* <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book" viewBox="0 0 16 16"><path d="M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/></svg> **Information** tab (current tab) for context and instructions
2 changes: 1 addition & 1 deletion inst/app/text/info-purpose.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
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, for example, help set parameters for New Hospital Programme (NHP) modelling or identify care-shift opportunities.
2 changes: 2 additions & 0 deletions inst/app/text/sidebar-selections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Choose an option from the dropdown.
Delete the current selection and start typing to begin a search.
4 changes: 2 additions & 2 deletions inst/app/text/viz-diagnoses.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions inst/app/text/viz-trend.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion man/tpma.explorer-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.