Skip to content

Commit 255cddb

Browse files
authored
Merge pull request #96 from The-Strategy-Unit/86-info
Provide more information in the app
2 parents 616fcbc + 3ba3fec commit 255cddb

15 files changed

+78
-41
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authors@R: c(
66
person("Tom", "Jemmett", , "thomas.jemmett@nhs.net", role = "aut")
77
)
88
Description: A Shiny-app-in-a-package to explore data related to Types of
9-
Potentially Mitigatable Activity (TPMAs).
9+
Potentially-Mitigatable Activity (TPMAs).
1010
License: MIT + file LICENSE
1111
URL: https://github.com/The-Strategy-Unit/tpma-explorer
1212
BugReports: https://github.com/The-Strategy-Unit/tpma-explorer/issues

R/app_ui.R

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ app_ui <- function(request) {
1111
bslib::nav_panel(
1212
id = "nav_panel_viz",
1313
title = "Visualisations",
14+
icon = bsicons::bs_icon("graph-up"),
1415

1516
bslib::card(
1617
fill = FALSE,
@@ -49,6 +50,8 @@ app_ui <- function(request) {
4950
bslib::nav_panel(
5051
id = "nav_panel_info",
5152
title = "Information",
53+
icon = bsicons::bs_icon("book"),
54+
5255
bslib::layout_columns(
5356
bslib::layout_columns(
5457
col_widths = c(12, 12),
@@ -59,13 +62,13 @@ app_ui <- function(request) {
5962
),
6063
bslib::card(
6164
id = "card_data",
62-
bslib::card_header("Definitions"),
63-
md_file_to_html("app", "text", "info-definitions.md")
65+
bslib::card_header("Data"),
66+
md_file_to_html("app", "text", "info-data.md")
6467
),
6568
bslib::card(
6669
id = "card_data",
67-
bslib::card_header("Data"),
68-
md_file_to_html("app", "text", "info-data.md")
70+
bslib::card_header("Definitions"),
71+
md_file_to_html("app", "text", "info-definitions.md")
6972
)
7073
),
7174
bslib::layout_columns(
@@ -79,6 +82,11 @@ app_ui <- function(request) {
7982
id = "card_how_to_use",
8083
bslib::card_header("Interface"),
8184
md_file_to_html("app", "text", "info-interface.md")
85+
),
86+
bslib::card(
87+
id = "card_author",
88+
bslib::card_header("Author"),
89+
md_file_to_html("app", "text", "info-author.md")
8290
)
8391
)
8492
)
@@ -98,6 +106,7 @@ app_ui <- function(request) {
98106
sidebar = bslib::sidebar(
99107
bslib::accordion(
100108
id = "sidebar_accordion",
109+
101110
open = FALSE,
102111
multiple = TRUE,
103112
bslib::accordion_panel(
@@ -107,7 +116,7 @@ app_ui <- function(request) {
107116
mod_select_provider_ui("mod_select_provider"),
108117
),
109118
bslib::accordion_panel(
110-
title = "Types of Potentially Mitigatable Activity (TPMAs)",
119+
title = "Types of Potentially-Mitigatable Activity (TPMAs)",
111120
icon = bsicons::bs_icon("hospital"),
112121
mod_select_strategy_ui("mod_select_strategy")
113122
)

R/mod_select_geography.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ mod_select_geography_ui <- function(id) {
55
ns <- shiny::NS(id)
66
shiny::selectInput(
77
ns("geography_select"),
8-
"Filter by geography:",
8+
label = bslib::tooltip(
9+
trigger = list(
10+
"Filter by geography",
11+
bsicons::bs_icon("info-circle")
12+
),
13+
md_file_to_html("app", "text", "sidebar-selections.md"),
14+
),
915
choices = c(
1016
"NHS provider trusts" = "nhp",
1117
"Local authorities (LAs)" = "la"

R/mod_select_provider.R

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ mod_select_provider_ui <- function(id) {
55
ns <- shiny::NS(id)
66
shiny::selectInput(
77
ns("provider_select"),
8-
"Choose a statistical unit:",
8+
label = bslib::tooltip(
9+
trigger = list(
10+
"Choose a statistical unit",
11+
bsicons::bs_icon("info-circle")
12+
),
13+
md_file_to_html("app", "text", "sidebar-selections.md"),
14+
),
915
choices = NULL
1016
)
1117
}
@@ -34,21 +40,12 @@ mod_select_provider_server <- function(id, selected_geography) {
3440
shiny::bindEvent(selected_geography())
3541

3642
shiny::observe({
37-
sg <- shiny::req(selected_geography())
3843
providers <- shiny::req(providers())
39-
4044
provider_choices <- purrr::set_names(names(providers), providers)
4145

42-
provider_label <- switch(
43-
sg,
44-
"nhp" = "Choose a trust:",
45-
"la" = "Choose an LA:"
46-
)
47-
4846
shiny::updateSelectInput(
4947
session,
5048
"provider_select",
51-
label = provider_label,
5249
choices = provider_choices
5350
)
5451
})

R/mod_select_strategy.R

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ mod_select_strategy_ui <- function(id) {
66
shiny::tagList(
77
shiny::selectInput(
88
ns("strategy_category_select"),
9-
"Filter by activity type:",
9+
label = bslib::tooltip(
10+
trigger = list(
11+
"Filter by activity type",
12+
bsicons::bs_icon("info-circle")
13+
),
14+
md_file_to_html("app", "text", "sidebar-selections.md"),
15+
),
1016
choices = c(
1117
"Inpatients" = "ip",
1218
"Outpatients" = "op",
@@ -15,7 +21,13 @@ mod_select_strategy_ui <- function(id) {
1521
),
1622
shiny::selectInput(
1723
ns("strategy_select"),
18-
"Choose a TPMA:",
24+
label = bslib::tooltip(
25+
trigger = list(
26+
"Choose a TPMA",
27+
bsicons::bs_icon("info-circle")
28+
),
29+
md_file_to_html("app", "text", "sidebar-selections.md"),
30+
),
1931
choices = NULL
2032
)
2133
)

inst/app/text/info-author.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This app was built and is maintained by [The Strategy Unit](https://www.strategyunitwm.nhs.uk/).
2+
The source code can be found in [the open tpma-explorer GitHub repository](https://github.com/The-Strategy-Unit/tpma-explorer/).

inst/app/text/info-data.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
Placeholder.
1+
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).
2+
3+
Data is shown for a given **baseline** financial year, which is currently 2023/24, though trend information is also shown.
4+
Counts of less than five are **suppressed**.
5+
6+
The data was **prepared** as part of the modelling process for the New Hospital Programme (NHP).
7+
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.
8+
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).

inst/app/text/info-definitions.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
Visit the New Hospital Programme (NHP) project information website to:
1+
Visit [the New Hospital Programme (NHP) project information website](https://connect.strategyunitwm.nhs.uk/nhp/project_information/) to:
22

3-
* 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)
4-
* see a [TPMA lookup](https://connect.strategyunitwm.nhs.uk/nhp/project_information/user_guide/mitigators_lookup.html), including names, codes and deprecation status
3+
* 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
4+
* see a [**TPMA lookup**](https://connect.strategyunitwm.nhs.uk/nhp/project_information/user_guide/mitigators_lookup.html), including names, codes and deprecation status
5+
6+
**Peers** are nearest statistical neighbours to the chosen unit.
7+
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)

inst/app/text/info-interface.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
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.
1+
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.
22

3-
To maximise the space for visualisations, you can:
3+
To maximise space, you can click the:
44

5-
* 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
6-
* 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
5+
* <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"/>
6+
</svg> **expand** buttons (lower-left of visualisations) to open in fullscreen
7+
* <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
8+
* <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

inst/app/text/info-navigation.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
First, make selections in the left-hand panel:
1+
Use the left-hand sidebar to select (or delete and search for) options under:
2+
* <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
3+
* <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
24

3-
1. From the **Visualisations** section:
4-
- Select from the **Filter by geography** dropdown to choose a geographical categorisation.
5-
- Select a statistical unit from the **Choose** dropdown to view its data.
6-
2. From the **Types of potentially mitigatable activity (TPMAs)** section:
7-
- Select from the **Filter by activity type** dropdown to choose from a category of TPMAs.
8-
- 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).
9-
3. Use the navigation bar at the top to visit different sections of the app. Visit the:
10-
- **Information** tab (current tab) for background information and instructions.
11-
- **Visualisations** tab to view a description of the selected TPMA
5+
Use the top navigation bar to visit the:
6+
* <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
7+
* <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

0 commit comments

Comments
 (0)