Comparing septoplasty waiting times
Waiting on a bread and butter surgery
I’m on the public waiting list for a septoplasty for which I know I will be waiting quite some time. Despite taking up private health insurance recently, there’s a 12 month waiting period on nasal surgeries too!
So I thought, well, there must be some publicly reported data on how long one typically waits for a septoplasty. I have been placed as a Category 3 waiting list patient which generally indicated as non-urgent in which surgery is recommended within 365 days. There are three urgency categories (Australian Institute of Health and Welfare, 2019a) for elective surgeries within the Victoria public healthcare system as described:
The treating doctor determines how urgently surgery is needed, then assigns the patient to one of three elective surgery urgency categories – Category 1 (surgery is recommended within 30 days), Category 2 (surgery is recommended within 90 days), or Category 3 (surgery is recommended within 365 days)
What data is available?
Fortunately, the Australian Institute of Health and Welfare Myhospitals.gov.au website includes the median waiting time for a list of elective surgeries for private and public hospitals where reported. According to the “About the data”, the following information is available:
- A list of all public hospitals and their details
- A list of all indicators measured on the website
- Data sets associated for all available hospitals and requested sets of indicators
Looks promising. Moreover, the access and use of the above data sets don’t appear to be explicitly restricted in accordance to the MyHospitals website (Australian Institute of Health and Welfare, 2019b):
The information available on the MyHospitals website is determined by the AIHW. At this time the API is unsecured, allowing anonymous users to access the available data. Access to private hospital data may be restricted.
Let’s take a quick look at what available indicators are there. We will need to connect to the underlying Application Programming Interface (API). There are two R packages that are suitable for connecting and fetching data via an API, i.e.
jsonlite. Respectively, we will use
httr::GET() to retrieve a specific URL and
jsonlite::fromJSON() to parse the JSON file that is retrieved.
I firstly want to take a look at the indicators in order to figure out which one relates to Septoplasty.
# load required packages library(leaflet) library(tidyverse) library(httr) library(jsonlite) library(kableExtra) # specify indicators path ind_path <- "https://www.myhospitals.gov.au/api/indicators" # access the link request <- GET(url = ind_path) # parse the content response <- content(request, as = "text", encoding = "UTF-8") # convert to data frame indicators_raw <- fromJSON(response, flatten = TRUE) # take a different look at the data head(indicators_raw, 10) %>% knitr::kable() %>% kableExtra::kable_styling(c("bordered", "condensed"), full_width = T, position = "l") %>% scroll_box(width = "100%", height = "400px")
So there appears to be a set of measures for any given procedure/surgery. I specifically want the median waiting days for Septoplasty. We can use the base
grepl() function to search for strings associated with the above, i.e. “Median” and “Septo”.
# find indicator for median waiting days for septoplasty septo_ind <- indicators_raw %>% filter(grepl("Median", indicatorName), grepl("Septo", name)) # here's the indicator details head(septo_ind) %>% knitr::kable() %>% kableExtra::kable_styling(c("bordered", "condensed"), full_width = T, position = "l") %>% scroll_box(width = "100%", height = "400px")
Good. I now know that indicator code is 55 for the median waiting time for Septoplasty procedures.
Preparing the list of hospitals
Before I retrieve the actual results for Septoplasty median waiting times, I will the list of hospitals in case I have to link in additional characteristics of the hospitals. Let’s grab the list first:
# specify hospitals path hosp_path <- "https://www.myhospitals.gov.au/api/hospitals" # access the link request <- GET(url = hosp_path) # parse the content response <- content(request, as = "text", encoding = "UTF-8") # convert to data frame hospitals_raw <- fromJSON(response, flatten = TRUE) # list of hospitals and their details head(hospitals_raw, 10) %>% knitr::kable() %>% kableExtra::kable_styling(c("bordered", "condensed"), full_width = T, position = "l") %>% scroll_box(width = "100%", height = "400px")