adambuttrick commited on
Commit
3f5d257
·
verified ·
1 Parent(s): 14d6235

Switch to one flat set of shards

Browse files
README.md CHANGED
@@ -5,15 +5,7 @@ configs:
5
  - config_name: default
6
  data_files:
7
  - split: train
8
- path: data/*/*.jsonl.gz
9
- - config_name: asserted
10
- data_files:
11
- - split: train
12
- path: data/asserted/*.jsonl.gz
13
- - config_name: mined
14
- data_files:
15
- - split: train
16
- path: data/mined/*.jsonl.gz
17
  tags:
18
  - datacite
19
  - crossref
@@ -37,7 +29,7 @@ Each record targets a cited DataCite DOI in `doi`. It inserts an `IsCitedBy` rel
37
 
38
  ## Contents
39
 
40
- The dataset contains **7,339,071 citations of 1,705,826 DataCite DOIs**, stored in 31 gzip-compressed JSONL shards in two partitions.
41
 
42
  | Measure | Count |
43
  | --- | ---: |
@@ -46,23 +38,14 @@ The dataset contains **7,339,071 citations of 1,705,826 DataCite DOIs**, stored
46
  | Source citing-work entries | 7,339,071 |
47
  | Source reference matches | 7,385,186 |
48
  | Output records | 7,339,071 |
49
- | Records in `asserted` | 1,269,805 |
50
- | `asserted` records with strongest provenance `publisher` | 1,192,204 |
51
- | `asserted` records with strongest provenance `crossref` | 77,601 |
52
- | Records in `mined` | 6,069,266 |
53
  | Records whose cited DOI is an arXiv DOI | 5,999,691 |
54
 
55
  Each source row lists every citing work once, so each pair of cited DOI and citing DOI yields one record. A citing work can match the cited DOI in more than one of its references. That is why source reference matches exceed records.
56
 
57
- The enrichment schema has no field for provenance, so the file layout keeps it. Each source citing-work entry carries the strongest provenance among its matches, ranked `publisher`, then `crossref`, then `mined`. The conversion writes `publisher` and `crossref` entries to `data/asserted/` and `mined` entries to `data/mined/`. Any other value stops the conversion.
58
-
59
- | Config | Files | Records |
60
- | --- | --- | ---: |
61
- | `default` | `data/*/*.jsonl.gz` | 7,339,071 |
62
- | `asserted` | `data/asserted/*.jsonl.gz` | 1,269,805 |
63
- | `mined` | `data/mined/*.jsonl.gz` | 6,069,266 |
64
-
65
- Each pair appears in exactly one partition. `asserted` holds the same 1,269,805 pairs as the source `asserted` configuration. `mined` holds the pairs whose strongest provenance is `mined`. The source `mined` configuration lists 6,070,488 pairs. 1,222 of those pairs have a mined match alongside a `publisher` or `crossref` match, so this dataset places them only in `asserted`.
66
 
67
  ## Mapping
68
 
@@ -71,7 +54,7 @@ Each pair appears in exactly one partition. `asserted` holds the same 1,269,805
71
  - Each `cited_by[].doi` maps to `enrichedValue.relatedIdentifier`. The value is a bare DOI name, as in the DataCite 4.7 relatedIdentifier example, not a `https://doi.org/` URL.
72
  - `relatedIdentifierType` is always `DOI`. `relationType` is always `IsCitedBy`.
73
  - `resourceTypeGeneral` is omitted because the source does not record the citing work's type.
74
- - The source match details (`match_type`, `raw_match`, and `reference`) are not carried. Only the partition keeps the provenance.
75
  - Both DOIs must pass the comet-enrich `is_valid_doi_name` check and be lowercase. A violation stops the conversion instead of dropping the record. The pinned source has none.
76
  - A repeated pair of cited DOI and citing DOI stops the conversion. The pinned source has none.
77
 
@@ -85,12 +68,12 @@ DOIs are copied as the source supplies them, already lowercase. Four cited DOIs
85
  "action": "insert",
86
  "field": "relatedIdentifiers",
87
  "enrichedValue": {
88
- "relatedIdentifier": "10.1002/9781394372539.ch6",
89
  "relatedIdentifierType": "DOI",
90
  "relationType": "IsCitedBy"
91
  },
92
  "sourceId": "",
93
- "contentKey": "8f221c7f80f2b7bad183b55359e24bb7"
94
  }
95
  ```
96
 
@@ -107,11 +90,11 @@ This follows the current [COMET content-key implementation](https://github.com/c
107
 
108
  ## Use
109
 
110
- Download the files under `data/` for direct enrichment ingestion. Each decompressed line is one schema-valid insertion record. To ingest only citations whose DOI the publisher or Crossref asserted, use `data/asserted/` or the `asserted` configuration.
111
 
112
  These are proposed insertions. This dataset does not apply them to DataCite records. It does not compare them with the relatedIdentifiers already deposited in DataCite, so some records may duplicate an existing relation.
113
 
114
- Each configuration has one `train` split. Every record has all three `enrichedValue` properties, so loading through Arrow adds no null properties.
115
 
116
  ## Reproduce and validate
117
 
@@ -134,10 +117,10 @@ python verify_source.py rebuilt --source-dir source/data/all
134
 
135
  To fill `sourceId` once the project has a DOI, add `--source-id <doi>` to the `convert.py` command. The data files change, but every `contentKey` stays the same.
136
 
137
- `convert.py` checks the SHA-256 of the pinned pipeline manifest, then the size and SHA-256 of each `all` parquet file that the manifest lists, before it reads any rows. It validates every emitted record against the pinned enrichment schema and a related-identifier subset schema. It also checks its source totals against the counts in the pipeline manifest. `validate.py` reads all output shards and checks their SHA-256 checksums, both schemas, and both DOIs. It independently recomputes content keys and checks global key uniqueness and per-partition totals. `verify_source.py` compares every output tuple of cited DOI, citing DOI, and partition with a separate SQL projection of the source. That projection derives the partition from the per-match provenances, not from the per-work `provenance` field that `convert.py` reads. Results are in `validation_report.json`. Two conversions of the pinned source produced byte-identical data files.
138
 
139
- The source revision is `65642a869543640f2965bcf9a7652f49fe88ef93`, built by extractor version `2.2.0` from the Crossref snapshot and DataCite release `2026-07`. The COMET schema revision is `abd6a9acd3fc70d25f703ea5be3c0fc62e0b6a61`. `provenance/` holds the schema snapshot, the related-identifier subset schema, the source pipeline manifest, the independent SQL projection, and four example records from each partition.
140
 
141
  ## Limitations
142
 
143
- Citations reflect one Crossref snapshot and one DataCite release and keep the source's matching errors. The source notes that `mined` matches come from noisy reference text and may be lower quality. In 5,999,691 records (81.75%), the cited DOI is an arXiv DOI with the prefix `10.48550/`. This conversion does not check the relatedIdentifiers already deposited in DataCite, and it does not record the citing work's resource type. The source is released under CC0 1.0, and so is this conversion.
 
5
  - config_name: default
6
  data_files:
7
  - split: train
8
+ path: data/*.jsonl.gz
 
 
 
 
 
 
 
 
9
  tags:
10
  - datacite
11
  - crossref
 
29
 
30
  ## Contents
31
 
32
+ The dataset contains **7,339,071 citations of 1,705,826 DataCite DOIs**, stored in 30 gzip-compressed JSONL shards.
33
 
34
  | Measure | Count |
35
  | --- | ---: |
 
38
  | Source citing-work entries | 7,339,071 |
39
  | Source reference matches | 7,385,186 |
40
  | Output records | 7,339,071 |
41
+ | Records whose citing work's strongest provenance is `publisher` | 1,192,204 |
42
+ | Records whose citing work's strongest provenance is `crossref` | 77,601 |
43
+ | Records whose citing work's strongest provenance is `mined` | 6,069,266 |
 
44
  | Records whose cited DOI is an arXiv DOI | 5,999,691 |
45
 
46
  Each source row lists every citing work once, so each pair of cited DOI and citing DOI yields one record. A citing work can match the cited DOI in more than one of its references. That is why source reference matches exceed records.
47
 
48
+ The source gives each citing-work entry the strongest provenance among its matches, ranked `publisher`, then `crossref`, then `mined`. The provenance rows above count that value for information. The records do not carry it.
 
 
 
 
 
 
 
 
49
 
50
  ## Mapping
51
 
 
54
  - Each `cited_by[].doi` maps to `enrichedValue.relatedIdentifier`. The value is a bare DOI name, as in the DataCite 4.7 relatedIdentifier example, not a `https://doi.org/` URL.
55
  - `relatedIdentifierType` is always `DOI`. `relationType` is always `IsCitedBy`.
56
  - `resourceTypeGeneral` is omitted because the source does not record the citing work's type.
57
+ - The records do not carry the source match details (`match_type`, `raw_match`, and `reference`) or the citing work's `provenance`.
58
  - Both DOIs must pass the comet-enrich `is_valid_doi_name` check and be lowercase. A violation stops the conversion instead of dropping the record. The pinned source has none.
59
  - A repeated pair of cited DOI and citing DOI stops the conversion. The pinned source has none.
60
 
 
68
  "action": "insert",
69
  "field": "relatedIdentifiers",
70
  "enrichedValue": {
71
+ "relatedIdentifier": "10.1001/jamadermatol.2022.5415",
72
  "relatedIdentifierType": "DOI",
73
  "relationType": "IsCitedBy"
74
  },
75
  "sourceId": "",
76
+ "contentKey": "63f52c05c46e67981b4f1f5157606c91"
77
  }
78
  ```
79
 
 
90
 
91
  ## Use
92
 
93
+ Download the files under `data/` for direct enrichment ingestion. Each decompressed line is one schema-valid insertion record. The records do not carry provenance. Readers who want only citations whose DOI the publisher or Crossref asserted can use the `asserted` configuration of the source dataset.
94
 
95
  These are proposed insertions. This dataset does not apply them to DataCite records. It does not compare them with the relatedIdentifiers already deposited in DataCite, so some records may duplicate an existing relation.
96
 
97
+ The `default` configuration has one `train` split. Every record has all three `enrichedValue` properties, so loading through Arrow adds no null properties.
98
 
99
  ## Reproduce and validate
100
 
 
117
 
118
  To fill `sourceId` once the project has a DOI, add `--source-id <doi>` to the `convert.py` command. The data files change, but every `contentKey` stays the same.
119
 
120
+ `convert.py` checks the SHA-256 of the pinned pipeline manifest, then the size and SHA-256 of each `all` parquet file that the manifest lists, before it reads any rows. It validates every emitted record against the pinned enrichment schema and a related-identifier subset schema. It also checks its source totals against the counts in the pipeline manifest. `validate.py` reads all output shards and checks their SHA-256 checksums, both schemas, and both DOIs. It independently recomputes content keys and checks global key uniqueness and the manifest totals. `verify_source.py` compares every output pair of cited DOI and citing DOI with a separate SQL projection of the source, in both directions, and checks that the counts match. Results are in `validation_report.json`. Two conversions of the pinned source produced byte-identical data files.
121
 
122
+ The source revision is `65642a869543640f2965bcf9a7652f49fe88ef93`, built by extractor version `2.2.0` from the Crossref snapshot and DataCite release `2026-07`. The COMET schema revision is `abd6a9acd3fc70d25f703ea5be3c0fc62e0b6a61`. `provenance/` holds the schema snapshot, the related-identifier subset schema, the source pipeline manifest, the independent SQL projection, and the first four records.
123
 
124
  ## Limitations
125
 
126
+ Citations reflect one Crossref snapshot and one DataCite release and keep the source's matching errors. The source notes that `mined` matches come from noisy reference text and may be lower quality. In 6,069,266 records, the citing work's strongest provenance is `mined`. In 5,999,691 records (81.75%), the cited DOI is an arXiv DOI with the prefix `10.48550/`. This conversion does not check the relatedIdentifiers already deposited in DataCite, and it does not record the citing work's resource type. The source is released under CC0 1.0, and so is this conversion.
convert.py CHANGED
@@ -27,9 +27,6 @@ SCHEMA_REVISION = "abd6a9acd3fc70d25f703ea5be3c0fc62e0b6a61"
27
  SCHEMA_SHA256 = "8a46a45770572b68261aa4045641006e22d56cc652ae3ec9242718a091ff7c28"
28
  METHOD = "crossref-datacite-citations"
29
  SCHEMA_PATH = Path(__file__).parent / "provenance/enrichment_input_schema.json"
30
- # The enrichment schema cannot carry provenance, so the file layout does.
31
- # Keys are the source's per-citing-work strongest provenance.
32
- PARTITIONS = {"publisher": "asserted", "crossref": "asserted", "mined": "mined"}
33
  DOI_NAME = re.compile(r"\A10\.[0-9]+(?:\.[0-9]+)*/.+\Z")
34
  # Rust's char::is_control is general category Cc, which is exactly these code points.
35
  CONTROL = re.compile(r"[\x00-\x1f\x7f-\x9f]")
@@ -79,11 +76,10 @@ def gzip_text(path: Path):
79
 
80
 
81
  class ShardWriter:
82
- """Numbered gzip JSONL shards for one partition."""
83
 
84
- def __init__(self, output: Path, partition: str, rows_per_shard: int):
85
  self.output = output
86
- self.directory = output / "data" / partition
87
  self.rows_per_shard = rows_per_shard
88
  self.files = []
89
  self.stream = None
@@ -93,8 +89,7 @@ class ShardWriter:
93
  def write(self, line: str):
94
  if self.stream is None or self.rows == self.rows_per_shard:
95
  self.close()
96
- self.directory.mkdir(parents=True, exist_ok=True)
97
- self.path = self.directory / f"part_{len(self.files):04d}.jsonl.gz"
98
  self.stream = gzip_text(self.path)
99
  self.rows = 0
100
  self.stream.write(line)
@@ -145,9 +140,10 @@ def main():
145
  pipeline, inputs = pinned_source(args.source_dir)
146
  output = args.output_dir
147
  data = output / "data"
148
- if data.exists() and any(data.iterdir()):
 
149
  raise ValueError("Output data directory is not empty")
150
- (output / "provenance").mkdir(parents=True, exist_ok=True)
151
  validate_enrichment = fastjsonschema.compile(json.loads(SCHEMA_PATH.read_text()))
152
  validate_value = fastjsonschema.compile(VALUE_SCHEMA)
153
  (output / "provenance/related_identifier_subset_schema.json").write_text(
@@ -155,14 +151,12 @@ def main():
155
  shutil.copyfile(args.source_dir / PIPELINE_MANIFEST,
156
  output / "provenance/source_pipeline_manifest.json")
157
  counts = Counter()
158
- by_partition = Counter()
159
  by_provenance = Counter()
160
  seen_keys = set()
161
  cited_dois = set()
162
  enriched_dois = set()
163
- writers = {partition: ShardWriter(output, partition, args.rows_per_shard)
164
- for partition in sorted(set(PARTITIONS.values()))}
165
- examples = {partition: [] for partition in writers}
166
 
167
  for item in inputs:
168
  parquet = pq.ParquetFile(args.source_dir / item["path"])
@@ -181,10 +175,6 @@ def main():
181
  counts["source_citing_entries"] += len(row["cited_by"])
182
  counts["source_reference_matches"] += row["reference_count"]
183
  for citing in row["cited_by"]:
184
- provenance = citing["provenance"]
185
- if provenance not in PARTITIONS:
186
- raise ValueError(f"{doi}: unknown citing provenance {provenance!r}")
187
- partition = PARTITIONS[provenance]
188
  value = {"relatedIdentifier": require_doi(citing["doi"], "citing"),
189
  "relatedIdentifierType": "DOI",
190
  "relationType": "IsCitedBy"}
@@ -200,20 +190,18 @@ def main():
200
  "field": "relatedIdentifiers", "enrichedValue": value,
201
  "sourceId": args.source_id, "contentKey": key}
202
  validate_enrichment(record)
203
- writers[partition].write(json.dumps(record, ensure_ascii=False,
204
- separators=(",", ":")) + "\n")
205
  counts["enrichments"] += 1
206
- by_partition[partition] += 1
207
- by_provenance[provenance] += 1
208
  counts["enrichments_to_arxiv_dois"] += doi.startswith("10.48550/")
209
  enriched_dois.add(doi)
210
- if len(examples[partition]) < 4:
211
- examples[partition].append(record)
212
  print(json.dumps({"source_file": item["path"],
213
  "source_rows": counts["source_rows"],
214
  "enrichments": counts["enrichments"]}), flush=True)
215
- for writer in writers.values():
216
- writer.close()
217
 
218
  counts["unique_cited_dois"] = len(cited_dois)
219
  counts["unique_enriched_dois"] = len(enriched_dois)
@@ -222,7 +210,6 @@ def main():
222
  assert counts["source_rows"] == published["all"]["works"]
223
  assert counts["source_citing_entries"] == published["all"]["citations"]
224
  assert counts["source_reference_matches"] == published["all"]["references"]
225
- assert by_partition["asserted"] == published["asserted"]["citations"]
226
  manifest = {
227
  "created_at": datetime.now(timezone.utc).isoformat(),
228
  "method": {"name": METHOD, "version": "1.0.0"},
@@ -238,14 +225,12 @@ def main():
238
  "sha256": SCHEMA_SHA256},
239
  "content_key": {"algorithm": "xxh3-128", "canonicalization": "RFC 8785 JCS",
240
  "input": "[method, doi, field, action, enrichedValue]"},
241
- "partition_by_source_provenance": PARTITIONS,
242
  "counts": dict(sorted(counts.items())) | {
243
- "enrichments_by_partition": dict(sorted(by_partition.items())),
244
  "enrichments_by_source_provenance": dict(sorted(by_provenance.items())),
245
  },
246
  "validation": {"enrichment_schema_failures": 0, "related_identifier_schema_failures": 0},
247
  "input_files": inputs,
248
- "data_files": {partition: writer.files for partition, writer in writers.items()},
249
  }
250
  (output / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n")
251
  (output / "provenance/examples.json").write_text(
 
27
  SCHEMA_SHA256 = "8a46a45770572b68261aa4045641006e22d56cc652ae3ec9242718a091ff7c28"
28
  METHOD = "crossref-datacite-citations"
29
  SCHEMA_PATH = Path(__file__).parent / "provenance/enrichment_input_schema.json"
 
 
 
30
  DOI_NAME = re.compile(r"\A10\.[0-9]+(?:\.[0-9]+)*/.+\Z")
31
  # Rust's char::is_control is general category Cc, which is exactly these code points.
32
  CONTROL = re.compile(r"[\x00-\x1f\x7f-\x9f]")
 
76
 
77
 
78
  class ShardWriter:
79
+ """Numbered gzip JSONL shards of rows_per_shard records under data/."""
80
 
81
+ def __init__(self, output: Path, rows_per_shard: int):
82
  self.output = output
 
83
  self.rows_per_shard = rows_per_shard
84
  self.files = []
85
  self.stream = None
 
89
  def write(self, line: str):
90
  if self.stream is None or self.rows == self.rows_per_shard:
91
  self.close()
92
+ self.path = self.output / "data" / f"part_{len(self.files):04d}.jsonl.gz"
 
93
  self.stream = gzip_text(self.path)
94
  self.rows = 0
95
  self.stream.write(line)
 
140
  pipeline, inputs = pinned_source(args.source_dir)
141
  output = args.output_dir
142
  data = output / "data"
143
+ data.mkdir(parents=True, exist_ok=True)
144
+ if any(data.iterdir()):
145
  raise ValueError("Output data directory is not empty")
146
+ (output / "provenance").mkdir(exist_ok=True)
147
  validate_enrichment = fastjsonschema.compile(json.loads(SCHEMA_PATH.read_text()))
148
  validate_value = fastjsonschema.compile(VALUE_SCHEMA)
149
  (output / "provenance/related_identifier_subset_schema.json").write_text(
 
151
  shutil.copyfile(args.source_dir / PIPELINE_MANIFEST,
152
  output / "provenance/source_pipeline_manifest.json")
153
  counts = Counter()
 
154
  by_provenance = Counter()
155
  seen_keys = set()
156
  cited_dois = set()
157
  enriched_dois = set()
158
+ writer = ShardWriter(output, args.rows_per_shard)
159
+ examples = []
 
160
 
161
  for item in inputs:
162
  parquet = pq.ParquetFile(args.source_dir / item["path"])
 
175
  counts["source_citing_entries"] += len(row["cited_by"])
176
  counts["source_reference_matches"] += row["reference_count"]
177
  for citing in row["cited_by"]:
 
 
 
 
178
  value = {"relatedIdentifier": require_doi(citing["doi"], "citing"),
179
  "relatedIdentifierType": "DOI",
180
  "relationType": "IsCitedBy"}
 
190
  "field": "relatedIdentifiers", "enrichedValue": value,
191
  "sourceId": args.source_id, "contentKey": key}
192
  validate_enrichment(record)
193
+ writer.write(json.dumps(record, ensure_ascii=False,
194
+ separators=(",", ":")) + "\n")
195
  counts["enrichments"] += 1
196
+ by_provenance[citing["provenance"]] += 1
 
197
  counts["enrichments_to_arxiv_dois"] += doi.startswith("10.48550/")
198
  enriched_dois.add(doi)
199
+ if len(examples) < 4:
200
+ examples.append(record)
201
  print(json.dumps({"source_file": item["path"],
202
  "source_rows": counts["source_rows"],
203
  "enrichments": counts["enrichments"]}), flush=True)
204
+ writer.close()
 
205
 
206
  counts["unique_cited_dois"] = len(cited_dois)
207
  counts["unique_enriched_dois"] = len(enriched_dois)
 
210
  assert counts["source_rows"] == published["all"]["works"]
211
  assert counts["source_citing_entries"] == published["all"]["citations"]
212
  assert counts["source_reference_matches"] == published["all"]["references"]
 
213
  manifest = {
214
  "created_at": datetime.now(timezone.utc).isoformat(),
215
  "method": {"name": METHOD, "version": "1.0.0"},
 
225
  "sha256": SCHEMA_SHA256},
226
  "content_key": {"algorithm": "xxh3-128", "canonicalization": "RFC 8785 JCS",
227
  "input": "[method, doi, field, action, enrichedValue]"},
 
228
  "counts": dict(sorted(counts.items())) | {
 
229
  "enrichments_by_source_provenance": dict(sorted(by_provenance.items())),
230
  },
231
  "validation": {"enrichment_schema_failures": 0, "related_identifier_schema_failures": 0},
232
  "input_files": inputs,
233
+ "data_files": writer.files,
234
  }
235
  (output / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n")
236
  (output / "provenance/examples.json").write_text(
manifest.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "created_at": "2026-10-14T13:21:01.789179+00:00",
3
  "method": {
4
  "name": "crossref-datacite-citations",
5
  "version": "1.0.0"
@@ -25,11 +25,6 @@
25
  "canonicalization": "RFC 8785 JCS",
26
  "input": "[method, doi, field, action, enrichedValue]"
27
  },
28
- "partition_by_source_provenance": {
29
- "publisher": "asserted",
30
- "crossref": "asserted",
31
- "mined": "mined"
32
- },
33
  "counts": {
34
  "enrichments": 7339071,
35
  "enrichments_to_arxiv_dois": 5999691,
@@ -38,10 +33,6 @@
38
  "source_rows": 1705826,
39
  "unique_cited_dois": 1705826,
40
  "unique_enriched_dois": 1705826,
41
- "enrichments_by_partition": {
42
- "asserted": 1269805,
43
- "mined": 6069266
44
- },
45
  "enrichments_by_source_provenance": {
46
  "crossref": 77601,
47
  "mined": 6069266,
@@ -72,196 +63,186 @@
72
  "sha256": "37691d142b900a377c05c144210829c033c2dc40831cc0cc2a84402e286e273f"
73
  }
74
  ],
75
- "data_files": {
76
- "asserted": [
77
- {
78
- "path": "data/asserted/part_0000.jsonl.gz",
79
- "rows": 250000,
80
- "bytes": 7764452,
81
- "sha256": "433c1c778bcdc86c96f26492cd6a65ac7a4bdf732b9fe4f260c553986c2fa766"
82
- },
83
- {
84
- "path": "data/asserted/part_0001.jsonl.gz",
85
- "rows": 250000,
86
- "bytes": 8512251,
87
- "sha256": "26d8170b2a3c9fd6350d969493096573f7493cac922ca53e0880e40b3b552d12"
88
- },
89
- {
90
- "path": "data/asserted/part_0002.jsonl.gz",
91
- "rows": 250000,
92
- "bytes": 8981642,
93
- "sha256": "cadd4cc436bc66bc0a9fbc0604ecae2f89e5400734e476cb44bb985289f7206e"
94
- },
95
- {
96
- "path": "data/asserted/part_0003.jsonl.gz",
97
- "rows": 250000,
98
- "bytes": 9278585,
99
- "sha256": "ac85547ec0dfaa4f31ae10684d7c858f94258749c631ca61964c927aa42e35b2"
100
- },
101
- {
102
- "path": "data/asserted/part_0004.jsonl.gz",
103
- "rows": 250000,
104
- "bytes": 9174239,
105
- "sha256": "e083301f1d5d4299ed160afd6d9b81a14e6efc164ede263bc9839f091685c7e7"
106
- },
107
- {
108
- "path": "data/asserted/part_0005.jsonl.gz",
109
- "rows": 19805,
110
- "bytes": 731580,
111
- "sha256": "6b863ddd303070ae4039d0566b7e86b560c37d817e684fb9749ffb1f7d7a557b"
112
- }
113
- ],
114
- "mined": [
115
- {
116
- "path": "data/mined/part_0000.jsonl.gz",
117
- "rows": 250000,
118
- "bytes": 7138618,
119
- "sha256": "df9549fa79e49924b1bd207f30323dde7254dc487bd2dd124766bf2e6c086acf"
120
- },
121
- {
122
- "path": "data/mined/part_0001.jsonl.gz",
123
- "rows": 250000,
124
- "bytes": 7423605,
125
- "sha256": "bfa2d00298b9e94ac94c0c6ba78f4cf6d774bd48938d9400e39db7fee0bb0a48"
126
- },
127
- {
128
- "path": "data/mined/part_0002.jsonl.gz",
129
- "rows": 250000,
130
- "bytes": 7583792,
131
- "sha256": "896a2b337646287b80b599d6a912eff0f8eca2fee99ac6e629e161ddb2b126b2"
132
- },
133
- {
134
- "path": "data/mined/part_0003.jsonl.gz",
135
- "rows": 250000,
136
- "bytes": 7579789,
137
- "sha256": "7b90253c07de6cacfbfb1df56b58183af90a0b147abc53ec6a18d746505e7205"
138
- },
139
- {
140
- "path": "data/mined/part_0004.jsonl.gz",
141
- "rows": 250000,
142
- "bytes": 7646179,
143
- "sha256": "803d0f654f0dbaefcf03b3ce4fc973532f86314bf42810634a7af1723cda510c"
144
- },
145
- {
146
- "path": "data/mined/part_0005.jsonl.gz",
147
- "rows": 250000,
148
- "bytes": 7608419,
149
- "sha256": "06a5de9e7bfe5ec3715264d87b0094de5ba5fc137cfb3a0017ea9ca84695abde"
150
- },
151
- {
152
- "path": "data/mined/part_0006.jsonl.gz",
153
- "rows": 250000,
154
- "bytes": 7632894,
155
- "sha256": "a66bf3bf1caf7e1562e284da9d6ada76961999de48fbf7874af1b37d41c488e5"
156
- },
157
- {
158
- "path": "data/mined/part_0007.jsonl.gz",
159
- "rows": 250000,
160
- "bytes": 7674830,
161
- "sha256": "e1bbbdaed0bd21e67e116afabe512168f6795a689ca142fa5beef576fc9f2801"
162
- },
163
- {
164
- "path": "data/mined/part_0008.jsonl.gz",
165
- "rows": 250000,
166
- "bytes": 7706750,
167
- "sha256": "02bb274c59df4f9ef574f69bb6b5dd4c0c04bbfdffb75c4e6245fb327e969f1c"
168
- },
169
- {
170
- "path": "data/mined/part_0009.jsonl.gz",
171
- "rows": 250000,
172
- "bytes": 7764049,
173
- "sha256": "d0baad39b54517f2d74b5f9ccf713b8d3554dcfc1280881d4f04440581263f6a"
174
- },
175
- {
176
- "path": "data/mined/part_0010.jsonl.gz",
177
- "rows": 250000,
178
- "bytes": 7836755,
179
- "sha256": "7f15a475318189ad4d95159ecb6244ac146c05f44648545d1285794bdc15ef19"
180
- },
181
- {
182
- "path": "data/mined/part_0011.jsonl.gz",
183
- "rows": 250000,
184
- "bytes": 7917579,
185
- "sha256": "bf833b0aabbe21d0216231c70cc733fe2167cb785229d1d299309b7b1354c5bd"
186
- },
187
- {
188
- "path": "data/mined/part_0012.jsonl.gz",
189
- "rows": 250000,
190
- "bytes": 7999097,
191
- "sha256": "bfff38279a0deb73c53b2f2c9e4faeebf4b498f7f5eecb106dbd6f7d5e5465e9"
192
- },
193
- {
194
- "path": "data/mined/part_0013.jsonl.gz",
195
- "rows": 250000,
196
- "bytes": 8105868,
197
- "sha256": "26c83e6a3dff4a02d4497ac11067514899a970365b7abf3f07d968048c46b367"
198
- },
199
- {
200
- "path": "data/mined/part_0014.jsonl.gz",
201
- "rows": 250000,
202
- "bytes": 8196029,
203
- "sha256": "ad32b5ce9da725c9329a13e68e6b4faf7e806a1064e468f3ecd8a2221206365f"
204
- },
205
- {
206
- "path": "data/mined/part_0015.jsonl.gz",
207
- "rows": 250000,
208
- "bytes": 8326023,
209
- "sha256": "91e900f7b3854b90927bb880f87e0b87f4e3036fd605f85927879eba36f259dc"
210
- },
211
- {
212
- "path": "data/mined/part_0016.jsonl.gz",
213
- "rows": 250000,
214
- "bytes": 8438971,
215
- "sha256": "83cc2b54ab0ef2f31d2f0de69ba873ad5b029e3fd516f9957a23b7207b091066"
216
- },
217
- {
218
- "path": "data/mined/part_0017.jsonl.gz",
219
- "rows": 250000,
220
- "bytes": 8587743,
221
- "sha256": "a332e903a300cc04288aa41b849d35b87790cd25605243418d30f8ca17239031"
222
- },
223
- {
224
- "path": "data/mined/part_0018.jsonl.gz",
225
- "rows": 250000,
226
- "bytes": 8703475,
227
- "sha256": "bab54ddbb4db605201f686c2f89f6ae8481841f5064f72a789324b959fecc972"
228
- },
229
- {
230
- "path": "data/mined/part_0019.jsonl.gz",
231
- "rows": 250000,
232
- "bytes": 8743565,
233
- "sha256": "56b63ced083f309cf2f5ef74cf6dcc3f93a47080e4e2a5a9f19200164f66ab74"
234
- },
235
- {
236
- "path": "data/mined/part_0020.jsonl.gz",
237
- "rows": 250000,
238
- "bytes": 8998239,
239
- "sha256": "0945365b7117e8f72a8454b0166c2a24cd7d2cb5eee32c0dfaedb553ecd93043"
240
- },
241
- {
242
- "path": "data/mined/part_0021.jsonl.gz",
243
- "rows": 250000,
244
- "bytes": 9276102,
245
- "sha256": "f169bfb26edeed932833dbed5439fdc6bfe4c962e96e60232a298912cb9bf66d"
246
- },
247
- {
248
- "path": "data/mined/part_0022.jsonl.gz",
249
- "rows": 250000,
250
- "bytes": 9162521,
251
- "sha256": "d458c77596b2bfb4faf4a4a379c0ec54fb37a86c677b920b4391383c3cb6fa61"
252
- },
253
- {
254
- "path": "data/mined/part_0023.jsonl.gz",
255
- "rows": 250000,
256
- "bytes": 9052383,
257
- "sha256": "bb192d61a4806b5a366d8f843a2f236210d4e500f117f469862c1ae1e8531259"
258
- },
259
- {
260
- "path": "data/mined/part_0024.jsonl.gz",
261
- "rows": 69266,
262
- "bytes": 2602621,
263
- "sha256": "f70eb015fea9294da0f06d10bf8f1c5f4395e503b0f0e095f6598985464a35a7"
264
- }
265
- ]
266
- }
267
  }
 
1
  {
2
+ "created_at": "2026-10-14T14:48:51.388656+00:00",
3
  "method": {
4
  "name": "crossref-datacite-citations",
5
  "version": "1.0.0"
 
25
  "canonicalization": "RFC 8785 JCS",
26
  "input": "[method, doi, field, action, enrichedValue]"
27
  },
 
 
 
 
 
28
  "counts": {
29
  "enrichments": 7339071,
30
  "enrichments_to_arxiv_dois": 5999691,
 
33
  "source_rows": 1705826,
34
  "unique_cited_dois": 1705826,
35
  "unique_enriched_dois": 1705826,
 
 
 
 
36
  "enrichments_by_source_provenance": {
37
  "crossref": 77601,
38
  "mined": 6069266,
 
63
  "sha256": "37691d142b900a377c05c144210829c033c2dc40831cc0cc2a84402e286e273f"
64
  }
65
  ],
66
+ "data_files": [
67
+ {
68
+ "path": "data/part_0000.jsonl.gz",
69
+ "rows": 250000,
70
+ "bytes": 7053965,
71
+ "sha256": "cfba612307af500d2fb9ff6770cc2322bdc2de446cde21db760db774a87c7c37"
72
+ },
73
+ {
74
+ "path": "data/part_0001.jsonl.gz",
75
+ "rows": 250000,
76
+ "bytes": 7352024,
77
+ "sha256": "f6c7d160186f49930a7a3de254ed0d7ab2bfc9b2f06463b804045195d8117542"
78
+ },
79
+ {
80
+ "path": "data/part_0002.jsonl.gz",
81
+ "rows": 250000,
82
+ "bytes": 7529839,
83
+ "sha256": "f3b018faad9d4cf8f881c280d859c9c8228e3893cf6b9e086a74ca24a55bba9f"
84
+ },
85
+ {
86
+ "path": "data/part_0003.jsonl.gz",
87
+ "rows": 250000,
88
+ "bytes": 7614354,
89
+ "sha256": "44131976d8d69d7dedc498f13c8527f44b16514ad210d404ed43a21b8bfcc801"
90
+ },
91
+ {
92
+ "path": "data/part_0004.jsonl.gz",
93
+ "rows": 250000,
94
+ "bytes": 7631869,
95
+ "sha256": "4d72e4928bc9eef316dc631ce88ba253d24b7c7c44a31f64dc46ffc65d69d609"
96
+ },
97
+ {
98
+ "path": "data/part_0005.jsonl.gz",
99
+ "rows": 250000,
100
+ "bytes": 7680352,
101
+ "sha256": "78dd7a8c01e4d0e983c862c1d8fcf92e110db3b19aca4bd5678730b50e10f0db"
102
+ },
103
+ {
104
+ "path": "data/part_0006.jsonl.gz",
105
+ "rows": 250000,
106
+ "bytes": 7655637,
107
+ "sha256": "6546227319ea88df8fa10553450bed1e0e9eb9aa2e739d309dae4ccfc2157c84"
108
+ },
109
+ {
110
+ "path": "data/part_0007.jsonl.gz",
111
+ "rows": 250000,
112
+ "bytes": 7672781,
113
+ "sha256": "d232532165a6aa842306245f0683b0f015a5ec60d435797e4c4375042cddb02e"
114
+ },
115
+ {
116
+ "path": "data/part_0008.jsonl.gz",
117
+ "rows": 250000,
118
+ "bytes": 7727281,
119
+ "sha256": "2e72f2271f46168da1079a4e3eae2b69387a1fbf17285a49788017f477b544dc"
120
+ },
121
+ {
122
+ "path": "data/part_0009.jsonl.gz",
123
+ "rows": 250000,
124
+ "bytes": 7743195,
125
+ "sha256": "8042b37c82569325dedea7555069f8426725b84cec6309d2256daa4265a36bea"
126
+ },
127
+ {
128
+ "path": "data/part_0010.jsonl.gz",
129
+ "rows": 250000,
130
+ "bytes": 7781733,
131
+ "sha256": "f006f9b4e89c7468c84b2bd558cb34561efcedc305a37dab6170a137cce7c518"
132
+ },
133
+ {
134
+ "path": "data/part_0011.jsonl.gz",
135
+ "rows": 250000,
136
+ "bytes": 7859045,
137
+ "sha256": "58492349436e9e8521655422b61922299a537265acff3dd6827442148ac68334"
138
+ },
139
+ {
140
+ "path": "data/part_0012.jsonl.gz",
141
+ "rows": 250000,
142
+ "bytes": 7918318,
143
+ "sha256": "7d7ef0b9b2ca436be60ac83d03a432a3c73f0f5bf03f171c8ea933b8cff51eb8"
144
+ },
145
+ {
146
+ "path": "data/part_0013.jsonl.gz",
147
+ "rows": 250000,
148
+ "bytes": 8002799,
149
+ "sha256": "675788210e89fd7aa1c607ccdddfd8ffbc32e32dd56db5ca17cdc9359464b12d"
150
+ },
151
+ {
152
+ "path": "data/part_0014.jsonl.gz",
153
+ "rows": 250000,
154
+ "bytes": 8063594,
155
+ "sha256": "fe571c107e17f5711dabea6dee99fd531cdb0da320dafbf0e88b8efb43494cd0"
156
+ },
157
+ {
158
+ "path": "data/part_0015.jsonl.gz",
159
+ "rows": 250000,
160
+ "bytes": 8171822,
161
+ "sha256": "195d3599253d715b21b2997d9e5c60f04ab640e70199d474503d64f79db84da1"
162
+ },
163
+ {
164
+ "path": "data/part_0016.jsonl.gz",
165
+ "rows": 250000,
166
+ "bytes": 8282712,
167
+ "sha256": "4a3d33118cbdd93920e338eb610ee41f6e7589ea93c3799d3b6e756db8e93c4a"
168
+ },
169
+ {
170
+ "path": "data/part_0017.jsonl.gz",
171
+ "rows": 250000,
172
+ "bytes": 8330250,
173
+ "sha256": "4e61bf2478bb37178fa5750bfc83bdb5449f13d691727ed8b3117c2029c7971e"
174
+ },
175
+ {
176
+ "path": "data/part_0018.jsonl.gz",
177
+ "rows": 250000,
178
+ "bytes": 8459090,
179
+ "sha256": "88b1e6072766b8a0772adf951fe121d980a2cc069fe2d04cfff861802e15445f"
180
+ },
181
+ {
182
+ "path": "data/part_0019.jsonl.gz",
183
+ "rows": 250000,
184
+ "bytes": 8543045,
185
+ "sha256": "ad3a7d8cbefa1dd472199773691c9139eb97a57ebfd792fcbedfc8bf79d5843b"
186
+ },
187
+ {
188
+ "path": "data/part_0020.jsonl.gz",
189
+ "rows": 250000,
190
+ "bytes": 8650606,
191
+ "sha256": "89d14ad3cd0d8c70aee0eb6e30d8b84d01500e45f5c70c49129b3d2a2b7b077a"
192
+ },
193
+ {
194
+ "path": "data/part_0021.jsonl.gz",
195
+ "rows": 250000,
196
+ "bytes": 8799712,
197
+ "sha256": "c1cf9d163ffed7efcad38211507ebd4c01e51243b0cba370718cac72b3c4b0e7"
198
+ },
199
+ {
200
+ "path": "data/part_0022.jsonl.gz",
201
+ "rows": 250000,
202
+ "bytes": 8746213,
203
+ "sha256": "45182b3fce835539a3efc59677a8d500c392fbe31e39b0db0a2d27c0a5bf4c9e"
204
+ },
205
+ {
206
+ "path": "data/part_0023.jsonl.gz",
207
+ "rows": 250000,
208
+ "bytes": 9013941,
209
+ "sha256": "2e43db94e60f5537d83cf6a4815ded2254d3847fdd7df1aef5f0d9420bcea1a8"
210
+ },
211
+ {
212
+ "path": "data/part_0024.jsonl.gz",
213
+ "rows": 250000,
214
+ "bytes": 8928359,
215
+ "sha256": "d94de5a2d08f23cb5ad7e708745bc69113bd305e53ec9e9a5e4e02cdc64f5fed"
216
+ },
217
+ {
218
+ "path": "data/part_0025.jsonl.gz",
219
+ "rows": 250000,
220
+ "bytes": 9383984,
221
+ "sha256": "007f363d7e0d224c6b2248cfc41e410db91c365c0e1e5fd2b8acb4aac92b06ad"
222
+ },
223
+ {
224
+ "path": "data/part_0026.jsonl.gz",
225
+ "rows": 250000,
226
+ "bytes": 9389960,
227
+ "sha256": "58be99910aededee2ef7c70673926f4fb45f624584796dcb36dd2c74538db83c"
228
+ },
229
+ {
230
+ "path": "data/part_0027.jsonl.gz",
231
+ "rows": 250000,
232
+ "bytes": 9187332,
233
+ "sha256": "c4cf5137c5b8c6bf9776b4273dba4434935b29aede40735633ef15b422af55fc"
234
+ },
235
+ {
236
+ "path": "data/part_0028.jsonl.gz",
237
+ "rows": 250000,
238
+ "bytes": 9079174,
239
+ "sha256": "0f87a91a2db24b7a107806b2dc3c85b5d4c2b9a9a9cc3f24874e17e199ddec84"
240
+ },
241
+ {
242
+ "path": "data/part_0029.jsonl.gz",
243
+ "rows": 89071,
244
+ "bytes": 3241535,
245
+ "sha256": "74e99f3262658a1017522af5f6a45af5d95bfe822ba364ee48f2680fcc9c0d48"
246
+ }
247
+ ]
 
 
 
 
 
 
 
 
 
 
248
  }
provenance/examples.json CHANGED
@@ -1,102 +1,50 @@
1
- {
2
- "asserted": [
3
- {
4
- "doi": "10.48550/arxiv.1412.6980",
5
- "action": "insert",
6
- "field": "relatedIdentifiers",
7
- "enrichedValue": {
8
- "relatedIdentifier": "10.1002/9781394372539.ch6",
9
- "relatedIdentifierType": "DOI",
10
- "relationType": "IsCitedBy"
11
- },
12
- "sourceId": "",
13
- "contentKey": "8f221c7f80f2b7bad183b55359e24bb7"
14
  },
15
- {
16
- "doi": "10.48550/arxiv.1412.6980",
17
- "action": "insert",
18
- "field": "relatedIdentifiers",
19
- "enrichedValue": {
20
- "relatedIdentifier": "10.1002/acm2.13951",
21
- "relatedIdentifierType": "DOI",
22
- "relationType": "IsCitedBy"
23
- },
24
- "sourceId": "",
25
- "contentKey": "c2d39280df91ed94f73519156a2aa1da"
26
  },
27
- {
28
- "doi": "10.48550/arxiv.1412.6980",
29
- "action": "insert",
30
- "field": "relatedIdentifiers",
31
- "enrichedValue": {
32
- "relatedIdentifier": "10.1002/acm2.13978",
33
- "relatedIdentifierType": "DOI",
34
- "relationType": "IsCitedBy"
35
- },
36
- "sourceId": "",
37
- "contentKey": "9768047ede9f90352cc1c155afbacb60"
38
  },
39
- {
40
- "doi": "10.48550/arxiv.1412.6980",
41
- "action": "insert",
42
- "field": "relatedIdentifiers",
43
- "enrichedValue": {
44
- "relatedIdentifier": "10.1002/adma.202514150",
45
- "relatedIdentifierType": "DOI",
46
- "relationType": "IsCitedBy"
47
- },
48
- "sourceId": "",
49
- "contentKey": "77f475a12788ec5116f98a71c5790eca"
50
- }
51
- ],
52
- "mined": [
53
- {
54
- "doi": "10.48550/arxiv.1412.6980",
55
- "action": "insert",
56
- "field": "relatedIdentifiers",
57
- "enrichedValue": {
58
- "relatedIdentifier": "10.1001/jamadermatol.2022.5415",
59
- "relatedIdentifierType": "DOI",
60
- "relationType": "IsCitedBy"
61
- },
62
- "sourceId": "",
63
- "contentKey": "63f52c05c46e67981b4f1f5157606c91"
64
  },
65
- {
66
- "doi": "10.48550/arxiv.1412.6980",
67
- "action": "insert",
68
- "field": "relatedIdentifiers",
69
- "enrichedValue": {
70
- "relatedIdentifier": "10.1001/jamanetworkopen.2018.6937",
71
- "relatedIdentifierType": "DOI",
72
- "relationType": "IsCitedBy"
73
- },
74
- "sourceId": "",
75
- "contentKey": "67789564734ccd529749cf9b05ccefd7"
76
- },
77
- {
78
- "doi": "10.48550/arxiv.1412.6980",
79
- "action": "insert",
80
- "field": "relatedIdentifiers",
81
- "enrichedValue": {
82
- "relatedIdentifier": "10.1001/jamanetworkopen.2019.3963",
83
- "relatedIdentifierType": "DOI",
84
- "relationType": "IsCitedBy"
85
- },
86
- "sourceId": "",
87
- "contentKey": "697ad2aed03f2716ae894f669151b26e"
88
- },
89
- {
90
- "doi": "10.48550/arxiv.1412.6980",
91
- "action": "insert",
92
- "field": "relatedIdentifiers",
93
- "enrichedValue": {
94
- "relatedIdentifier": "10.1001/jamanetworkopen.2020.15626",
95
- "relatedIdentifierType": "DOI",
96
- "relationType": "IsCitedBy"
97
- },
98
- "sourceId": "",
99
- "contentKey": "c92e667f712992469f9138feed793841"
100
- }
101
- ]
102
- }
 
1
+ [
2
+ {
3
+ "doi": "10.48550/arxiv.1412.6980",
4
+ "action": "insert",
5
+ "field": "relatedIdentifiers",
6
+ "enrichedValue": {
7
+ "relatedIdentifier": "10.1001/jamadermatol.2022.5415",
8
+ "relatedIdentifierType": "DOI",
9
+ "relationType": "IsCitedBy"
 
 
 
 
10
  },
11
+ "sourceId": "",
12
+ "contentKey": "63f52c05c46e67981b4f1f5157606c91"
13
+ },
14
+ {
15
+ "doi": "10.48550/arxiv.1412.6980",
16
+ "action": "insert",
17
+ "field": "relatedIdentifiers",
18
+ "enrichedValue": {
19
+ "relatedIdentifier": "10.1001/jamanetworkopen.2018.6937",
20
+ "relatedIdentifierType": "DOI",
21
+ "relationType": "IsCitedBy"
22
  },
23
+ "sourceId": "",
24
+ "contentKey": "67789564734ccd529749cf9b05ccefd7"
25
+ },
26
+ {
27
+ "doi": "10.48550/arxiv.1412.6980",
28
+ "action": "insert",
29
+ "field": "relatedIdentifiers",
30
+ "enrichedValue": {
31
+ "relatedIdentifier": "10.1001/jamanetworkopen.2019.3963",
32
+ "relatedIdentifierType": "DOI",
33
+ "relationType": "IsCitedBy"
34
  },
35
+ "sourceId": "",
36
+ "contentKey": "697ad2aed03f2716ae894f669151b26e"
37
+ },
38
+ {
39
+ "doi": "10.48550/arxiv.1412.6980",
40
+ "action": "insert",
41
+ "field": "relatedIdentifiers",
42
+ "enrichedValue": {
43
+ "relatedIdentifier": "10.1001/jamanetworkopen.2020.15626",
44
+ "relatedIdentifierType": "DOI",
45
+ "relationType": "IsCitedBy"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  },
47
+ "sourceId": "",
48
+ "contentKey": "c92e667f712992469f9138feed793841"
49
+ }
50
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/independent_projection.sql CHANGED
@@ -1,13 +1,2 @@
1
- WITH pairs AS (
2
- SELECT s.doi, cb.doi related_identifier,
3
- list_transform(cb.matches, m -> m.provenance) match_provenances
4
- FROM source s, unnest(s.cited_by) AS t(cb)
5
- )
6
- SELECT
7
- doi,
8
- related_identifier,
9
- CASE
10
- WHEN list_has_any(match_provenances, ['publisher', 'crossref']) THEN 'asserted'
11
- WHEN list_contains(match_provenances, 'mined') THEN 'mined'
12
- END AS partition
13
- FROM pairs
 
1
+ SELECT s.doi, cb.doi AS related_identifier
2
+ FROM source s, unnest(s.cited_by) AS t(cb)
 
 
 
 
 
 
 
 
 
 
 
validate.py CHANGED
@@ -32,16 +32,15 @@ def main():
32
  (root / "provenance/related_identifier_subset_schema.json").read_text()))
33
  expected = manifest["counts"]
34
  counts = Counter()
35
- by_partition = Counter()
36
  keys = set()
37
  dois = set()
38
- files = [(partition, item) for partition, items in manifest["data_files"].items()
39
- for item in items]
 
40
  on_disk = {str(p.relative_to(root)) for p in (root / "data").rglob("*") if p.is_file()}
41
- listed = {item["path"] for _, item in files}
42
  assert on_disk == listed, f"unlisted {sorted(on_disk - listed)}, missing {sorted(listed - on_disk)}"
43
- for partition, item in files:
44
- assert Path(item["path"]).parent == Path("data", partition), f"{item['path']} listed as {partition}"
45
  path = root / item["path"]
46
  with path.open("rb") as stream:
47
  digest = hashlib.file_digest(stream, "sha256").hexdigest()
@@ -74,17 +73,14 @@ def main():
74
  dois.add(row["doi"])
75
  counts["enrichments"] += 1
76
  counts["to_arxiv_dois"] += row["doi"].startswith("10.48550/")
77
- by_partition[partition] += 1
78
  n += 1
79
  assert n == item["rows"], f"{item['path']}: {n} records != manifest {item['rows']}"
80
  print(f"Validated {item['path']}: {n:,} records", flush=True)
81
  assert counts["enrichments"] == expected["enrichments"]
82
  assert len(dois) == expected["unique_enriched_dois"]
83
  assert counts["to_arxiv_dois"] == expected["enrichments_to_arxiv_dois"]
84
- assert dict(by_partition) == expected["enrichments_by_partition"]
85
  report = {"status": "passed", "records_read_and_validated": counts["enrichments"],
86
  "unique_target_dois": len(dois), "data_shards": len(files),
87
- "enrichments_by_partition": dict(sorted(by_partition.items())),
88
  "enrichments_to_arxiv_dois": counts["to_arxiv_dois"],
89
  "schema_errors": 0, "content_key_mismatches": 0, "duplicate_content_keys": 0,
90
  "file_checksum_mismatches": 0}
 
32
  (root / "provenance/related_identifier_subset_schema.json").read_text()))
33
  expected = manifest["counts"]
34
  counts = Counter()
 
35
  keys = set()
36
  dois = set()
37
+ files = manifest["data_files"]
38
+ # Every file under data/, not only data/*.jsonl.gz, so a leftover
39
+ # subdirectory that the default config would not load also fails.
40
  on_disk = {str(p.relative_to(root)) for p in (root / "data").rglob("*") if p.is_file()}
41
+ listed = {item["path"] for item in files}
42
  assert on_disk == listed, f"unlisted {sorted(on_disk - listed)}, missing {sorted(listed - on_disk)}"
43
+ for item in files:
 
44
  path = root / item["path"]
45
  with path.open("rb") as stream:
46
  digest = hashlib.file_digest(stream, "sha256").hexdigest()
 
73
  dois.add(row["doi"])
74
  counts["enrichments"] += 1
75
  counts["to_arxiv_dois"] += row["doi"].startswith("10.48550/")
 
76
  n += 1
77
  assert n == item["rows"], f"{item['path']}: {n} records != manifest {item['rows']}"
78
  print(f"Validated {item['path']}: {n:,} records", flush=True)
79
  assert counts["enrichments"] == expected["enrichments"]
80
  assert len(dois) == expected["unique_enriched_dois"]
81
  assert counts["to_arxiv_dois"] == expected["enrichments_to_arxiv_dois"]
 
82
  report = {"status": "passed", "records_read_and_validated": counts["enrichments"],
83
  "unique_target_dois": len(dois), "data_shards": len(files),
 
84
  "enrichments_to_arxiv_dois": counts["to_arxiv_dois"],
85
  "schema_errors": 0, "content_key_mismatches": 0, "duplicate_content_keys": 0,
86
  "file_checksum_mismatches": 0}
validation_report.json CHANGED
@@ -2,11 +2,7 @@
2
  "status": "passed",
3
  "records_read_and_validated": 7339071,
4
  "unique_target_dois": 1705826,
5
- "data_shards": 31,
6
- "enrichments_by_partition": {
7
- "asserted": 1269805,
8
- "mined": 6069266
9
- },
10
  "enrichments_to_arxiv_dois": 5999691,
11
  "schema_errors": 0,
12
  "content_key_mismatches": 0,
@@ -18,10 +14,6 @@
18
  "actual_citations": 7339071,
19
  "missing_citations": 0,
20
  "extra_citations": 0,
21
- "actual_citations_by_partition": {
22
- "asserted": 1269805,
23
- "mined": 6069266
24
- },
25
  "records_with_unexpected_constants": 0
26
  }
27
  }
 
2
  "status": "passed",
3
  "records_read_and_validated": 7339071,
4
  "unique_target_dois": 1705826,
5
+ "data_shards": 30,
 
 
 
 
6
  "enrichments_to_arxiv_dois": 5999691,
7
  "schema_errors": 0,
8
  "content_key_mismatches": 0,
 
14
  "actual_citations": 7339071,
15
  "missing_citations": 0,
16
  "extra_citations": 0,
 
 
 
 
17
  "records_with_unexpected_constants": 0
18
  }
19
  }
verify_source.py CHANGED
@@ -1,5 +1,5 @@
1
  #!/usr/bin/env python3
2
- """Compare every emitted citation tuple with an independent SQL source projection."""
3
  import argparse
4
  import json
5
  from pathlib import Path
@@ -22,26 +22,22 @@ def main():
22
  c.read_parquet(str(args.source_dir / "*.parquet")).create_view("source")
23
  sql = (args.dataset_dir / "provenance/independent_projection.sql").read_text()
24
  c.execute("CREATE TEMP TABLE expected AS " + sql)
25
- c.read_json(str(args.dataset_dir / "data/*/*.jsonl.gz"), format="newline_delimited",
26
- filename=True).create_view("records")
27
  unexpected_constants = c.execute("""SELECT count(*) FROM records
28
  WHERE enrichedValue.relatedIdentifierType IS DISTINCT FROM 'DOI'
29
  OR enrichedValue.relationType IS DISTINCT FROM 'IsCitedBy'""").fetchone()[0]
30
  c.execute("""CREATE TEMP TABLE actual AS
31
- SELECT doi, enrichedValue.relatedIdentifier AS related_identifier,
32
- string_split(filename, '/')[-2] AS partition
33
- FROM records""")
34
  missing = c.execute("SELECT count(*) FROM (SELECT * FROM expected EXCEPT SELECT * FROM actual)").fetchone()[0]
35
  extra = c.execute("SELECT count(*) FROM (SELECT * FROM actual EXCEPT SELECT * FROM expected)").fetchone()[0]
36
  expected_count = c.execute("SELECT count(*) FROM expected").fetchone()[0]
37
  actual_count = c.execute("SELECT count(*) FROM actual").fetchone()[0]
38
- by_partition = dict(c.execute(
39
- "SELECT partition, count(*) FROM actual GROUP BY ALL ORDER BY ALL").fetchall())
40
  passed = missing == extra == unexpected_constants == 0 and expected_count == actual_count
41
  result = {"status": "passed" if passed else "failed",
42
  "independent_expected_citations": expected_count,
43
  "actual_citations": actual_count, "missing_citations": missing,
44
- "extra_citations": extra, "actual_citations_by_partition": by_partition,
45
  "records_with_unexpected_constants": unexpected_constants}
46
  print(json.dumps(result, indent=2))
47
  assert passed
 
1
  #!/usr/bin/env python3
2
+ """Compare every emitted citation pair with an independent SQL source projection."""
3
  import argparse
4
  import json
5
  from pathlib import Path
 
22
  c.read_parquet(str(args.source_dir / "*.parquet")).create_view("source")
23
  sql = (args.dataset_dir / "provenance/independent_projection.sql").read_text()
24
  c.execute("CREATE TEMP TABLE expected AS " + sql)
25
+ c.read_json(str(args.dataset_dir / "data/*.jsonl.gz"),
26
+ format="newline_delimited").create_view("records")
27
  unexpected_constants = c.execute("""SELECT count(*) FROM records
28
  WHERE enrichedValue.relatedIdentifierType IS DISTINCT FROM 'DOI'
29
  OR enrichedValue.relationType IS DISTINCT FROM 'IsCitedBy'""").fetchone()[0]
30
  c.execute("""CREATE TEMP TABLE actual AS
31
+ SELECT doi, enrichedValue.relatedIdentifier AS related_identifier FROM records""")
 
 
32
  missing = c.execute("SELECT count(*) FROM (SELECT * FROM expected EXCEPT SELECT * FROM actual)").fetchone()[0]
33
  extra = c.execute("SELECT count(*) FROM (SELECT * FROM actual EXCEPT SELECT * FROM expected)").fetchone()[0]
34
  expected_count = c.execute("SELECT count(*) FROM expected").fetchone()[0]
35
  actual_count = c.execute("SELECT count(*) FROM actual").fetchone()[0]
 
 
36
  passed = missing == extra == unexpected_constants == 0 and expected_count == actual_count
37
  result = {"status": "passed" if passed else "failed",
38
  "independent_expected_citations": expected_count,
39
  "actual_citations": actual_count, "missing_citations": missing,
40
+ "extra_citations": extra,
41
  "records_with_unexpected_constants": unexpected_constants}
42
  print(json.dumps(result, indent=2))
43
  assert passed