/PHS_penguin_team_project

R Shiny dashboard for Public Health Scotland (Codeclan group project)

Primary LanguageHTMLMIT LicenseMIT

PHS_penguin_team_project

Project description

The project we are going to describe is a group project we were assigned during our CodeClan course. The group was composed by four people: Thijmen Breeschoten, Chiara Capresi, Naomi Penfold and Alistair Trucco.

In this project we were asked to provide an analysis of how acute care provision changes by season (summer versus winter) and with the impact of the COVID-19 pandemic, using data from Public Health Scotland and NHS Scotland.

Disclaimer: this project was not requested by and had no involvement from Public Health Scotland or NHS Scotland, and any results or insights are not intended to be used in real life.

Process

Our main approach was that of starting with a deep analysis of the data avilable with a view to identifying KPIs that in our opinion might be significant for the client.

Each of us worked separately to the cleaning and wrangling data operations necessary for producing visualisations and explanation for each one of the KPIs we selected during the setting stage, even if we planned regular update stages for sharing with the other group's members new goals, hypothesis and concerns.

From the data available, we were able to explore several key performance indicators (KPIs) of acute care provision, including client intake (A&E attendances and hospital admissions), measures of service workload within the service (wait times in A&E and for hospital treatment, length of stay, bed occupancy), and an outflow metric that affects service capacity and resources (delayed discharge).

Key indicators diagram. Image shows data metrics in boxes (which are described in the following text) with their relationships. For example, A&E wait times follow on from A&E attendances, while hospital admissions has an arrow into hospital occupancy. Key indicators of acute care provision included in the available datasets.

To understand the impact of COVID-19 pandemic, we focused on three key indicators that cover the flow of clients into, within and out of hospital care: hospital admissions, bed occupancy, and delayed discharge.

To investigate seasonality, we focussed on A&E attendances, because we found a seasonal pattern here (also in A&E wait times) whereas we did not find any seasonality in other indicators.

Screenshot of dashboard tab 1, with the selector at the top, 4 horizontal tabs, tab 1 selected, showing the 4 plots on tab 1. Dashboard tab 1: Seasonality patterns in A&E attendances (lead: Thijmen Breeschoten)

Screenshot of dashboard tab 2, with the selector at the top, 4 horizontal tabs, tab 2 selected, showing a map plot on the left and two time series plots on the right, one for overall admissions and one showing amdissions for three different age categories. This image also shows the dropdown selector opened, with a list of health boards showing and one selected and highlighted in blue. Dashboard tab 2: Impact of COVID-19 pandemic on hospital admissions (lead: Chiara Capresi). This shows the dropdown selector to choose health board: all 4 tabs are interactive and respond to this input selection.

Screenshot of dashboard tab 3, with the selector at the top, 4 horizontal tabs, tab 3 selected, showing two map plots on the left and a time series plot on the right. This image also shows the cursor positioned over a point on the second (and central) map plot with an information label showing that names the hospital at that location and its percentage occupancy. Dashboard tab 3: Impact of COVID-19 pandemic on hospital occupancy (lead: Naomi Penfold). This shows the hover-over function on the leaflet map plots.

Screenshot of dashboard tab 4, with the selector at the top, 4 horizontal tabs, tab 4 selected, showing a map plot on the left and a time series plot on the right. Dashboard tab 4: Impact of COVID-19 pandemic on delayed discharges (lead: Alistair Trucco).

Contributors

Dashboard created during CodeClan - Professional Data Analysis course by:

About the data

This project uses data from Public Health Scotland and NHS Scotland, which contains public sector information licensed under the Open Government Licence v3.0.

The Shiny dashboard presents data from the following specific datasets:

Exploration notebooks also include work using these additional datasets:

Running the app locally

Requirements

R packages used over all scripts:

  • tidyverse_2.0.0
  • ggplot2_3.4.2
  • janitor_2.2.0
  • lubridate_1.9.2
  • bslib_0.4.2
  • plotly_4.10.2
  • leaflet_2.1.2
  • sf_1.0-13
  • shiny_1.7.4

How to run the app locally

  1. Download raw data: download .csv data from websites above
  2. Prepare cleaned data: run all 5 cleaning scripts (in any order) - these will write new csvs into data/cleaned_data folder within your project directory, which are required for running the dashboard.
  3. Run the R Shiny dashboard locally: run one of global, ui, server scripts - the shiny dashboard should load in your web browser

Note we downloaded the raw data files on ~July 7-14 2023. Any updates to the open data webpages since this date may affect whether the cleaning scripts run as expected. (We have not included data validation steps... yet.)

Other information

Individual contributions to the project

For this group project everyone contributed equally to the following tasks/activities:

  • General data exploration
  • Presentation deck
  • Dashboard R Shiny framework
  • Collaborative discussions and planning
  • Git repository management
  • Project description outline
  • Drawing final conclusions
  • finalisation README documentation

Besides the joined tasks each individual had their own specific contributions:

Thijmen Breeschoten:

  • Initial data wrangling/cleaning of the A&E hospital activity datasets.
  • Plot visualisations for A&E attendance KPI measurements.
  • Data analyses, including hypothesis testing for summer/winter comparison per health board.
  • Selecting insights and drawing conclusions for impact of seasonal effects on A&E attendances across Scotland.

Chiara Capresi:

  • Analysing and cleaning datasets regarding impact of Covid on hospital admissions.
  • Producing visualisations about hospital admissions’ trend over time, from the beginning of covid emergency up to now.

Naomi Penfold:

  • Exploring data about inpatient stays, treatment wait time and A&E attendances
  • Analysing and cleaning data, and producing visualisations, about hospital occupancy
  • Initial R Shiny design and scripts: global, ui and server; drawing wireframes throughout project
  • Coding consistent themes (for ggplot outputs and R Shiny dashboard)
  • Writing documentation (github README)

Alistair Trucco:

  • translating nhs location data to be useable in leaflet
  • Analysis and visualisations for delayed discharge data
  • t-test workflow

Presentation of the project and dashboard

  • Presentation: PDF of the slides used for a 20-minute presentation to Codeclan instructors and fellow students in July 2023 (recording available on Youtube)

Licensing

As indicated above this project uses data from Public Health Scotland and NHS Scotland, which contains public sector information licensed under the Open Government Licence v3.0.

This project is licensed under the terms of the MIT license. Please find details in LICENSE.md within this repo.