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. httr and 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")
annualPeriods code indicatorName name quarterlyPeriods unitOfMeasure.name unitOfMeasure.pluralName unitOfMeasure.singularName
list() 4 Number of surgeries for malignant cancer Breast cancer list() surgeries surgeries surgery
list() 5 Number of surgeries for malignant cancer Bowel cancer list() surgeries surgeries surgery
list() 6 Number of surgeries for malignant cancer Lung cancer list() surgeries surgeries surgery
list() 1 Median waiting time for surgery for malignant cancer Breast cancer list() days days day
list() 2 Median waiting time for surgery for malignant cancer Bowel cancer list() days days day
list() 3 Median waiting time for surgery for malignant cancer Lung cancer list() days days day
list() 7 Percentage of people who received surgery for malignant cancer within 30 days Breast cancer list() percent % %
list() 8 Percentage of people who received surgery for malignant cancer within 30 days Bowel cancer list() percent % %
list() 9 Percentage of people who received surgery for malignant cancer within 30 days Lung cancer list() percent % %
list() 10 Percentage of people who received surgery for malignant cancer within 45 days Breast cancer list() percent % %

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")
annualPeriods code indicatorName name quarterlyPeriods unitOfMeasure.name unitOfMeasure.pluralName unitOfMeasure.singularName

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")
code communities description id isClosed isPublic latitude longitude name peerGroupId phnCode phnName state
12 list(code = “PHN501”, name = “Perth North”, communityType = “PHN mapping”) Specialist psychiatric hospital 12 FALSE TRUE -31.9609370000 115.7884310000 State Forensic Mental Health Service 0 501 Perth North WA
13 list(code = “PHN101”, name = “Central and Eastern Sydney”, communityType = “PHN mapping”) Specialist psychiatric hospital 13 FALSE TRUE -33.9690700000 151.2432060000 Justice Health Services 0 101 Central and Eastern Sydney NSW
14 list(code = “PHN103”, name = “Western Sydney”, communityType = “PHN mapping”) Specialist children’s hospital with an emergency department 14 FALSE TRUE -33.8015540000 150.9917590000 The Children’s Hospital at Westmead 0 103 Western Sydney NSW
15 list(code = “PHN101”, name = “Central and Eastern Sydney”, communityType = “PHN mapping”) Specialist children’s hospital with an emergency department 15 FALSE TRUE -33.9171790000 151.2383340000 Sydney Children’s Hospital 0 101 Central and Eastern Sydney NSW
16 list(code = “PHN101”, name = “Central and Eastern Sydney”, communityType = “PHN mapping”) Metropolitan hospital 16 FALSE TRUE -33.8805250000 151.2192370000 Sacred Heart Hospice 0 101 Central and Eastern Sydney NSW
17 list(code = “PHN101”, name = “Central and Eastern Sydney”, communityType = “PHN mapping”) Major hospital with an emergency department 17 FALSE TRUE -33.8796920000 151.2211250000

St Vincent

Australian Institute of Health and Welfare. (2019a). Elective surgery waiting times: By urgency category. Retrieved from https://www.myhospitals.gov.au/hospital/210A01334/royal-melbourne-hospital-parkville/waiting-times-elective-surgery

Australian Institute of Health and Welfare. (2019b). MyHospitals - about the data. Retrieved from https://www.myhospitals.gov.au/about-the-data/data-overview