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. |
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.
- Record the decision as an ADR in the handbook.
- Change
record-format.md. - Change
tools/make_vectors.pyand write the vectors again:python tools/make_vectors.py - Bring
tools/check_vectors.Rin line from the text of the specification and run it. Both must agree. - Release a new version. A change to the bytes of a leaf also needs a new format version byte.
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.
Apache-2.0.