Motivation
tidyverse/data-dict is an emerging YAML specification (v0.1.0) for data dictionaries: semantic types (number(id), number(quantity) + units, enum + values), constraints (primary_key, foreign_key, required, assertions), cross-table relationships, and a domain glossary — all machine-readable and AI-agent-readable. Full analysis: dev/research-data-dict-integration.md.
data-raw/dictionary.csv is a flat, weaker version of one tables: block. This issue is the additive first step (Option A in the research doc): keep the CSV as the authoring surface and generate data-dict.yaml from it, the same way setup_roxygen() and generate_jsonld() are downstream renderings today.
Proposal
New exported function setup_datadict() (with an update_datadict() re-run path, consistent with the v1.1.0 idempotency sweep in #73) that writes data-dict.yaml at the package root:
- dataset-level
name / description from DESCRIPTION (via desc)
- one
tables: entry per .rda in data/
- column
name and description from data-raw/dictionary.csv
type mapped from R classes: character → string, numeric/integer → number, factor → enum + values from levels, logical → boolean, Date → date, POSIXct → datetime
examples: (first ~5 distinct values) and range: (min/max for numeric/date) drawn from the data — cheap since collect_tidydata_info() already loads every dataset
YAML emission via yaml::write_yaml() (one small new dependency). No dependency on the Rust CLI — generation is pure R.
Acceptance criteria
Related: #13 (updating an existing dictionary), #83 (AI-assisted descriptions — data-dict ships agent skills for authoring dictionaries).
Motivation
tidyverse/data-dict is an emerging YAML specification (v0.1.0) for data dictionaries: semantic types (
number(id),number(quantity)+units,enum+values), constraints (primary_key,foreign_key,required, assertions), cross-table relationships, and a domain glossary — all machine-readable and AI-agent-readable. Full analysis: dev/research-data-dict-integration.md.data-raw/dictionary.csvis a flat, weaker version of onetables:block. This issue is the additive first step (Option A in the research doc): keep the CSV as the authoring surface and generatedata-dict.yamlfrom it, the same waysetup_roxygen()andgenerate_jsonld()are downstream renderings today.Proposal
New exported function
setup_datadict()(with anupdate_datadict()re-run path, consistent with the v1.1.0 idempotency sweep in #73) that writesdata-dict.yamlat the package root:name/descriptionfromDESCRIPTION(viadesc)tables:entry per.rdaindata/nameanddescriptionfromdata-raw/dictionary.csvtypemapped from R classes: character →string, numeric/integer →number, factor →enum+valuesfrom levels, logical →boolean, Date →date, POSIXct →datetimeexamples:(first ~5 distinct values) andrange:(min/max for numeric/date) drawn from the data — cheap sincecollect_tidydata_info()already loads every datasetYAML emission via
yaml::write_yaml()(one small new dependency). No dependency on the Rust CLI — generation is pure R.Acceptance criteria
setup_datadict()on a package with a completed dictionary produces adata-dict.yamlthat passesdata-dict validate-specRelated: #13 (updating an existing dictionary), #83 (AI-assisted descriptions — data-dict ships agent skills for authoring dictionaries).