Skip to contents

[Stable]

Usage

form_schema_parse(fs, path = "Submissions", verbose = get_ru_verbose())

Arguments

fs

The output of form_schema as nested list

path

The base path for form fields. Default: "Submissions". form_schema_parse recursively steps into deeper nesting levels, which are reflected as separate OData tables. The returned value in 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.

verbose

Whether to display debug messages or not.

Read vignette("setup", package = "ruODK") to learn how ruODK's verbosity can be set globally or per function.

Details

This function is used by form_schema for older versions of ODK Central (pre 0.8). These return the form schema as XML, requiring the quite involved code of form_schema_parse, while newer ODK Central versions return JSON, which is parsed directly in form_schema.

The 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.

form_schema_parse recursively unpacks the form and extracts the name and type of each field. This information then informs handle_ru_attachments, handle_ru_datetimes, handle_ru_geopoints, handle_ru_geotraces, and handle_ru_geoshapes.

Examples

if (FALSE) { # \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
} # }