lschiemanowski commited on
Commit
9332cbf
·
verified ·
1 Parent(s): 86d4f4a

Consolidate dataset documentation and JSON format guide in root README

Browse files
README.md CHANGED
@@ -17,7 +17,7 @@ Transactions from a UK-based online retailer between December 2009 and December
17
 
18
  Source: [Chen, D. (2012), *Online Retail II*, UCI Machine Learning Repository](https://doi.org/10.24432/C5CG6D). Source data licensed under CC BY 4.0.
19
 
20
- [Database documentation](https://huggingface.co/datasets/lschiemanowski/dsa-datasets/blob/main/online-retail-ii/README.md) · [All problems](https://huggingface.co/datasets/lschiemanowski/dsa-datasets/blob/main/online-retail-ii/PROBLEMS.md)
21
 
22
  ### SMARD DE/LU 2024
23
 
@@ -25,7 +25,7 @@ Electricity-market data for the Germany–Luxembourg market area in 2024. The da
25
 
26
  Source: [Bundesnetzagentur | SMARD.de](https://www.smard.de/en). Source data licensed under CC BY 4.0.
27
 
28
- [Database documentation](https://huggingface.co/datasets/lschiemanowski/dsa-datasets/blob/main/smard-de-lu-2024/README.md) · [All problems](https://huggingface.co/datasets/lschiemanowski/dsa-datasets/blob/main/smard-de-lu-2024/PROBLEMS.md)
29
 
30
  ### EEA Air Quality — Six Cities, 2018–2024
31
 
@@ -33,7 +33,7 @@ Air-quality observations for Berlin, Madrid, Paris, Rome, Stockholm, and Warsaw.
33
 
34
  Source: [European Environment Agency (EEA), Air Quality Download Service](https://www.eea.europa.eu/en/datahub/datahubitem-view/778ef9f5-6293-4846-badd-56a29c70880d). Source data licensed under CC BY 4.0. The EEA does not endorse this derived dataset.
35
 
36
- [Database documentation](https://huggingface.co/datasets/lschiemanowski/dsa-datasets/blob/main/eea-air-quality-six-cities-2018-2024/README.md) · [All problems](https://huggingface.co/datasets/lschiemanowski/dsa-datasets/blob/main/eea-air-quality-six-cities-2018-2024/PROBLEMS.md)
37
 
38
  The dsa-authored problem sets and accompanying documentation are also distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Each database folder includes detailed source attribution.
39
 
@@ -43,3 +43,142 @@ The dsa-authored problem sets and accompanying documentation are also distribute
43
  - **SMARD:** On which day was renewable generation largest relative to grid load?
44
 
45
  The linked problem lists include the calculation details and required answer fields for each question.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  Source: [Chen, D. (2012), *Online Retail II*, UCI Machine Learning Repository](https://doi.org/10.24432/C5CG6D). Source data licensed under CC BY 4.0.
19
 
20
+ [All problems](online-retail-ii/PROBLEMS.md) · [Attribution](online-retail-ii/ATTRIBUTION.md)
21
 
22
  ### SMARD DE/LU 2024
23
 
 
25
 
26
  Source: [Bundesnetzagentur | SMARD.de](https://www.smard.de/en). Source data licensed under CC BY 4.0.
27
 
28
+ [All problems](smard-de-lu-2024/PROBLEMS.md) · [Attribution](smard-de-lu-2024/ATTRIBUTION.md)
29
 
30
  ### EEA Air Quality — Six Cities, 2018–2024
31
 
 
33
 
34
  Source: [European Environment Agency (EEA), Air Quality Download Service](https://www.eea.europa.eu/en/datahub/datahubitem-view/778ef9f5-6293-4846-badd-56a29c70880d). Source data licensed under CC BY 4.0. The EEA does not endorse this derived dataset.
35
 
36
+ [All problems](eea-air-quality-six-cities-2018-2024/PROBLEMS.md) · [Attribution](eea-air-quality-six-cities-2018-2024/ATTRIBUTION.md)
37
 
38
  The dsa-authored problem sets and accompanying documentation are also distributed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Each database folder includes detailed source attribution.
39
 
 
43
  - **SMARD:** On which day was renewable generation largest relative to grid load?
44
 
45
  The linked problem lists include the calculation details and required answer fields for each question.
46
+
47
+ ## Folder layout
48
+
49
+ Each top-level dataset folder is a self-contained evaluation pack. There are no version directories in the current layout.
50
+
51
+ | File | Purpose |
52
+ | --- | --- |
53
+ | `pack.json` | Entry point: identifies the database, case export, scoring policy, and their checksums. |
54
+ | `cases.jsonl` | Machine-readable questions, answer schemas, reference answers, and case metadata; one JSON object per line. |
55
+ | `PROBLEMS.md` | Human-readable problem catalog, including calculation conventions and answer fields. |
56
+ | `ATTRIBUTION.md` | Original sources, citations, licensing, and attribution. |
57
+ | `database/<name>.duckdb` | Ready-to-query database; its exact filename is in `pack.json`. |
58
+ | `database/build_report.json` | Dataset-specific build statistics and source provenance. |
59
+ | `reference-queries.jsonl` | Retained reference SQL for the cases recomputed during the revision. Not a complete reference implementation for every case. |
60
+ | `changes.json` | Per-case revision history and provisional difficulty labels. |
61
+ | `source.json` | Identity of the predecessor pack and unchanged source database. |
62
+ | `validation.json` | Export digests, case counts, and revision summary. |
63
+ | `verification.json` | Recorded schema checks, reference replays, and independent-check coverage. |
64
+
65
+ Some files are dataset-specific:
66
+
67
+ - Online Retail II additionally has `database-card.json`, used by the chat application to describe the database.
68
+ - Online Retail II and EEA include `database/schema.sql` and `database/views.sql`, documenting the packaged relations. The DuckDB file is already built; these scripts need not be run to use it.
69
+ - EEA also includes `database/source_manifest.json`, listing the source-request archives and their identities. These archives are provenance references, not additional files bundled here.
70
+
71
+ The root `.gitattributes` file is repository storage configuration, not part of the evaluation contract.
72
+
73
+ ## JSON formats
74
+
75
+ All JSON and JSONL files are UTF-8. A `.json` file contains one JSON value; a `.jsonl` file contains one complete object per line and is not wrapped in an array. SHA-256 digests are lowercase hexadecimal strings. File paths in `pack.json` are relative to its dataset folder.
76
+
77
+ ### `pack.json`: evaluation manifest
78
+
79
+ The manifest uses the `dsa-evaluation-pack/v1` contract. Its fields are:
80
+
81
+ | Field | Type and meaning |
82
+ | --- | --- |
83
+ | `format` | String, exactly `dsa-evaluation-pack/v1`. |
84
+ | `pack_id` | String identifying the problem set. |
85
+ | `version` | Pack revision as a `major.minor.patch` string; currently `2.0.0`. This is metadata, not a directory name. |
86
+ | `license` | License identifier, currently `CC-BY-4.0`. |
87
+ | `database` | Object with `id`, `path`, `size_bytes`, and `sha256`. Identifies the exact DuckDB file. |
88
+ | `cases` | Object with `path`, `size_bytes`, `sha256`, and `case_count`. Identifies the exact JSONL export. |
89
+ | `scorer` | Object selecting the answer-comparison policy. |
90
+ | `provenance` | Object containing `source_datasets`, an array of export identities with `name`, `version`, `case_count`, and `export_sha256`. These identify case exports, not the original real-world data providers. |
91
+
92
+ All three current packs use `{"name":"exact-json","version":"1"}`. Answers are compared structurally, not by their display formatting: object-key order is irrelevant, but array order and numeric types matter. Follow each question's rounding and ordering requirements.
93
+
94
+ The loader also supports `json-numeric-tolerance` version `1`, with numeric `relative_tolerance` and `absolute_tolerance` fields. That policy allows tolerance for expected floating-point values while preserving exact integer comparisons. It is not selected by the current three manifests; do not silently substitute it when reporting their results.
95
+
96
+ ### `cases.jsonl`: one evaluation case per line
97
+
98
+ | Field | Type and meaning |
99
+ | --- | --- |
100
+ | `case_id` | String identifying the case within the pack. |
101
+ | `case_version` | String identifying the case revision. |
102
+ | `question` | Complete natural-language task, including calculation details and data conventions. |
103
+ | `answer_schema` | JSON Schema Draft 2020-12 object defining the required answer shape and constraints. |
104
+ | `expected_answer` | JSON value satisfying `answer_schema`; used only by the evaluator. |
105
+ | `metadata` | Object with string fields `family` (task category) and `source_level` (provisional difficulty). |
106
+ | `derivation` | Optional object `{"format":"dsa-derivation/v1"}` requesting a replay-verified derivation; absent from the current exports. |
107
+
108
+ For example, a one-number answer may use this `answer_schema`:
109
+
110
+ ```json
111
+ {
112
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
113
+ "type": "object",
114
+ "properties": {"total_mwh": {"type": "number"}},
115
+ "required": ["total_mwh"],
116
+ "additionalProperties": false
117
+ }
118
+ ```
119
+
120
+ Schema validation checks answer structure, not factual correctness. Evaluation additionally compares the answer with `expected_answer` using the manifest's scorer. The full task is in `question`; the short opening sentence alone can omit important constraints.
121
+
122
+ The authoritative validated manifest and case contracts are defined in [`dsa.pack`](https://github.com/lschiemanowski/dsa/blob/main/src/dsa/pack.py). Each case carries its own answer schema rather than sharing a single universal answer format.
123
+
124
+ ### `database-card.json`: chat presentation
125
+
126
+ Currently provided only for Online Retail II, this object uses `format: "dsa-database-card/v1"` and contains:
127
+
128
+ - `title` and `summary`: strings describing the database;
129
+ - `coverage`: an object containing `period_start` and `period_end` strings, plus integer counts for `transaction_lines`, `invoices`, `identified_customers`, `product_codes`, and `country_values`;
130
+ - `primary_relation`: the schema-qualified name of the recommended table or view;
131
+ - `relations`: an array of objects with `name`, `kind` (`table` or `view`), `row_count`, `description`, and `columns`. Each column has string fields `name`, `data_type`, and `description`;
132
+ - `example_questions`: an array of strings for user orientation;
133
+ - `analysis_notes`: an array of model-facing analytical conventions, separated from the user-facing description.
134
+
135
+ This is a presentation document, not an evaluation-case export. Its current coverage fields are retail-specific. The validated contract is defined in the [chat application's database-card module](https://github.com/lschiemanowski/dsa/blob/main/apps/private_data_chat/database_card.py).
136
+
137
+ ### Revision and verification records
138
+
139
+ These are supporting authoring records, not additional model inputs or universally versioned runtime contracts. Their current shapes are:
140
+
141
+ | File | Contents |
142
+ | --- | --- |
143
+ | `reference-queries.jsonl` | Objects with `case_id`, `sql`, `origin`, and `array_key`. The nullable `array_key` controls how query rows are wrapped into an answer object by the authoring code. |
144
+ | `changes.json` | Array of objects with `case_id`, `previous_case_id`, integer `slot`, `action`, `task_type`, `analytical_operation`, `difficulty`, `difficulty_status`, `reference_status`, and booleans `answer_schema_changed` and `answer_changed`. Slots are one-based positions in the revision. |
145
+ | `source.json` | Object with `predecessor`, `database_relative_to_source_root`, `database_sha256`, and `status`. `predecessor` contains `format`, `repo_id`, `revision`, `path`, and `manifest_sha256`, identifying the earlier pack at a pinned repository commit. |
146
+ | `validation.json` | Object with `pack`, `version`, `cases`, four digest fields (`cases_sha256`, `database_sha256`, `manifest_sha256`, `reference_queries_sha256`), counts (`replaced`, `rewritten`, `recomputed_answers`, `pinned_predecessor_answers`), and count mappings `difficulty` and `types`. |
147
+ | `verification.json` | Object with `pack`, `cases_sha256`, `manifest_sha256`, `database_unchanged`, `production_loader`, `schemas_checked`, `reference_queries_replayed`, and an array of `independent_python_case_slots`. |
148
+
149
+ `source.json` is retained from authoring: its `status` may say `unpublished-local-candidate`, and its source path may contain an old version directory. These describe the historical build input, not the current publication status or download path. Use `pack.json` for current file locations.
150
+
151
+ The current revision records 244 replayed reference queries and 11 independent Python checks across the three packs. Another 56 answers were retained from pinned predecessors without new independent recomputation. The `production_loader` receipt records a local-transport check at authoring time; it is not a live service-health report. Difficulty labels are provisional, not calibrated model-performance measurements.
152
+
153
+ ### Database provenance records
154
+
155
+ `database/build_report.json` varies by dataset; it does not have a single shared schema:
156
+
157
+ - **Online Retail II:** source archive and SHA-256, build time and tool versions, worksheet/raw/analysis row counts, overlap checks, quality metrics, and build checks.
158
+ - **SMARD:** database identity and SHA-256, region and time coverage, interval count, licensing and attribution, and a `source_files` array. Each source-file record includes its identifier, request JSON string, response filename, retrieval time, byte count, row count, and SHA-256.
159
+ - **EEA:** `format: "dsa-eea-air-quality-build-report/v1"`, database identity/size/SHA-256, source details, licensing, reporting-time coverage, cities, pollutants, sampling-point and relation counts, and a `source_requests` array containing archive/request identities, request JSON strings, checksums, and measurement-coverage statistics.
160
+
161
+ EEA's separate `database/source_manifest.json` uses `format: "dsa-eea-source-manifest/v1"`, with `retrieved_at_utc`, `endpoint`, and `entries`. Each entry identifies a source request and archive using `id`, `archive`, `request`, `city_id`, `city`, `source_city`, `country_code`, `start_utc_plus_1`, `end_utc_plus_1_exclusive`, `size_bytes`, and `sha256`. Historical request strings are preserved as sent; reporting-time conventions are described below.
162
+
163
+ ## Working with the databases
164
+
165
+ The `.duckdb` files can be opened directly with DuckDB; using `dsa` is optional. Tables and views are organized into `raw`, `analysis`, and `metadata` schemas. Start with these relations:
166
+
167
+ | Database | Recommended relations | Important conventions |
168
+ | --- | --- | --- |
169
+ | Online Retail II | `analysis.transaction_lines_nonoverlapping` | One transaction line per row; 1,044,848 rows after removing cross-sheet overlap from 1,067,371 raw rows. Quantities are signed, prices are in GBP, and timestamps are timezone-naive. Missing identifiers and within-sheet duplicates remain. Follow the case's eligibility rules. |
170
+ | SMARD | `analysis.quarter_hourly`, `analysis.daily` | 35,136 quarter-hour intervals in the 2024 local year. Use `Europe/Berlin` for calendar dates and UTC for unambiguous interval identities. Missing measurements are not imputed. |
171
+ | EEA | `analysis.valid_measurements`, `analysis.city_hourly`, `analysis.city_daily`, `analysis.city_monthly`, `analysis.city_annual` | Reporting timestamps use fixed UTC+1, not daylight-saving civil time. CO uses mg/m³; the other pollutants use µg/m³. Coverage varies, and missing observations are not imputed; Rome has no PM₁₀ or PM₂.₅ observations in this snapshot. |
172
+
173
+ EEA's valid-measurement relation accepts validity codes 1–4. City-hour means average available valid sampling-point values; longer-period means weight each available city-hour mean equally. The original measurements and metadata remain available for coverage and validity audits.
174
+
175
+ For evaluation, keep `expected_answer`, reference SQL, and verification records out of the model's inputs. Supply the database, complete question, and answer schema; use the remaining material on the evaluator side. Public reference answers make this a transparent demo benchmark, not a contamination-resistant hidden test set.
176
+
177
+ Download one dataset with the standalone Hugging Face CLI:
178
+
179
+ ```bash
180
+ uvx --from huggingface-hub hf download lschiemanowski/dsa-datasets \
181
+ --repo-type dataset --include 'online-retail-ii/*' --local-dir data
182
+ ```
183
+
184
+ For reproducible experiments, add `--revision <commit-sha>` and retain the selected commit together with the manifest digest. The `main` branch can change; a directory name alone is not a frozen benchmark identity. Existing commit-pinned historical packs remain available through repository history.
eea-air-quality-six-cities-2018-2024/README.md DELETED
@@ -1,9 +0,0 @@
1
- # EEA Air Quality — Six Cities, 2018–2024
2
-
3
- DuckDB data and 100 revised quantitative analysis problems.
4
-
5
- Browse [all problems](PROBLEMS.md), [database files](database/), and [source attribution](ATTRIBUTION.md). The September revision replaces 25 cases and rewrites 75, correcting comparison and coverage issues and removing answer-length hints.
6
-
7
- Load `pack.json` and `cases.jsonl` with DSA. Reference answers and reference SQL are evaluator-only. Pin a Hugging Face commit for reproducibility; public paths have no version directories. Internal manifest versions identify the contract.
8
-
9
- Validation receipts document reference replay and selected independent calculations; difficulty labels are provisional. Previous releases, including the historical 20-case derivation variant, remain accessible at their original repository commits.
 
 
 
 
 
 
 
 
 
 
online-retail-ii/README.md DELETED
@@ -1,9 +0,0 @@
1
- # Online Retail II
2
-
3
- DuckDB data and 100 revised quantitative analysis problems.
4
-
5
- Browse [all problems](PROBLEMS.md), [database files](database/), and [source attribution](ATTRIBUTION.md). The September revision replaces 25 cases and rewrites 75, correcting comparison and coverage issues and removing answer-length hints.
6
-
7
- Load `pack.json` and `cases.jsonl` with DSA. Reference answers and reference SQL are evaluator-only. Pin a Hugging Face commit for reproducibility; public paths have no version directories. Internal manifest versions identify the contract.
8
-
9
- Validation receipts document reference replay and selected independent calculations; difficulty labels are provisional. Previous releases, including the historical 20-case derivation variant, remain accessible at their original repository commits.
 
 
 
 
 
 
 
 
 
 
smard-de-lu-2024/README.md DELETED
@@ -1,9 +0,0 @@
1
- # SMARD DE/LU 2024
2
-
3
- DuckDB data and 100 revised quantitative analysis problems.
4
-
5
- Browse [all problems](PROBLEMS.md), [database files](database/), and [source attribution](ATTRIBUTION.md). The September revision replaces 25 cases and rewrites 75, correcting comparison and coverage issues and removing answer-length hints.
6
-
7
- Load `pack.json` and `cases.jsonl` with DSA. Reference answers and reference SQL are evaluator-only. Pin a Hugging Face commit for reproducibility; public paths have no version directories. Internal manifest versions identify the contract.
8
-
9
- Validation receipts document reference replay and selected independent calculations; difficulty labels are provisional. Previous releases, including the historical 20-case derivation variant, remain accessible at their original repository commits.