fhir_load: Load bundles from xml-files

View source: R/download_resources.R

fhir_loadR Documentation

Load bundles from xml-files

Description

Reads all bundles stored as xml files from a directory.

Usage

fhir_load(directory, indices = NULL, pattern = "^[0-9]+\\.xml$")

Arguments

directory

A character vector of length one containing the path to the folder were the files are stored.

indices

A numeric vector of integers indicating which bundles from the specified directory should be loaded. Defaults to NULL meaning all bundles from the directory are loaded.

pattern

A character vector of length one with a regex expression defining the naming pattern of the xml files to be read. Defaults to the regex expression matching file names as produced by fhir_save().

Value

A fhir_bundle_list.

Examples

#unserialize example bundle
bundles <- fhir_unserialize(medication_bundles)
length(bundles)

#save to temporary directory
dir <- tempdir()
fhir_save(bundles, directory = dir)

#load from temporary directory
loaded_bundles <- fhir_load(dir)
length(loaded_bundles)

#load only two, the second and the third bundle
loaded_bundles <- fhir_load(dir, indices = c(2,3))
length(loaded_bundles)

POLAR-fhiR/fhircrackr documentation built on Dec. 24, 2024, 3:06 a.m.