Skip to content
TidystudyPublic

About

Tidystudy record format and its test vectors.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Tidystudy spec

Tidystudy specification

This repository defines the record format of Tidystudy and holds the test vectors for it. It contains no product code.

Tidystudy is an R package in development. It will keep study data as they arrive and show what changed between the raw data and the analysis. It is meant for data with one row per case and one column per variable. Surveys will be the first source. The R package implements this specification. A separate verifier in Python is planned (ADR-0005). It will share the test vectors with the R package and no code.

Status: version 0, draft. It covers leaves, the Merkle tree, how a record grows, withdrawal and the check of a part. It does not yet cover the log, timestamps or file formats. See section 9 of the specification.

Path Content
record-format.md The specification.
vectors/ Test vectors as JSON, with a description of their layout.
tools/make_vectors.py Writes the vectors. Python standard library only.
tools/check_vectors.R Computes every vector again in R. Written from the text of the specification, independent of the Python script.

Use the vectors in an implementation

Copy the folder vectors/ of one commit into the code repository and record the hash of the copy. CI checks that the copy is unchanged. Do not fetch the vectors at test time: tests must run without network.

Change the specification

  1. Record the decision as an ADR in the handbook.
  2. Change record-format.md.
  3. Change tools/make_vectors.py and write the vectors again: python tools/make_vectors.py
  4. Bring tools/check_vectors.R in line from the text of the specification and run it. Both must agree.
  5. Release a new version. A change to the bytes of a leaf also needs a new format version byte.

Run the checks

python tools/make_vectors.py
docker run --rm -v "${PWD}:/spec" rocker/r-ver@sha256:b344cf44c8cfb787d9e091cb88a9694fbc771e7600edaa7b545030babfc05bf3 bash -c "install2.r --error jsonlite > /dev/null && Rscript /spec/tools/check_vectors.R /spec/vectors"

The first command writes the test vectors again from tools/make_vectors.py. It must leave git status clean, which shows that the vectors in the repository come from the script. The second command runs tools/check_vectors.R, a second implementation in R that computes every expected value again from the text of the specification. It must report no failure. The image is R 4.6.2. The script needs R 4.5.0 or later.

Licence

Apache-2.0.

About

Tidystudy record format and its test vectors.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages