Description Usage Arguments Value Examples
View source: R/get_wait_times.R
This function provides a wrapper to the API endpoints for getting the live wait times for emergencies, consultations, and surgeries at the following domain: http://tempos.min-saude.pt.
get_wait_times_all runs this function on all existing ids.
1 2 3  | get_wait_times(hospital_id = NULL, output_format = c("json",
  "data_frame"), request_headers = NULL, data_type = c("emergency",
  "consultation", "surgery"))
 | 
hospital_id | 
 Integer containing the hospital id, get it through   | 
output_format | 
 defines the format of the final output resulting form the API call. Two options:
(1)   | 
request_headers | 
 named character vector with the HTTP headers to be added to   | 
data_type | 
 Character string determining the type of data to request. Can be either (1)   | 
json string or tibble containing the relevant metadata. The relevant wait times for "emergency" are in both seconds as integer or ymd_hms. For "consultation" or "surgery" they unit of analysis is day as integer. All datasets also contain a variable measuring wait times by the number of people waiting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  | library(jsonlite)
library(esperaR)
## Not run: 
library(ggplot2)
## extract emergency data as a data frame
wait_dta <- get_wait_times(hospital_id = 333,
                          output_format = "data_frame",
                          request_headers = NULL
                          data_type = "emergency")
wait_dta %>%
 ggplot(aes(triage_type, wait_time_secs)) +
 geom_boxplot()
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.