diff --git a/DESCRIPTION b/DESCRIPTION index b82371f..2ee532d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/R/app_ui.R b/R/app_ui.R index 388f0db..cdc2a6a 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), @@ -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( @@ -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") ) ) ) @@ -98,6 +106,7 @@ app_ui <- function(request) { sidebar = bslib::sidebar( bslib::accordion( id = "sidebar_accordion", + open = FALSE, multiple = TRUE, bslib::accordion_panel( @@ -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") ) diff --git a/R/mod_select_geography.R b/R/mod_select_geography.R index 4784ded..084cc5e 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 = c( "NHS provider trusts" = "nhp", "Local authorities (LAs)" = "la" 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 2a40777..f0e5c12 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/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/). diff --git a/inst/app/text/info-data.md b/inst/app/text/info-data.md index 75ed9b6..6bdbee8 100644 --- a/inst/app/text/info-data.md +++ b/inst/app/text/info-data.md @@ -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). diff --git a/inst/app/text/info-definitions.md b/inst/app/text/info-definitions.md index a64a069..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 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) 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..7743e8e 100644 --- a/inst/app/text/info-navigation.md +++ b/inst/app/text/info-navigation.md @@ -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: +* **Datasets** section, with a geographical filter +* **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: +* **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..f4c17ce 100644 --- a/inst/app/text/info-purpose.md +++ b/inst/app/text/info-purpose.md @@ -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. 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. 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. 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. 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: