Download and link submission attachments according to a form schema.
Source:R/handle_ru_attachments.R
handle_ru_attachments.Rd
Usage
handle_ru_attachments(
data,
form_schema,
local_dir = "media",
pid = get_default_pid(),
fid = get_default_fid(),
url = get_default_url(),
un = get_default_un(),
pw = get_default_pw(),
retries = get_retries(),
verbose = get_ru_verbose()
)
Arguments
- data
Submissions rectangled into a tibble. E.g. the output of
- form_schema
The
form_schema
for the submissions. E.g. the output ofruODK::form_schema()
.- local_dir
The local folder to save the downloaded files to, default: "media".
- pid
The numeric ID of the project, e.g.: 2.
Default:
get_default_pid
.Set default
pid
throughru_setup(pid="...")
.See
vignette("Setup", package = "ruODK")
.- fid
The alphanumeric form ID, e.g. "build_Spotlighting-0-8_1559885147".
Default:
get_default_fid
.Set default
fid
throughru_setup(fid="...")
.See
vignette("Setup", package = "ruODK")
.- url
The ODK Central base URL without trailing slash.
Default:
get_default_url
.Set default
url
throughru_setup(url="...")
.See
vignette("Setup", package = "ruODK")
.- un
The ODK Central username (an email address). Default:
get_default_un
. Set defaultun
throughru_setup(un="...")
. Seevignette("Setup", package = "ruODK")
.- pw
The ODK Central password. Default:
get_default_pw
. Set defaultpw
throughru_setup(pw="...")
. Seevignette("Setup", package = "ruODK")
.- retries
The number of attempts to retrieve a web resource.
This parameter is given to
RETRY(times = retries)
.Default: 3.
- verbose
Whether to display debug messages or not.
Read
vignette("setup", package = "ruODK")
to learn howruODK
's verbosity can be set globally or per function.
Details
For a given tibble of submissions, download and link attachments for all columns which are marked in the form schema as type "binary".
See also
Other utilities:
attachment_get()
,
attachment_link()
,
attachment_url()
,
drop_null_coords()
,
form_schema_parse()
,
get_one_attachment()
,
get_one_submission()
,
get_one_submission_att_list()
,
get_one_submission_audit()
,
handle_ru_datetimes()
,
handle_ru_geopoints()
,
handle_ru_geoshapes()
,
handle_ru_geotraces()
,
isodt_to_local()
,
odata_submission_rectangle()
,
predict_ruodk_name()
,
prepend_uuid()
,
split_geopoint()
,
split_geoshape()
,
split_geotrace()
,
strip_uuid()
,
tidyeval
,
unnest_all()
Examples
if (FALSE) { # \dontrun{
library(magrittr)
data("fq_raw")
data("fq_form_schema")
t <- tempdir()
fs::dir_ls(t) %>% fs::file_delete()
fq_with_att <- fq_raw %>%
ruODK::odata_submission_rectangle() %>%
ruODK::handle_ru_attachments(
form_schema = fq_form_schema,
local_dir = t,
pid = ruODK::get_test_pid(),
fid = ruODK::get_test_fid(),
url = ruODK::get_test_url(),
un = ruODK::get_test_un(),
pw = ruODK::get_test_pw(),
verbose <- ruODK::get_ru_verbose()
)
# There should be files in local_dir
testthat::expect_true(fs::dir_ls(t) %>% length() > 0)
} # }