noqtis-data(5)
NAME
noqtis-data — the
noqtis data record, noqtis-data-1
DESCRIPTION
A data record is the file noqtis.data.json
at the top of a capsule folder
(noqtis-capsule(5)).
It says where each data file of the capsule came from, what shape it has,
how it was summarised, and what was done and checked with it. The record is
an ordinary file of the capsule: the manifest lists it with its digests and
the seal covers it, so
noqtis-check(1)
fails when it changes, and
noqtis-data(1)
(noqtis data check) checks the files against what it
says.
The key words MUST, MUST NOT, SHOULD and MAY are to be read as in RFC 2119 and RFC 8174.
Canonical JSON
The record MUST be JSON (RFC 8259) in the canonical form of RFC 8785: UTF-8, no whitespace outside strings, object members sorted by the UTF-16 code units of their names, the minimal string escapes, and numbers as IEEE 754 doubles in the shortest form that round-trips, as ECMAScript writes them. A reader MUST reject a record that is not byte-identical to its own canonical form, has a duplicate member name, a string with U+0000 or not valid UTF-8, a number that is not finite, objects nested deeper than 32 levels, or more than 64 MiB. The same record is therefore the same bytes whichever program wrote it.
Types
- string
- at most 65,536 bytes.
- path
- a string naming a file of the capsule as the manifest does: relative,
‘
/’ between folders, no empty, ‘.’ or ‘..’ segment, no backslash, colon or control character, at most 4,096 bytes, and not noqtis.json, noqtis.sig, noqtis.ers or noqtis.data.json. - hex
- 64 lower-case hex digits.
- count
- a whole number from 0 to 2^53.
- time
- ‘
YYYY-MM-DDTHH:MM:SSZ’, a valid UTC time. - date
- ‘
YYYY-MM-DD’, a valid date of the proleptic Gregorian calendar.
The record
An object with format, the string
‘noqtis-data-1’, and any of the
members below; no other member. A reader MUST reject a member it does not
know, so that a record of a later format is refused rather than half-read.
Arrays keyed by path
(sources, schemas,
stats, chunks) or
name (checks) MUST be sorted
by the bytes of the key, with no key twice; steps
and commits keep the order they were written in. An
array of objects MUST NOT be empty: a member with nothing in it is left out,
so that each record has one form.
sources- Where each file came from. Each element:
path(path, required),sha256(hex, required: the file's SHA-256),size(count, required: its size in bytes), and optionallyurl(where it was fetched),resolver(an object:kind, one of ‘direct’, ‘ckan’, ‘socrata’, ‘arcgis’, ‘wayback’, required; and the stringsbase(the portal),id(the dataset),resource,format, and the countlayer),retrieved(time),etag,modified(the server's ETag and Last-Modified, as sent),licence,publisher,title(strings),archived(an object: the archived copy'surl, required, and itstime),mirrors(an array of URLs with the same bytes),synthetic(true when the file is a generated stand-in for the real data; every report line about it says so). schemas- The shape of a CSV file. Each element:
path(required),kind(required: ‘csv’),delim(one byte, not a quote or line break; default ‘,’),header(boolean; default true),na(an array of strings that mean a missing value; default ‘’ and ‘NA’),rows(an object with countsminandmax),columnsandrules.columnslists the columns in file order, each withname(required, no name twice),type(required: ‘int’, ‘real’, ‘text’, ‘date’ or ‘bool’),nulls(boolean: whether a missing value is allowed; default true),minandmax(numbers for ‘int’ and ‘real’, dates for ‘date’), andset(for ‘text’: the values allowed).rulesare checks over a column or the table, each withkindand its arguments: ‘unique’ (colorcols: no value, or combination, twice), ‘notnull’ (col), ‘range’ (col,minand/ormax), ‘set’ (col,set), ‘incr’ (col: each value at least the one before), ‘complete’ (col,share: at least that share not missing), ‘distinct’ (col,minand/ormaxdistinct values), ‘regex’ (col,pattern: each value matches the pattern), ‘mad’ (col,max: no value further from the median thanmaxtimes the scaled MAD), ‘rows’ and ‘cols’ (minand/ormax).A ‘
mad’ rule's scaled MAD is 1.4826 times the median of the absolute deviations from the median (R'smad()), andmaxis above 0; a value that is not a number fails, and when the scaled MAD is 0 every value other than the median fails. A ‘regex’ rule'spattern(at most 1,024 bytes) passes a value when it matches some part of it; anchor it with ‘^’ and ‘$’ to match the whole value. Its syntax is this subset, over Unicode code points (a byte that is not UTF-8 is one character, matched only by ‘.’ and a negated class), and a reader MUST refuse anything else: a character stands for itself; ‘.’ is any character, a line break too; ‘^’ and ‘$’ match at the start and the end of the value; ‘[...]’ is a class of characters and ranges ‘a-z’, ‘[^...]’ its complement, ‘-’ first or last is itself, and ‘\\’, ‘\]’, ‘\-’, ‘\[’ and ‘\^’ are those characters in a class; ‘\d’, ‘\w’ and ‘\s’ are the ASCII digits, word characters (digits, letters, ‘_’) and white space (tab, line feed, vertical tab, form feed, carriage return, space), in a class too; a backslash before one of ‘\.[](){}|*+?^$-/’ makes it itself; ‘*’, ‘+’ and ‘?’ repeat what is before them zero or more times, once or more and at most once; ‘|’ separates alternatives and ‘(...)’ groups, at most 64 deep. ‘{’, ‘}’ and an unescaped ‘]’ are refused, as are an empty pattern, group, alternative or class. stats- Summaries kept to detect drift later without keeping the data
(noqtis-drift(1)).
Each element:
path(required),rows(count, required),delimandheader(how the file was read, as for a schema, when not the default) andcolumns, each withnameandn(required: the values not missing),nulls, and for a numeric columnq(the quantile sketch: [value, count] pairs, value increasing, count the number of values at most it),edgesandcounts(the binning of the population stability index: increasing interior edges, bins closed on the right, one count more than edges),digits(nine counts of first significant digits 1 to 9); for any columncal(its calibration on files known not to have drifted: an object withn, the number of files, at least 1,psi, the largest PSI seen, at least 0,p, the smallest KS or chi-square p-value, and for a numeric columnbp, the smallest Benford p-value, both from 0 to 1; noqtis-drift(1)); for a categorical columncats([value, count] pairs sorted by value) andother(the count of values beyond those kept). noqtis-drift(1) defines how they are made and the error of each test made from them. chunks- Digests of the runs of one large file, so that a piece of it can be
checked without the rest
(noqtis-chunk(1)).
Each element, every member required:
path;size(the file's bytes);chunk(the bytes in a run, 1024 to 1073741824);digests(the SHA-256 of each run in order, 64 lower-case hex digits each, the last run short: exactly ‘ceil(size / chunk)’ of them, none for an empty file). env- The environment of the run: strings
os,arch,kernel,cpu,locale,tz,noqtis,build;runtime(an object:languagerequired,version,packages, an array of {name,version,source} sorted by name);locks(lock files: an array of {path,sha256} sorted by path);rng(an object:kindrequired, andseed, a number or string). steps- What was done to the data, in order: each with
kind(required: ‘recode’, ‘filter’, ‘derive’, ‘script’ or ‘other’), and the stringsfrom,to,note,script(a path) andsha256(of a mapping or script; withscript, the SHA-256 of that file, whichnoqtis data checkchecks). checks- Results of checks made elsewhere (a published total, a falsification
test): each with
name(required),status(required: ‘pass’, ‘warn’ or ‘fail’),expectedandobserved(a number or string),tol(a number, at least 0) andnote. A reader can recompute the result: withexpectedandobservednumbers it holds when ‘|observed - expected| <= tol’ (tol0 when not given), with strings when they are equal. A check recorded as ‘fail’ fails its row innoqtis data check. commits- Sealed commitments (a randomisation list, a pre-registration): each with
kind(required: ‘randomisation’, ‘preregistration’ or ‘other’),created(time, required),alg(required: ‘sha3-256’),digest(hex, required),after(time: not to be revealed before) andlabel. cite- How to cite the data: an object with
title(required),authors(an array of strings),version,doi,url,licenceand the countyear.
EXAMPLES
{"format":"noqtis-data-1","sources":[{"licence":"OGL-Canada-2.0",
"path":"data/a.csv","publisher":"City of Example",
"retrieved":"2026-01-01T00:00:00Z","sha256":"7a1668480cde19db0b76c7a36e6
fee9a82afd9937f5d03cec3dae1705ce173e2","size":89,
"url":"https://example.org/a.csv"}]}
(one line in the file; broken here to fit).
SEE ALSO
STANDARDS
The JavaScript Object Notation (JSON) Data Interchange Format, RFC 8259. JSON Canonicalization Scheme (JCS), RFC 8785. Common Format and MIME Type for Comma-Separated Values (CSV) Files, RFC 4180.