diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ + diff --git a/404.html b/404.html new file mode 100644 index 0000000..94012c5 --- /dev/null +++ b/404.html @@ -0,0 +1,86 @@ + + +
+ + + + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
+We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
+Examples of behavior that contributes to a positive environment for our community include:
+Examples of unacceptable behavior include:
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
+Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
+This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nhs.rcommunity@nhs.net. All complaints will be reviewed and investigated promptly and fairly.
+All community leaders are obligated to respect the privacy and security of the reporter of any incident.
+Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
+Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
+Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
+Community Impact: A violation through a single incident or series of actions.
+Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
+Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
+Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
+Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
+Consequence: A permanent ban from any sort of public interaction within the community.
+This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
+Community Impact Guidelines were inspired by [Mozilla’s code of conduct enforcement ladder][https://github.com/mozilla/inclusion].
+For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
+YEAR: 2023 +COPYRIGHT HOLDER: NHS R Community ++ +
Copyright (c) 2023 NHSRwaitinglist authors
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+example_walkthrough.Rmd
This vignette is a practical demonstration of the {NHSRwaitinglist} +functions, using the same running example that is used in the reference +white paper Fong +el al., and video.
+The example is centred on a P4 (priority 4) Ear, Nose & Throat +(ENT) waiting list at an acute hospital.
+The package functions we will be using are:
+Function | +Purpose | +
---|---|
queue_load() |
+To understand the ratio between demand and +capacity. | +
average_wait() |
+To understand the average waiting time for a queue in +equilibrium. | +
target_queue_size() |
+To understand the queue size for a queue in +equilibrium. | +
relief_capacity() |
+To calculate the relief capacity needed to bring a very +large queue under control. | +
target_capacity() |
+To understand the capacity required to keep a queue in +equilibrium, depending on how much variability it experiences. | +
waiting_list_pressure() |
+A pressure measure, which can be used to compare +multiple waiting lists for planning purposes. | +
First, we’ll add the initial data we need, taken from the white +paper.
+
+# Queue size (patients)
+queue_size <- 1200
+
+# Waiting time target (weeks)
+waiting_time_target <- 52
+
+# Average waiting time in the queue (weeks)
+avg_waiting_time <- 63
+
+# Proportion of waiting list who have missed the 52 week target (%)
+perc_missing_target <- 0.51
+
+# Demand (patients per week)
+demand <- 30
+
+# Capacity (procedures per week)
+capacity <- 27
+
+# Standard deviation of number of operations per week
+std_dev_procedures <- 160
++Fact 1: Capacity must be larger than demand, otherwise the waiting +list size will grow indefinitely.
+
+load <- queue_load(demand, capacity)
+load
+#> [1] 1.111111
We see that the load is 1.11, which is greater than 1. The queue will +therefore grow in size indefinitely.
+++Fact 2: If the load is greater than 1, then the queue is unstable, +and the waiting list will grow indefinitely. If the load is less than 1, +then the queue will be stable and the load is the proportion of the time +that that waiting list is non-empty.
+
++Fact 3: If the load on a queue is less than 1 then the chance of +missing the target halves each time we increase the target by some fixed +number of days.
+
++Fact 4: If we want to have a chance between 1.8%-0.2% of not +achieving a waiting time target, then the average patient should have a +waiting time between a quarter and a sixth of the target.
+
In the case of a P4 waiting list, the target wait is 52 weeks. Thus, +we should expect the average patient being operated on to have waited +between 9 and 13 weeks. In the case of P2 customers, the target is 4 +weeks. Thus, the mean wait of a typical patient should be under one +week.
+
+average_wait <- average_wait(waiting_time_target)
+average_wait
+#> [1] 13
We see that the average wait is 13 weeks.
+++Fact 5: Little’s Law. Assuming capacity exceeds demand, the average +queue size is demand multiplied by average waiting time.
+
If, as given in Fact 4 above, we want the average waiting time to be +a quarter of the target, then Little’s Law leads to fact 6.
+++Fact 6: Target queue size is demand multiplied by target wait, +divided by 4.
+
+target_queue_size <- target_queue_size(demand, waiting_time_target)
+target_queue_size
+#> [1] 390
+
+queue_ratio <- queue_size / target_queue_size
+queue_ratio
+#> [1] 3.076923
In this example, the target queue size is 390, and the actual queue +is 1200. The queue ratio is 3.1, meaning that the queue is 3.1 times its +target size.
+If the waiting list size is over twice the target queue size, then we +consider that special measures are needed to increase capacity, and +reduce waiting list size.
+++Fact 7: If the actual queue size is more than double the target queue +size, then decide on a target date by which the queue will be brought +down, and apply the necessary relief capacity.
+
+weeks_until_target_acheived <- 26
+
+relief_capacity <- relief_capacity(
+ demand = demand,
+ queue_size = queue_size,
+ target_queue_size = target_queue_size,
+ weeks_to_target = weeks_until_target_acheived
+)
+relief_capacity
+#> [1] 61.15385
In this example, we decide that the target should be achieved by the +start of the summer, 26 weeks away. To do this, the capacity needed is +61.2 procedures per week, compared to 27 procedures per week currently +being performed.
+As discussed above if the queue size is more than double its target +then capacity should be increased temporarily. However, once the queue +size is within an acceptable range, we can maintain the waiting time +target with what is potentially a much smaller capacity allocation to +the waiting list.
+We know the waiting time (13 weeks) and queue size (390 patients) of +a waiting list operating at its target equilibrium. Now we calculate a +capacity allocation that will maintain this equilibrium in the long +run.
+++Fact 8: Target capacity formula, based on the Pollaczek-Khinchine +formula. The target capacity depends on demand, plus an additional +capacity which is based on serice variability, and the waiting time +target.
+
The parameter “F” depends on the variability of the service. If we do +not know F, we can assume F = 1. Values less than 1 are good. Higher +values represent more variability, which in turn will increase the +capacity required to maintain equilibrium.
+
+# set the "F" variability parameter
+f_1 <- 1
+
+target_capacity_1 <- target_capacity(
+ demand = demand,
+ target_wait = waiting_time_target,
+ F = f_1)
+target_capacity_1
+#> [1] 30.19231
If F is 1, we can see that the capacity required is 30.19, or 0.19 +more than the demand.
+
+f_2 <- 6.58
+
+target_capacity_2 <- target_capacity(
+ demand = demand,
+ target_wait = waiting_time_target,
+ F = f_2)
+target_capacity_2
+#> [1] 31.05077
If F is 6.58, we can see that the capacity required is 31.05, or 1.05 +more than the demand.
+So, decreasing variability of service (for example by stabilising +operating theatre schedules from day to day and week to week) has the +effect of reducing the capacity required to achieve a given service +waiting standard.
+ +++ +Fact 9: Waiting list pressure. For a waiting list with target waiting +time, the pressure on the waiting list is twice the mean waiting time +divided by the target waiting time. The pressure of any given waiting +list should be less than 1. If the pressure is greater than 1 then the +waiting list is most likely going to miss its target.
+
Measuring waiting list pressure can give a comparative measure with +which to compare waiting lists, and help make resource allocation +decisions.
+For the P4 ENT example we have been following:
+
+waiting_list_pressure_p4 <- waiting_list_pressure(avg_waiting_time, waiting_time_target)
+waiting_list_pressure_p4
+#> [1] 2.423077
The queue size is large, with 1200 patients waiting. The waiting time +target is 52 weeks, and the average waiting time being experienced is 63 +weeks. This gives a waiting list pressure of 2.42. NOTE +these numbers are slightly different to the white +paper, which changes the average waiting time from 63 weeks to 61 +weeks during the example.
+If we look at the P2 ENT example:
+
+queue_size_p2 <- 220
+avg_waiting_time_p2 <- 24
+waiting_time_target_p2 <- 4
+
+waiting_list_pressure_p2 <- waiting_list_pressure(avg_waiting_time_p2, waiting_time_target_p2)
+waiting_list_pressure_p2
+#> [1] 12
The queue size is smaller, with 220 patients waiting. The waiting +time target is 4 weeks, and the average waiting time being experienced +is 24. This gives a waiting list pressure of 12.
+In these two examples the pressure on the much shorter P2 waiting +list is 5 times higher than that on the P4 list. Closer attention should +be paid to P2 procedures.
+This worked example aims to demonstrate the functions available in +this package. In chronological order of application they were:
+Function | +Purpose | +
---|---|
queue_load() |
+To understand the ratio between demand and +capacity. | +
average_wait() |
+To understand the average waiting time for a queue in +equilibrium. | +
target_queue_size() |
+To understand the queue size for a queue in +equilibrium. | +
relief_capacity() |
+To calculate the relief capacity needed to bring a very +large queue under control. | +
target_capacity() |
+To understand the capacity required to keep a queue in +equilibrium, depending on how much variability it experiences. | +
waiting_list_pressure() |
+A pressure measure, which can be used to compare +multiple waiting lists for planning purposes. | +
For examples of practical applications, and other considerations, see +the helpful “Case Studies” section towards the end of the white +paper.
+END
+