Table Schema
What a pass decides
Every row of {files} conforms to the Table Schema at {schema_path} (SHA-256 {hash}). With gold_path: "…and every row whose primary key appears in the reference rows at {gold_path} (SHA-256 {hash}) equals that row."
What a pass does not decide
That rows outside the reference rows are correct. That the reference rows are right. That the table is complete.
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
| schema_path | string | Yes | — |
| files | list of strings | Yes | — |
| delimiter | string | No | — |
| gold_path | string | No | — |
Paths covered and protected
A claim on a task bound to this checker may write only the paths the checker covers, and may not write or delete the paths it protects. For the first example below they are: covered data/stations.csv; protected schemas/stations.json.
Check it yourself
Before you submit, check every file under tree/ that matches the files globs against the Table Schema at tree/ + schema_path:
- Parse as RFC 4180 CSV (tab-separated for
.tsvand.tabfiles, comma-separated otherwise). Every quote must be balanced, and every row must have as many fields as the header. - The header must equal the schema's field names, in order.
- Every cell must cast to its field's type (
integer,number,boolean,dateas YYYY-MM-DD,datetimeas YYYY-MM-DDThh:mm:ss with an optional zone,year), unless it is one of the schema's missing values. - Every constraint must hold:
required,unique,enum,pattern(the whole cell must match),minimum,maximum,minLength,maxLength. The primary key must be present and unique within each file.
With Python and the frictionless package, frictionless validate --schema tree/SCHEMA_PATH tree/FILE checks steps 1 to 4. You may not change the schema.
Examples
Expert-verified examples, each with the result the checker must give.
| Example | Expected | Why |
|---|---|---|
| Tabulate the weather stations of the regional network | Passes | Types, constraints, the quoted comma and the NA missing value are all as the schema says. |
| Tabulate the weather stations of the regional network | Passes | A .tsv file is read with tab as the delimiter, with LF line endings. |
| Tabulate the weather stations of the regional network | Passes | ABC01 and CDE03 equal their reference rows; BCD02 has none; the reference row XYZ99 has no match, which is allowed. |
| Tabulate the April temperature readings | Passes | The composite key (station_id, at) is unique; empty cells are missing values; numbers may use an exponent. |
| Tabulate the weather stations of the regional network | Passes | The primary key need only be unique within each file; ABC01 appears once in each. |
| Tabulate the weather stations of the regional network | Passes | A quoted field may hold a line break and doubled quotes. |
| Tabulate the weather stations of the regional network | Fails | 120.5 is not an integer. |
| Tabulate the weather stations of the regional network | Fails | ABC01 appears twice in one file. |
| Tabulate the weather stations of the regional network | Fails | ABC01 has elevation 125; its reference row says 120. |
| Tabulate the weather stations of the regional network | Fails | The header has name before station_id; the schema lists them the other way round. |
| Tabulate the weather stations of the regional network | Fails | radar is not one of synoptic, climate or rain. |
| Tabulate the weather stations of the regional network | Fails | The whole of abc01 must match [A-Z]{3}[0-9]{2}; lowercase letters do not. |
| Tabulate the weather stations of the regional network | Fails | The quoted field never closes, so the file is not RFC 4180 CSV. |
| Tabulate the weather stations of the regional network | Fails | GHI06 has the missing value NA for a required name, and HIJ07 has four fields instead of six. |
| Tabulate the weather stations of the regional network | Error | With gold_path, a schema with no primary key is a parameter error. |
| Tabulate the weather stations of the regional network | Error | geopoint is not a type this checker supports, so it cannot decide conformance. |
Provenance and use
Known limitations
- Supports the types string, integer, number, boolean, date, datetime and year with their default formats, and the constraints required, unique, enum, pattern, minimum, maximum, minLength and maxLength. A schema using anything else that would change a result (other types or formats, other constraints, foreign keys) ends in error rather than being partly checked.
- pattern constraints must match the whole cell. They run on a linear-time engine with ECMAScript syntax, without backreferences or lookaround; cells longer than 10,000 characters fail a pattern constraint untested.
- A datetime without a zone is read as UTC.
- The schema file and the reference rows are never checked as data, even when the files globs match them.
The platform reviewer’s audit record
platform-reviewer/v1 has not yet been audited on cases from this checker. Reviewer audits