Returns the schema's column declarations as a tibble, one row per column in schema order: type, whether it is required, and what the schema says the column means, including the allowed values a QC rule can check a record against.
Value
A tibble with columns:
name,type,requiredas declared; see
crt_schema_conform()unitsunit of a measurement, e.g.
"m", elseNAvalueslist of character vectors: the values the column may store, or
character(0)when the schema sets nonelabelslist of character vectors, parallel to
values: what a form displays for each. The same asvaluesunless the vocabulary is coded, e.g. stores"4"and displays"Coniferous Trees"range_min,range_maxnumeric bounds, else
NArelative_tofor a column holding file paths, what they are relative to, else
NAnullwhat a null means in this column when it means something other than "not recorded", else
NAnotesthe schema's description of the column, else
NAvariantslist of character vectors: for a column the schema declares only because earlier versions of the source carry it, the ids of the
upstream_variantsthat have it;character(0)for a column of the current version. A form builder leaves the former out
Details
This is the reading of a schema meant for other code. A form builder takes
the column list, types and vocabularies from here and adds only how the form
shows them; a QC rule takes values and range_min / range_max and flags a
record whose value falls outside them. Neither has to parse the YAML.
values and the range are declarations, not checks: crt_schema_conform()
does not refuse a value outside them. A value typed or dictated outside a
vocabulary is a record to flag, not one to drop.
See also
crt_schema_grade() for which records can answer a question,
crt_files() to list registered entries.
Examples
cols <- crt_schema_cols("nge", "form_capture")
cols[, c("name", "type", "required")]
#> # A tibble: 6 × 3
#> name type required
#> <chr> <chr> <lgl>
#> 1 project string TRUE
#> 2 form string TRUE
#> 3 record_id integer TRUE
#> 4 source_version string TRUE
#> 5 schema_version string TRUE
#> 6 captured_at datetime TRUE
