Learn R Programming

fhircrackr (version 0.2.1)

fhir_next_bundle_url: Next Bundle's URL

Description

fhir_next_bundle_url() gives the url of the next available bundle. This is useful when you have not a lot of memory available or when a download of bundles was interrupted for some reason. In case of small memory, you can use fhir_next_bundle_url together with the max_bundle argument from fhir_search to download bundles in smaller batches in a loop. See details in the example.

Usage

fhir_next_bundle_url()

Arguments

Value

A string containing an url to the next bundle available on the FHIR server of your last call to fhir_search or NULL if no further bundle is available.

Examples

Run this code
# NOT RUN {
# 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 <- "http://hapi.fhir.org/baseR4/Observation"
count <- 0
while(!is.null(url) && count < 5){
	bundles <- fhir_search(url, verbose = 2, max_bundles = 2)
	tables <- fhir_crack(bundles, list(Obs=list(resource = "//Observation")))
	save(tables, file = paste0(tempdir(),"/table_", count, ".RData"))
	count <- count + 1
	url <- fhir_next_bundle_url()
}
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab