Download the packaged schemas and survey example. This article also describes the YAML contracts for reference configurations and catalogue mappings.
Use Work with reference catalogues for reference retrieval and Catalogue mapping for resolution.
All schemas and examples are included in the installed package.
The ZIP archive preserves schema/ and
examples/, including both survey catalogues and their
relative paths.
Its file name includes the package version; each schema retains its own format version.
Keep the survey directory together when using its configurations and correspondence CSVs locally.
You can also locate the installed resources:
See Model specification for the form model contract.
Each reference and mapping configuration declares
schema_version: "1.0.0"; this version identifies its
format.
Catalogue publications, table revisions and correspondence data have separate versions or checksums.
| File | Purpose |
|---|---|
mapping-1.0.0.yaml |
Catalogue mapping schema. |
model-1.0.0.yaml |
Form model schema. |
references-1.0.0.yaml |
Reference configuration schema. |
The reference and mapping schemas use these building blocks:
dialect, contract_version and
root identify the contract and its starting
definition.definitions and ref define and reuse
nodes.type, properties and required
describe values and mandatory fields.values describes named mapping entries;
min_items requires a minimum number of entries.enum, min_length, minimum and
exclusive_minimum constrain individual values.environment: true permits a YAML !env
reference at that location in a reference configuration.one_of, sequence,
items and mutually_exclusive.Unknown properties, duplicate keys and empty mapping keys are invalid.
YAML expressions are never evaluated. Use the package readers to validate these contracts.
references-1.0.0.yaml defines the
form.references/schema/1 dialect.
Use reference_schema() to inspect it and
read_reference_configuration() to read a configuration.
Reading validates the structure and source settings without retrieving catalogue data.
schema_version must be the string
"1.0.0".catalogues contains at least one named catalogue.source and tables;
an optional label names it for consumers.source.url identifies an existing local directory or an
HTTP(S) catalogue URL.tables contains at least one table ID, each with at
least one named lookup column.matching: exact or
matching: name, plus the boolean
ignore_case.Table IDs and lookup names are exact declarations; lookup names identify actual columns.
Each source directory contains catalogue.yaml,
catalogue.csv and the CSV files listed in that
catalogue.
| Field | Default | Meaning |
|---|---|---|
cache |
Session temporary path | Set a path explicitly to reuse files across runs. |
timeout |
60 |
Positive request timeout in seconds. |
max_connections |
4 |
Positive whole-number limit for CSV downloads. |
user |
Omitted | User name for HTTPS Basic authentication. |
password |
Omitted | Password, usually supplied through !env. |
cache gives each source a temporary path for
the current R session.user and password together for
HTTPS Basic authentication.url, cache, user and
password accept !env VARIABLE; it names an
environment variable.prompt = TRUE, the reader can securely request a
missing environment password.label defaults to its identifier
when lookups are resolved.See private catalogue authentication for the workflow.
This is the target configuration used by the survey examples.
schema_version: "1.0.0"
catalogues:
code_lists:
label: Code lists
source:
url: catalogue/code_lists/
tables:
stations:
code: {matching: exact, ignore_case: false}
observers:
code: {matching: exact, ignore_case: true}
name: {matching: name, ignore_case: true}
registries:
label: Registries
source:
url: catalogue/registries/
tables:
contacts:
email: {matching: exact, ignore_case: true}
name: {matching: name, ignore_case: true}mapping-1.0.0.yaml defines the
form.references/mapping-schema/1 dialect.
Use mapping_schema() to inspect it and
read_mapping_configuration() to read a mapping.
The reader validates structure, resolves lookup defaults and checks duplicate alternative selections.
It does not retrieve catalogue data, load reference configurations or open correspondence CSVs.
schema_version must be the string
"1.0.0".catalogues requires both source and
target, each with configuration and
catalogue names.mappings contains at least one target table ID.source.table.The schema’s additional building blocks describe those alternatives:
one_of requires exactly one structural
alternative.sequence describes an unnamed list whose entries are
checked through items.mutually_exclusive forbids fields together; dotted
paths address nested properties.configuration names a reference configuration supplied
by the caller.catalogue selects an entry in that configuration’s
catalogues mapping.These are names, not filesystem paths. Catalogue URLs, credentials and lookup settings stay in their configurations.
Start from the required target reference, then supply the input value with its source identity.
mappings is a target catalogue
table ID.source.table identifies the source table supplying
values for that target.Alternatives are not fallbacks or a transformation chain. Never select the first one or retry after a failed match.
Each entry can override the catalogue defaults:
| Setting | Default | Role |
|---|---|---|
source.lookup |
catalogues.source.lookup |
Identify the source input column. |
lookup |
catalogues.target.lookup |
Select the target lookup column. |
property |
The effective target lookup |
Select the target column to return. |
Both effective lookups must be declared, either in the entry or through the catalogue defaults.
Two rules determine where the correspondence comes from:
source.property and file are optional and
mutually exclusive; there is no mode property.source.property and use the input unchanged.That shortcut performs no source lookup and does not resolve source aliases.
The station entry uses a CSV; the observer entries show source-property and unchanged-input correspondences.
schema_version: "1.0.0"
catalogues:
source: {configuration: source, catalogue: code_lists, lookup: id}
target: {configuration: target, catalogue: code_lists, lookup: code}
mappings:
stations:
source:
table: stations
file: correspondences/stations.csv
observers:
- source:
table: observers
property: name
lookup: name
property: code
- source:
table: observers
lookup: name
lookup: name
property: codefile selects a local CSV with exactly two columns:
source_value and target_value.mapping.yaml.The survey correspondence file deliberately includes repeated, conflicting and unmatched values.
source_value,target_value
station-north,001
station-north,001
station-south,002
station-legacy,OLD-STATION
station-conflict,001
station-conflict,002
station-absent,999
See Catalogue mapping for matching order, resolution outcomes and provenance.
Every file below is included in the complete archive and in the installed package.
Directory: examples/survey/.
| File | Purpose |
|---|---|
README.md |
Directory layout and usage notes. |
form-empty.xlsx |
Empty survey form. |
form.xlsx |
Populated survey form. |
form.yaml |
Survey form model. |
mapping.yaml |
Station and observer correspondences between the catalogues. |
references-source.yaml |
Source code lists using technical identifiers. |
references.yaml |
Target code lists and the survey contact registry. |
Directory: examples/survey/correspondences/.
| File | Purpose |
|---|---|
stations.csv |
Explicit source station IDs and target station codes. |
Directory:
examples/survey/catalogue-source/code_lists/.
These records use technical identifiers; observer names allow rebound to the target name lookup.
| File | Purpose |
|---|---|
catalogue.csv |
Table IDs, paths, versions, source dates and checksums. |
catalogue.yaml |
Catalogue publication metadata and checksum. |
catalogue_aliases.csv |
Aliases attached to individual catalogue lookups. |
observers.csv |
Observer reference records. |
stations.csv |
Station reference records. |
Directory: examples/survey/catalogue/code_lists/.
These tables contain the station and observer codes expected by the survey form model.
| File | Purpose |
|---|---|
catalogue.csv |
Table IDs, paths, versions, source dates and checksums. |
catalogue.yaml |
Catalogue publication metadata and checksum. |
catalogue_aliases.csv |
Aliases attached to individual catalogue lookups. |
observers.csv |
Observer reference records. |
stations.csv |
Station reference records. |
Directory: examples/survey/catalogue/registries/.
| File | Purpose |
|---|---|
catalogue.csv |
Table IDs, paths, versions, source dates and checksums. |
catalogue.yaml |
Catalogue publication metadata and checksum. |
catalogue_aliases.csv |
Aliases attached to individual catalogue lookups. |
contacts.csv |
Contact registry records. |
Directory: examples/.
The private-source template needs your catalogue URLs and user name before use.
| File | Purpose |
|---|---|
README.md |
Directory layout and usage notes. |
references.private.example.yaml |
Public code lists and a private HTTPS registry template. |
See Getting started to load the survey form model.
The same catalogue files can be retrieved directly from the website.
# Load the catalogue retrieval functions.
library(form.model)
# Choose a temporary cache for these downloads.
resources_cache_directory <- tempfile("survey-resources-")
# Configure the published target code lists.
reference_source_configuration <- reference_source(
"https://ultreia-io.github.io/form.model/examples/survey/catalogue/code_lists/", resources_cache_directory)
# Retrieve the station and observer tables, verifying their checksums.
reference_values <- get_reference_tables(c("observers", "stations"), reference_source_configuration)
# Configure the published contact registry.
reference_registry_source <- reference_source(
"https://ultreia-io.github.io/form.model/examples/survey/catalogue/registries/", resources_cache_directory)
# Retrieve and verify the contact table.
reference_registry_tables <- get_reference_tables("contacts", reference_registry_source)
# Remove the temporary files created by this example.
unlink(resources_cache_directory, recursive = TRUE)