
Prefix attachment columns from CSV export with a local attachment file path.
Source:R/attachment_link.R
attachment_link.RdArguments
- data_tbl
The downloaded submissions from
submission_exportread into atibblebyreadr::read_csv.- form_schema
The
form_schemafor the submissions. E.g. the output ofruODK::form_schema().- att_path
A local path, default: "media" (as per .csv.zip export). Selected columns of the dataframe (containing attchment filenames) are prefixed with
att_path, thus turning them into relative paths.
Value
The dataframe with attachment columns modified to contain relative paths to the downloaded attachment files.
See also
Other utilities:
attachment_get(),
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_attachments(),
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{
t <- tempdir()
# See vignette("setup") for setup and authentication options
# ruODK::ru_setup(svc = "....svc", un = "me@email.com", pw = "...")
# Predict filenames (with knowledge of form)
fid <- get_default_fid()
fid_csv <- fs::path(t, glue::glue("{fid}.csv"))
fid_csv_tae <- fs::path(t, glue::glue("{fid}-taxon_encounter.csv"))
fs <- form_schema()
# Download the zip file
se <- ruODK::submission_export(
local_dir = t,
overwrite = FALSE,
verbose = TRUE
)
# Unpack the zip file
f <- unzip(se, exdir = t)
fs::dir_ls(t)
# Prepend attachments with media/ to turn into relative file paths
data_quadrat <- fid_csv %>%
readr::read_csv(na = c("", "NA", "na")) %>%
janitor::clean_names() %>%
handle_ru_datetimes(fs) %>%
attachment_link(fs)
} # }