View source: R/attachment_link.R
attachment_link | R Documentation |
attachment_link(data_tbl, form_schema, att_path = "media")
data_tbl |
The downloaded submissions from
|
form_schema |
The |
att_path |
A local path, default: "media" (as per .csv.zip export).
Selected columns of the dataframe (containing attchment filenames) are
prefixed with |
The dataframe with attachment columns modified to contain relative paths to the downloaded attachment files.
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()
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.