# \donttest{
#' #the try({}, silent = TRUE) statement is only there to catch errors when the server is down
#you can skip it when the server is reachable
try({
# workflow for small memory environments, downloading small batches of bundles
# for really small memory environments consider also using the `_count` option in
# your FHIR search request.
# You can iteratively download, crack and save the bundles until all bundles are processed or the
# desired number of bundles is reached.
url <- fhir_url("https://server.fire.ly/Patient")
count <- 0
obs <- fhir_table_description(resource = "Patient")
design <- fhir_design(obs)
while(length(url)>0 && count < 5){
bundles <- fhir_search(url, max_bundles = 2)
tables <- fhir_crack(bundles, design)
save(tables, file = paste0(tempdir(),"/table_", count, ".RData"))
count <- count + 1
url <- fhir_next_bundle_url()
}
#you can see the saved tables here:
dir(tempdir())
}, silent = TRUE)
# }
Run the code above in your browser using DataLab