Skip to content

nhs-r-community/NHSRwaitinglist

Repository files navigation

NHSRwaitinglist

All Contributors Lifecycle: experimental R-CMD-check Codecov test coverage

{NHSRwaitinglist} is an R package implementing the waiting list management approach described in the paper Understanding Waiting Lists Pressures by Fong et al. The methodology is presented by Neil Walton, Professor in Operations Management at Durham University Business School. The package is being contributed to by members of the NHS-R Community, with the aim of making it simpler for NHS analysts to adopt these methods for the analysis of their own waiting lists.

Explanatory Videos

These videos explain more about the Operations Management methodologies which are encapsulated by the package. Click through to view them on YouTube.

Detailed presentation of method Recap of method, and presentation of this package
Thumbnail for link to MAN huddle video Thumbnail for link to Health and Care Analytics Conference E-lab video
Midlands Analyst Network Huddle, Nov 2023 Health and Care Analytics Conference e-lab, Jul 2024

Installation

You can install the current version of {NHSRwaitinglist} from GitHub as below.
If you have not installed from GitHub before, you may first need to create and store a “Personal Access Token” (PAT) to grant access to your account, for example by following the {usethis} guide.

# install.packages("remotes")
remotes::install_github("nhs-r-community/NHSRwaitinglist", build_vignettes = TRUE)

Getting Started

There is a minimal example below. To look in more detail at the functions within the package and some more ways of using them, it is a good idea to review the first two vignettes:

  1. The example walkthrough vignette takes a step-by-step walk through the white paper, using the six core functions in this package.
  2. The three example waiting lists vignette simulates three closely related waiting lists, and uses package functions to explore some of their characteristics.

At its most basic, the package can be used to simulate a waiting list (a dataframe of waiting list addition dates and removal dates), and then compute some important statistics. Of course, if you already have waiting list data ready to analyse, you can skip the simulation step in the code below.

# load the package
library(NHSRwaitinglist)

# simulate a waiting list
waiting_list <- wl_simulator(
  start_date = "2020-01-01",
  end_date = "2024-03-31",
  demand = 10, # simulating 10 patient arrivals per week
  capacity = 10.2 # simulating 10.2 patients being treated per week
)

# compute some waiting list statistics
overall_stats <- wl_stats(
  waiting_list = waiting_list,
  target_wait = 18 # standard NHS 18wk target
)

# review the minimal dataset needed to define a waiting list (first 5 rows only)
knitr::kable(head(waiting_list, 5))
referral removal
2020-01-02 2020-01-03
2020-01-03 2020-01-04
2020-01-04 2020-01-05
2020-01-04 2020-01-06
2020-01-06 2020-01-07
# review the waiting list statistics
knitr::kable(overall_stats)
mean.demand mean.capacity load load.too.big queue_size target_queue_size queue.too.big mean_wait cv_arrival cv_removal target.capacity relief.capacity pressure
9.818065 10.08167 0.9738527 FALSE 5 44.18129 FALSE 1.8 1.131775 0.7001389 10.01485 NA 0.4

Contributing

If you want to learn more about this project, please join the discussion at the NHS-R Community Slack group and the specific channel #managing-waiting-lists.

Please see our guidance on how to contribute.

This project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

The simplest way to contribute is to raise an issue detailing the feature or functionality you would like to see added, or any unexpected behaviour or bugs you have experienced.

Pull-Request workflow

You are welcome to also submit Pull Requests and, as the main branch is protected and won’t accept pushes directly even if you have been added to the repository as a member, the workflow will be (from your own forked repository if you are not a member, or a clone of the repository if you are a member):

  • Create new branch with a descriptive name
  • Commit to the new branch (add code or delete code or make changes)
  • Push the commits
  • Create a pull-request in GitHub to signal that your work is ready to be merged
  • Tag one or more reviewers (@ThomUK and @ChrisMainey) so that your contribution can be reviewed and merged into main

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Jacqueline Grout
Jacqueline Grout

🤔 💻
Tom Smith
Tom Smith

💻
Matt Dray
Matt Dray

💻
kaituna
kaituna

📖 💻
Chris Mainey
Chris Mainey

💻 📖 ⚠️
PeterSNHS
PeterSNHS

📖
neilwalton
neilwalton

💻 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

About

R-package to implement the waiting list management approach described in this paper by Fong et al: https://www.medrxiv.org/content/10.1101/2022.08.23.22279117v1.full-text

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages