-
Notifications
You must be signed in to change notification settings - Fork 12
/
form_schema_parse.Rd
85 lines (78 loc) · 3.12 KB
/
form_schema_parse.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/form_schema_parse.R
\name{form_schema_parse}
\alias{form_schema_parse}
\title{Parse a form_schema into a tibble of fields with name, type, and path.}
\usage{
form_schema_parse(fs, path = "Submissions", verbose = get_ru_verbose())
}
\arguments{
\item{fs}{The output of form_schema as nested list}
\item{path}{The base path for form fields. Default: "Submissions".
\code{\link{form_schema_parse}} recursively steps into deeper nesting
levels, which are reflected as separate OData tables.
The returned value in \code{path} reflects the XForms group name, which
translates to separate screens in ODK Collect.
Non-repeating form groups will be flattened out into the main Submissions
table. Repeating groups are available as separate OData tables.}
\item{verbose}{Whether to display debug messages or not.
Read \code{vignette("setup", package = "ruODK")} to learn how \code{ruODK}'s
verbosity can be set globally or per function.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\details{
This function is used by \code{\link{form_schema}} for older versions of
ODK Central (pre 0.8). These return the form schema as XML, requiring the
quite involved code of \code{\link{form_schema_parse}}, while newer ODK
Central versions return JSON, which is parsed directly in
\code{\link{form_schema}}.
The \code{form_schema} returned from ODK Central versions < 0.8 is a nested list
of lists containing the form definition.
The form definition consists of fields (with a type and name), and form
groups, which are rendered as separate ODK Collect screens.
Form groups in turn can also contain form fields.
\code{\link{form_schema_parse}} recursively unpacks the form and extracts the
name and type of each field. This information then informs
\code{\link{handle_ru_attachments}}, \code{\link{handle_ru_datetimes}},
\code{\link{handle_ru_geopoints}}, \code{\link{handle_ru_geotraces}}, and
\code{\link{handle_ru_geoshapes}}.
}
\examples{
\dontrun{
# Option 1: in two steps, ODKC Version 0.7
fs <- form_schema(flatten = FALSE, parse = FALSE, odkc_version = 0.7)
fsp <- form_schema_parse(fs)
# Option 2: in one go
fsp <- form_schema(parse = TRUE)
fsp
}
}
\seealso{
Other utilities:
\code{\link{attachment_get}()},
\code{\link{attachment_link}()},
\code{\link{attachment_url}()},
\code{\link{drop_null_coords}()},
\code{\link{get_one_attachment}()},
\code{\link{get_one_submission}()},
\code{\link{get_one_submission_att_list}()},
\code{\link{get_one_submission_audit}()},
\code{\link{handle_ru_attachments}()},
\code{\link{handle_ru_datetimes}()},
\code{\link{handle_ru_geopoints}()},
\code{\link{handle_ru_geoshapes}()},
\code{\link{handle_ru_geotraces}()},
\code{\link{isodt_to_local}()},
\code{\link{odata_submission_rectangle}()},
\code{\link{predict_ruodk_name}()},
\code{\link{prepend_uuid}()},
\code{\link{split_geopoint}()},
\code{\link{split_geoshape}()},
\code{\link{split_geotrace}()},
\code{\link{strip_uuid}()},
\code{\link{tidyeval}},
\code{\link{unnest_all}()}
}
\concept{utilities}