RegalFire commited on
Commit
a3a7873
·
verified ·
1 Parent(s): c7f113d

RegalFire V3: independently validated source-derived release

Browse files
COMMERCIAL_EXTENSION.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RegalFire — Commercial Extension
2
+
3
+ Ideal buyer: Scientific software and research assistant teams.
4
+
5
+ Business problem: Real scientific troubleshooting with literal code and attributed community answers.
6
+
7
+ Custom private variant: Permitted notebooks and issue reports with separately agreed executable or expert-reviewed checks.
8
+
9
+ Client inputs: permitted sources, schema, target model/agent API, failure definitions, oracle or qualified reviewers, privacy/retention requirements, deadline and measurable acceptance criteria.
10
+
11
+ Validation approach: separate generation and verification, strict schemas, source relations, grouped splits, negative cases and deterministic checks where feasible. Expert or executable labels require separate verification.
12
+
13
+ Example pilot: proposed 50–150 cases in one use case, 3–5 working days after agreed inputs. This is a scoping estimate, not a past delivery claim. PRICE = QUOTE.
14
+
15
+ Delivery: JSONL/CSV, schema, provenance, validator where applicable and QA report.
16
+
17
+ Customizable: schemas, permitted private source integration, hard-case families, private holdout, acceptance tests and update cadence.
18
+
19
+ Limits: Community answers, acceptance and scores are not scientific truth or executable success labels. Public CC BY-SA obligations remain; confidential data must come from permitted private sources.
20
+
21
+ Omar Soliman · RegalFire · ootiris@gmail.com
LICENSE ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Dataset: Creative Commons Attribution-ShareAlike 4.0 International.
2
+ https://creativecommons.org/licenses/by-sa/4.0/legalcode.en
3
+ Preserve per-record source, author and revision attribution. MIT synthetic records keep their original notices.
MANIFEST.json ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "product": "Scientific-Code-Troubleshooting",
3
+ "created_at_utc": "2026-10-01T16:21:43.412112+00:00",
4
+ "files": [
5
+ {
6
+ "path": "COMMERCIAL_EXTENSION.md",
7
+ "bytes": 1406,
8
+ "sha256": "0ce656ec4974a43f21811ef0dcaf78376379760d21a51785a48b745aac45b91e"
9
+ },
10
+ {
11
+ "path": "dataset.jsonl",
12
+ "bytes": 1691706,
13
+ "sha256": "5972bb050db4c6b99761c19131890c7e21e34695c59a9731d39dfe8c9e345cec"
14
+ },
15
+ {
16
+ "path": "holdout.jsonl",
17
+ "bytes": 141629,
18
+ "sha256": "00f75fdb7e0de6d102671b33b634053d9185ffc39758e228bc0ee23d30bee1b0"
19
+ },
20
+ {
21
+ "path": "LICENSE",
22
+ "bytes": 243,
23
+ "sha256": "88628e62f69e6a58f2e982c244cd404a84da4941614842fa15427bd8427fd18d"
24
+ },
25
+ {
26
+ "path": "native_scicomp_source.jsonl",
27
+ "bytes": 856253,
28
+ "sha256": "7c636c2b30b114a0ee990c300923d00c2137a6bb91fd12b8959dddc461d4f5d1"
29
+ },
30
+ {
31
+ "path": "QA_REPORT.md",
32
+ "bytes": 1159,
33
+ "sha256": "86b92e5558db5238b829be62e0b2774568f3c47e6ceee672ef6df6455f8f5fdd"
34
+ },
35
+ {
36
+ "path": "README.md",
37
+ "bytes": 4196,
38
+ "sha256": "d06cf209985e226622af75ac43c8a35516f34cfadbfbd3ecf2e3c07452733fcf"
39
+ },
40
+ {
41
+ "path": "rejected.jsonl",
42
+ "bytes": 220691,
43
+ "sha256": "0e9f6375d42b4c019dd7b25c936bda0651774e983f064c16863f5d249c8d0221"
44
+ },
45
+ {
46
+ "path": "robustness_report.json",
47
+ "bytes": 48148,
48
+ "sha256": "f002034b02ceb8f5e058c97350dd8ddba6bbd05a0cac099df5cebd5a7d72cd0f"
49
+ },
50
+ {
51
+ "path": "schema.json",
52
+ "bytes": 2663,
53
+ "sha256": "18c255d7bcc58ca0ee04e1900992db58e0964404d2ca94b903b97fafdde99e86"
54
+ },
55
+ {
56
+ "path": "SOURCE_LOCK.json",
57
+ "bytes": 2927,
58
+ "sha256": "6ccb752e4a74b0595fccabb6c5254135018f9e3345fbce4dfbac26bafad900e1"
59
+ },
60
+ {
61
+ "path": "stats.json",
62
+ "bytes": 368,
63
+ "sha256": "4980fcda0a585a8f21035be6764448248c4ad1129b9a6fefb766df08752ca1a7"
64
+ },
65
+ {
66
+ "path": "test.jsonl",
67
+ "bytes": 195152,
68
+ "sha256": "723c4871e35fba088172580a10b44c359f6bebb4b445a67d53f59e678e87bcb3"
69
+ },
70
+ {
71
+ "path": "THIRD_PARTY_LICENSES.md",
72
+ "bytes": 1150,
73
+ "sha256": "4501c762c326325d0eb6e0b8a2cbc235c379f34d1095f611f01def2ab9000f28"
74
+ },
75
+ {
76
+ "path": "train.jsonl",
77
+ "bytes": 1253510,
78
+ "sha256": "0abc6a2e8fe9872dfafdec31d9608dbf4604771e0543757591b1568ee61acb56"
79
+ },
80
+ {
81
+ "path": "validation.jsonl",
82
+ "bytes": 101415,
83
+ "sha256": "e5f01f6819a0ecb3f6358077f31e96164ced3eac77b5fede82fb510e34faf90e"
84
+ },
85
+ {
86
+ "path": "validation_report.json",
87
+ "bytes": 685,
88
+ "sha256": "3a1d592228ef341b528cfe4ed42aa9aa21cdbe6d4561144f1a037eba7460209d"
89
+ },
90
+ {
91
+ "path": "validator/LICENSE",
92
+ "bytes": 1087,
93
+ "sha256": "7c82eb9f40f567300f2a945943695da0f6b64eb400bb267032d1aa73ff177726"
94
+ },
95
+ {
96
+ "path": "validator/validate.py",
97
+ "bytes": 16694,
98
+ "sha256": "0a8b440ad924e065de0f438d4a473baf496c69ad681146962860249c599f136b"
99
+ }
100
+ ]
101
+ }
QA_REPORT.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RegalFire — QA Report
2
+
3
+ Validation status: PASS. 50/50 records checked independently.
4
+
5
+ Unique IDs: 50; exact semantic duplicates: 0; grouped source/template units: 50.
6
+
7
+ Controlled corruptions rejected: 9/9.
8
+
9
+ Checks: strict UTF-8/JSON (duplicate keys/nonfinite numbers rejected), schema fields/types, source hashes/relations, attribution/license, labels, independent source oracles, witness replay, split file partition, shared source/text/template/grid groups and scientific near-question leakage.
10
+
11
+ Near duplicates: scientific normalized text/code and 5-shingle near-question groups; synthetic template-held-out grouping. Exhaustive semantic detection is not claimed. Synthetic master seeds are not individual task seeds; this is not a fresh-seed independence claim.
12
+
13
+ Rejected candidates: 1017. rejected.jsonl contains identifiers and exclusion reasons, not unapproved source bodies. Many exclusions are selection failures or redundant examples rather than corrupt records.
14
+
15
+ Scientific answers remain community content and scientific code was not executed. Public holdout content is exposed. See README for all label and source limitations.
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ language:
4
+ - en
5
+ tags:
6
+ - regalfire
7
+ - evaluation
8
+ - reproducible
9
+ configs:
10
+ - config_name: default
11
+ data_files:
12
+ - split: train
13
+ path: train.jsonl
14
+ - split: validation
15
+ path: validation.jsonl
16
+ - split: test
17
+ path: test.jsonl
18
+ - split: holdout
19
+ path: holdout.jsonl
20
+ ---
21
+ # Scientific-Code-Troubleshooting
22
+
23
+ RegalFire — AI Data Foundry · Omar Soliman · ootiris@gmail.com
24
+
25
+ ## Problem
26
+
27
+ Real scientific troubleshooting with literal code and attributed community answers. **50 records** in this source-derived release. Do not sum it with its public ancestors as unique examples.
28
+
29
+ ## Sources and provenance
30
+
31
+ SOURCE_LOCK.json pins approved releases and file hashes. Per-record source IDs and hashes link to source rows. Selected normalized native scientific-computing sources accompany the affected products in native_scicomp_source.jsonl; raw API scrape files are not included. Source URLs, author attribution and revision contributors are retained. Unverified Bionic inputs are excluded.
32
+
33
+ ## Schema and extraction
34
+
35
+ See schema.json for required fields/types. Nested source content and labels are independently validated. Question troubleshooting lexeme plus literal pre block. Language/tools require explicit mentions; missing error/method fields are null. No invented root causes, fixes or error messages.
36
+
37
+ ## What labels mean
38
+
39
+ Community answers, acceptance and scores are not scientific truth or executable success labels.
40
+
41
+ ## Validation and reproduction
42
+
43
+ Install Python 3.10+ dependencies: `pip install jsonschema huggingface_hub`. Run in the repository directory: `python validator/validate.py .` Pinned public ancestors require network or a populated HF cache; credentials are unnecessary. The validator does not import the builder. Source computational checkers were implemented independently from source generators. See validation_report.json, robustness_report.json and QA_REPORT.md.
44
+
45
+ ## Splits and leakage
46
+
47
+ {"holdout": 5, "test": 6, "train": 36, "validation": 3}. Scientific threads, normalized shared text/code and near questions (5-shingle Jaccard >=0.85) are globally grouped across the two scientific-derived products. Synthetic task families are kept in one split, with repeated source grid groups united. Source master seeds identify an entire generation run, not independent per-task seeds. These are template-held-out splits, not fresh-generation-seed experiments. Uneven splits are intentional. Public holdout labels are visible and are not secret or contamination-free. Exhaustive semantic near-duplicate detection is not claimed.
48
+
49
+ ## Intended uses and limitations
50
+
51
+ Research, regression and scoped private adaptation. No measured model performance, clients, ROI or clinical claims. Scientific code is not executed; community answers are not expert labels. Clinical flags and email-like content are excluded heuristically, not certified absent. Agent errors are controlled harness operations, not real-agent logs; counterfactual recovery is prediction correction, not physical intervention. Validation checks the specified contracts, not universal scientific correctness.
52
+
53
+ ## License
54
+
55
+ cc-by-sa-4.0. Preserve attribution, revision contributors and source notices. Scientific content remains CC BY-SA 4.0; MIT synthetic rows retain MIT notices. See THIRD_PARTY_LICENSES.md. No private exclusivity is promised for public source adaptations.
56
+
57
+ ## Custom / Private Dataset Work
58
+
59
+ RegalFire builds custom AI datasets, evaluation sets and reproducible data pipelines for research and production systems.
60
+
61
+ Available:
62
+ - custom schemas
63
+ - private sources
64
+ - private holdout sets
65
+ - custom validators
66
+ - domain-specific hard cases
67
+ - continuous generation
68
+ - regression datasets
69
+
70
+ Contact: ootiris@gmail.com
71
+ Hugging Face: RegalFire
72
+
73
+ Public license obligations remain applicable. Confidential private work requires client-owned or otherwise permitted sources.
74
+
75
+ ## Volume limitation
76
+
77
+ Approved inputs yield 50 explicit troubleshooting threads, below the requested 500. This is a bounded seed release without invented or repeated filler. Expansion requires further verified licensed raw input.
SOURCE_LOCK.json ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Scientific-Biology-QA",
4
+ "repo_id": "RegalFire/Scientific-Biology-QA",
5
+ "commit": "049a9227f533c13bbc10d1a38c271e055da0ed6e",
6
+ "classification": "APPROVED",
7
+ "reason": "Public pinned release with explicit license and published validation evidence",
8
+ "data_file": "dataset.jsonl",
9
+ "files": {
10
+ "dataset.jsonl": {
11
+ "sha256": "3b123b31a9ee6a4a961ca33f597e18ec8f1151466c9f590f5ebe914bfe638212",
12
+ "bytes": 12063150,
13
+ "remote_path": "dataset.jsonl"
14
+ },
15
+ "README.md": {
16
+ "sha256": "d585268d82b8949f04971232226145f6027813d6a4de6c6ec247e66bd1ea1670",
17
+ "bytes": 9237,
18
+ "remote_path": "README.md"
19
+ },
20
+ "stats.json": {
21
+ "sha256": "e9836b9ae5bd64321aca7b5673fc6bdb13969af7d885515bf8101c5442f3095b",
22
+ "bytes": 3240,
23
+ "remote_path": "stats.json"
24
+ },
25
+ "validation_report.json": {
26
+ "sha256": "415be136730b3eabe200ce3fce2c67742c66cbbde6c979e161a7d206a620705c",
27
+ "bytes": 627,
28
+ "remote_path": "validation_report.json"
29
+ },
30
+ "LICENSE": {
31
+ "sha256": "f0e81d551452de60060f02aee3a0656788d86b56fdad46a05d00625c6b10407d",
32
+ "bytes": 506,
33
+ "remote_path": "LICENSE"
34
+ }
35
+ },
36
+ "actual_records": 882
37
+ },
38
+ {
39
+ "name": "Scientific-Native-Scicomp",
40
+ "repo_id": null,
41
+ "commit": null,
42
+ "data_file": "native_scicomp_source.jsonl",
43
+ "classification": "APPROVED",
44
+ "reason": "Native captured API corpus with source/revision/hash validation PASS",
45
+ "actual_records": 96,
46
+ "files": {}
47
+ },
48
+ {
49
+ "name": "Scientific-Statistics-QA",
50
+ "repo_id": "RegalFire/Scientific-Statistics-QA",
51
+ "commit": "3f6db230c4afe97d558b23fe2bfdb56dc0010d95",
52
+ "classification": "APPROVED",
53
+ "reason": "Public pinned release with explicit license and published validation evidence",
54
+ "data_file": "dataset.jsonl",
55
+ "files": {
56
+ "dataset.jsonl": {
57
+ "sha256": "2f892752e8214672ab3e49503d22a18caf8cb136d4f8efa40482e7cf4363ab0c",
58
+ "bytes": 3556991,
59
+ "remote_path": "dataset.jsonl"
60
+ },
61
+ "README.md": {
62
+ "sha256": "7d3e0b5f6c7c24773f999d3a061f2f3af9a815deff74902ad6b61556cf40815e",
63
+ "bytes": 7324,
64
+ "remote_path": "README.md"
65
+ },
66
+ "stats.json": {
67
+ "sha256": "bb41e422172135ea53ca9338255dd123bb7afc4f727529daa881336519072b28",
68
+ "bytes": 595,
69
+ "remote_path": "stats.json"
70
+ },
71
+ "validation_report.json": {
72
+ "sha256": "8d07b298541fcd3d5b47773465becb0064cb72055da2a3eb03cc3b7a52a46552",
73
+ "bytes": 928,
74
+ "remote_path": "validation_report.json"
75
+ },
76
+ "LICENSE": {
77
+ "sha256": "270c099253ba150b6b7b9fb6f79a54fe1aa6d9a09c7a0489fb5893c96de41e7c",
78
+ "bytes": 452,
79
+ "remote_path": "LICENSE"
80
+ }
81
+ },
82
+ "actual_records": 89
83
+ }
84
+ ]
THIRD_PARTY_LICENSES.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Third-party source notices
2
+
3
+
4
+ ## Scientific-Biology-QA
5
+
6
+ Source current posts: Creative Commons Attribution-ShareAlike 4.0 International.
7
+ https://creativecommons.org/licenses/by-sa/4.0/legalcode
8
+ Historical per-revision licenses are preserved; do not discard them.
9
+ Retain source authors, profiles, titles, post URLs and transformation notices.
10
+ RegalFire packaging and original pipeline code: CC BY-SA 4.0.
11
+ No endorsement by Stack Exchange or source contributors is claimed.
12
+ Third-party referenced assets may have separate rights; assets are not repackaged.
13
+
14
+
15
+ ## Scientific-Native-Scicomp
16
+
17
+ CC BY-SA 4.0; per-post and revision attribution retained.
18
+
19
+ ## Scientific-Statistics-QA
20
+
21
+ Source current posts and RegalFire original packaging/code: CC BY-SA 4.0 International.
22
+ https://creativecommons.org/licenses/by-sa/4.0/legalcode
23
+ Preserve per-post and per-revision licenses, contributor names/profile links, titles and source URLs.
24
+ Source contributor ownership is retained. No endorsement by Stack Exchange or source authors is implied.
25
+ External referenced assets may carry separate rights; no paper or image assets are repackaged.
26
+
dataset.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
holdout.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
native_scicomp_source.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
rejected.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
robustness_report.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "PASS",
3
+ "controlled_corruptions": 9,
4
+ "rejected_corruptions": 9,
5
+ "tests": [
6
+ {
7
+ "mutation": "missing_required_field",
8
+ "rejected": true,
9
+ "reason": "'domain' is a required property\n\nFailed validating 'required' in schema:\n {'$schema': 'https://json-schema.org/draft/2020-12/schema',\n 'type': 'object',\n 'required': ['id',\n 'domain',\n 'language',\n 'library_or_tool',\n 'question_title',\n 'problem_text',\n 'question_html',\n 'code_blocks',\n 'error_text_if_explicit',\n 'attempted_method_if_explicit',\n 'answers',\n 'accepted_answer',\n 'answer_scores',\n 'source_url',\n 'author_attribution',\n 'content_license',\n 'provenance',\n 'selection_rule',\n 'group_id',\n 'split'],\n 'additionalProperties': False,\n 'properties': {'id': {'type': ['string'], 'minLength': 10},\n 'domain': {'type': ['string']},\n 'language': {'type': ['array', 'null']},\n 'library_or_tool': {'type': ['array', 'null']},\n 'question_title': {'type': ['string']},\n 'problem_text': {'type': ['string']},\n 'question_html': {'type': ['string']},\n 'code_blocks': {'type': ['array']},\n 'error_text_if_explicit': {'type': ['array', 'null']},\n 'attempted_method_if_explicit': {'type': ['null',\n 'string']},\n 'answers': {'type': ['array']},\n 'accepted_answer': {'type': ['null', 'object']},\n 'answer_scores': {'type': ['array']},\n 'source_url': {'type': ['string']},\n 'author_attribution': {'type': ['object']},\n 'content_license': {'type': ['string']},\n 'provenance': {'type': ['object'],\n 'required': ['source_dataset',\n 'source_record_id',\n 'source_record_sha256',\n 'source_license',\n 'transformation'],\n 'properties': {'source_record_sha256': {'type': 'string',\n 'pattern': '^[a-f0-9]{64}$'}}},\n 'selection_rule': {'type': ['string']},\n 'group_id': {'type': ['string'],\n 'pattern': '^[a-f0-9]{64}$'},\n 'split': {'enum': ['train',\n 'validation',\n 'test',\n 'holdout'],\n 'type': ['string']}}}\n\nOn instance:\n {'accepted_answer': None,\n 'answer_scores': [{'answer_id': 112804, 'score': 5}],\n 'answers': [{'answer_html': '<p>I know nothing about drug databases, '\n 'but am familiar with Kegg. As far as I '\n 'can see from the paper (and I may be '\n 'wrong) The drug target database would '\n 'contain the names of enzymes, the '\n 'activity of which is affected by drugs. '\n 'So the problem would seem to be to '\n 'identify so-called Kegg \u2018pathways\u2019 in '\n 'which these target enzymes occur.</p>\\n'\n '<p>(I use the adjective \u201cso-called\u201d as '\n 'Kegg pathways are not generally what a '\n 'biochemist would regard as a pathway, '\n 'but areas of metabolism. However this '\n 'would not matter if all one is trying to '\n 'do is find a correlation.)</p>\\n'\n '<p>The poster would seem, therefore, to '\n 'need to download a list of enzymes for '\n 'each Kegg pathway. At one time all the '\n 'Kegg information was available free of '\n 'charge (I downloaded a considerable '\n 'amount \u2014 although not the enzymes \u2014 to '\n 'construct a relational database). '\n 'However now one needs to purchase a '\n 'license to do this \u2014 presumably what the '\n 'authors of the paper did \u2014 at a cost of '\n 'over $1000 pa.</p>\\n'\n '<p>Unless one has grant funding or is '\n 'independently wealthy, it would seem to '\n 'be necessary to explore alternatives, '\n 'such as MetaCyc (<a '\n 'href=\"https://metacyc.org\" rel=\"nofollow '\n 'noreferrer\">https://metacyc.org</a>).</p>\\n'\n '<p><strong>Postscript</strong>\\n'\n 'The addendum from the poster shows the '\n 'UniProt IDs for the targets of the drug. '\n 'These can be converted to Kegg IDs using '\n 'the conversion tool on the Kegg site (<a '\n 'href=\"https://www.genome.jp/kegg/tool/conv_id.html\" '\n 'rel=\"nofollow '\n 'noreferrer\">https://www.genome.jp/kegg/tool/conv_id.html</a>). '\n 'The XML tag entitled \u201cpathway\u201d is not '\n 'equivalent to a Kegg metabolic pathway '\n 'as such, although the example seems to '\n 'consist of proteins involved in blood '\n 'clotting. If my interpretation is '\n 'correct, it would be irrelevant to the '\n 'procedure I suggest. However the '\n 'original paper is sufficiently vague '\n 'that I cannot be sure.</p>\\n',\n 'answer_id': 112804,\n 'answer_text': 'I know nothing about drug databases, but '\n 'am familiar with Kegg. As far as I can '\n 'see from the paper (and I may be wrong) '\n 'The drug target database would contain '\n 'the names of enzymes, the activity of '\n 'which is affected by drugs. So the '\n 'problem would seem to be to identify '\n 'so-called Kegg \u2018pathways\u2019 in which these '\n 'target enzymes occur.\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n '(I use the adjective \u201cso-called\u201d as Kegg '\n 'pathways are not generally what a '\n 'biochemist would regard as a pathway, '\n 'but areas of metabolism. However this '\n 'would not matter if all one is trying to '\n 'do is find a correlation.)\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n 'The poster would seem, therefore, to '\n 'need to download a list of enzymes for '\n 'each Kegg pathway. At one time all the '\n 'Kegg information was available free of '\n 'charge (I downloaded a considerable '\n 'amount \u2014 although not the enzymes \u2014 to '\n 'construct a relational database). '\n 'However now one needs to purchase a '\n 'license to do this \u2014 presumably what the '\n 'authors of the paper did \u2014 at a cost of '\n 'over $1000 pa.\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n 'Unless one has grant funding or is '\n 'independently wealthy, it would seem to '\n 'be necessary to explore alternatives, '\n 'such as MetaCyc (https://metacyc.org '\n '(https://metacyc.org)).\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n 'Postscript\\n'\n 'The addendum from the poster shows the '\n 'UniProt IDs for the targets of the drug. '\n 'These can be converted to Kegg IDs using '\n 'the conversion tool on the Kegg site '\n '(https://www.genome.jp/kegg/tool/conv_id.html '\n '(https://www.genome.jp/kegg/tool/conv_id.html)). '\n 'The XML tag entitled \u201cpathway\u201d is not '\n 'equivalent to a Kegg metabolic pathway '\n 'as such, although the example seems to '\n 'consist of proteins involved in blood '\n 'clotting. If my interpretation is '\n 'correct, it would be irrelevant to the '\n 'procedure I suggest. However the '\n 'original paper is sufficiently vague '\n 'that I cannot be sure.',\n 'answer_url': 'https://biology.stackexchange.com/a/112804',\n 'author': 'David',\n 'author_url': 'https://biology.stackexchange.com/users/22057/david',\n 'content_license': 'CC BY-SA 4.0',\n 'created_at': '2023-08-13T11:37:13+00:00',\n 'is_accepted': False,\n 'provenance': {'attribution_required': True,\n 'collected_at': '2026-10-01T03:03:38.885561+00:00',\n 'license': 'CC BY-SA 4.0',\n 'license_url': 'https://creativecommons.org/licenses/by-sa/4.0/',\n 'raw_file': 'raw/codex_api_v1/a145de97eabc007745b45919875489a41261075cbdf33d916d9640ba4ad0bd35_0.json',\n 'raw_sha256': 'e7d8d4315eef8e039a452d2811869cbe305575c6ff8a6bef8f80d6dfb58c5bfd',\n 'source_api': 'Stack Exchange API 2.3',\n 'source_url': 'https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation',\n 'transformation': 'API HTML retained; '\n 'mechanical '\n 'HTML-to-text; no LLM '\n 'rewriting'},\n 'question_id': 112789,\n 'revision_attribution': [{'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'David',\n 'profile_url': 'https://biology.stackexchange.com/users/22057/david',\n 'user_type': 'registered'},\n 'created_at': '2023-08-13T11:37:13+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '2D881A87-9785-460D-8B6A-4D609910C727',\n 'revision_number': 1,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/2D881A87-9785-460D-8B6A-4D609910C727/view-source'},\n {'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'David',\n 'profile_url': 'https://biology.stackexchange.com/users/22057/david',\n 'user_type': 'registered'},\n 'created_at': '2023-08-17T22:21:55+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '7E664EA3-F130-4C17-B518-C112CBD595B8',\n 'revision_number': 2,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/7E664EA3-F130-4C17-B518-C112CBD595B8/view-source'},\n {'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'David',\n 'profile_url': 'https://biology.stackexchange.com/users/22057/david',\n 'user_type': 'registered'},\n 'created_at': '2023-08-18T07:26:03+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '2D4BC5F7-1B1B-44D3-BB31-EB109B8535CB',\n 'revision_number': 3,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/2D4BC5F7-1B1B-44D3-BB31-EB109B8535CB/view-source'}],\n 'score': 5}],\n 'attempted_method_if_explicit': None,\n 'author_attribution': {'answers': [{'author': 'David',\n 'author_url': 'https://biology.stackexchange.com/users/22057/david',\n 'content_license': 'CC BY-SA 4.0',\n 'revision_attribution': [{'content_license': 'CC '\n 'BY-SA '\n '4.0',\n 'contributor': {'display_name': 'David',\n 'profile_url': 'https://biology.stackexchange.com/users/22057/david',\n 'user_type': 'registered'},\n 'created_at': '2023-08-13T11:37:13+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '2D881A87-9785-460D-8B6A-4D609910C727',\n 'revision_number': 1,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/2D881A87-9785-460D-8B6A-4D609910C727/view-source'},\n {'content_license': 'CC '\n 'BY-SA '\n '4.0',\n 'contributor': {'display_name': 'David',\n 'profile_url': 'https://biology.stackexchange.com/users/22057/david',\n 'user_type': 'registered'},\n 'created_at': '2023-08-17T22:21:55+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '7E664EA3-F130-4C17-B518-C112CBD595B8',\n 'revision_number': 2,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/7E664EA3-F130-4C17-B518-C112CBD595B8/view-source'},\n {'content_license': 'CC '\n 'BY-SA '\n '4.0',\n 'contributor': {'display_name': 'David',\n 'profile_url': 'https://biology.stackexchange.com/users/22057/david',\n 'user_type': 'registered'},\n 'created_at': '2023-08-18T07:26:03+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '2D4BC5F7-1B1B-44D3-BB31-EB109B8535CB',\n 'revision_number': 3,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/2D4BC5F7-1B1B-44D3-BB31-EB109B8535CB/view-source'}],\n 'source_url': 'https://biology.stackexchange.com/a/112804'}],\n 'question_author': 'Orca',\n 'question_author_url': 'https://biology.stackexchange.com/users/76494/orca'},\n 'code_blocks': [{'block_index': 0,\n 'code_text': '<pathways>\\n'\n ' <pathway>\\n'\n ' <smpdb-id>SMP0000278</smpdb-id>\\n'\n ' <name>Lepirudin Action '\n 'Pathway</name>\\n'\n ' '\n '<category>drug_action</category>\\n'\n ' <drugs>\\n'\n ' <drug>\\n'\n ' '\n '<drugbank-id>DB00001</drugbank-id>\\n'\n ' <name>Lepirudin</name>\\n'\n ' </drug>\\n'\n ' <drug>\\n'\n ' '\n '<drugbank-id>DB01022</drugbank-id>\\n'\n ' <name>Phylloquinone</name>\\n'\n ' </drug>\\n'\n ' <drug>\\n'\n ' '\n '<drugbank-id>DB01373</drugbank-id>\\n'\n ' <name>Calcium</name>\\n'\n ' </drug>\\n'\n ' </drugs>\\n'\n ' <enzymes>\\n'\n ' '\n '<uniprot-id>P00734</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00748</uniprot-id>\\n'\n ' '\n '<uniprot-id>P02452</uniprot-id>\\n'\n ' '\n '<uniprot-id>P03952</uniprot-id>\\n'\n ' '\n '<uniprot-id>P03951</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00740</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00451</uniprot-id>\\n'\n ' '\n '<uniprot-id>P12259</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00742</uniprot-id>\\n'\n ' '\n '<uniprot-id>P02671</uniprot-id>\\n'\n ' '\n '<uniprot-id>P02675</uniprot-id>\\n'\n ' '\n '<uniprot-id>P02679</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00488</uniprot-id>\\n'\n ' '\n '<uniprot-id>P05160</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00747</uniprot-id>\\n'\n ' '\n '<uniprot-id>P00750</uniprot-id>\\n'\n ' '\n '<uniprot-id>P08709</uniprot-id>\\n'\n ' '\n '<uniprot-id>P13726</uniprot-id>\\n'\n ' '\n '<uniprot-id>Q9BQB6</uniprot-id>\\n'\n ' '\n '<uniprot-id>P38435</uniprot-id>\\n'\n ' </enzymes>\\n'\n ' </pathway>\\n'\n ' </pathways>\\n'\n '\\n'\n '```\\n',\n 'post_id': '112789',\n 'sha256': '4452dea3b66a2c29df5a54e5e802e54d6339b7f0a59f86f15142323a44138d31',\n 'source_url': 'https://biology.stackexchange.com/questions/112789/how-to-generate-pathway-fingerprints-of-drugs'}],\n 'content_license': 'CC BY-SA 4.0',\n 'error_text_if_explicit': None,\n 'group_id': '21341a8f8da58f78f0df843bca6c30524caaad2ffd24c0988a87895e0f6d2c2c',\n 'id': 'SCT-888cccfd7708642b5b451223',\n 'language': None,\n 'library_or_tool': None,\n 'problem_text': 'I have studied a paper that constructs the pathway '\n 'fingerprint of a drug, which has a vector of $0$ and '\n '$1$, and they compare the pathway fingerprint using '\n 'a similarity measure to assess how similar the drugs '\n 'are.\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n \"But I don't know where can I download pathways and \"\n 'how to generate their fingerprint vector to evaluate '\n 'them. I checked KEGG website '\n '(https://www.genome.jp/kegg/) but could not find '\n 'anything there to download. The paper can be '\n 'downloaded from: '\n 'https://pubmed.ncbi.nlm.nih.gov/22426982/ '\n '(https://pubmed.ncbi.nlm.nih.gov/22426982/)\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n 'I really appreciate answers that can help me to '\n 'solve the problem.\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n 'Update\\n'\n 'Since i am not familiar with DrugBank and biology '\n 'science, when I parsed the xml file of drugbank, I '\n 'find a tag with name pathway . But i am not sure '\n 'that do these elements show the pathway of drug or '\n 'not? Is it possible to use them to construct the '\n 'pathway fingerprint vector for drugs? what does '\n '<uniprot-id>P00734</uniprot-id> mean?\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n 'this is the content of pathway tag for Lepirudin:\\n'\n '\\n'\n '\\n'\n '\\n'\n '\\n'\n '<pathways>\\n'\n ' <pathway>\\n'\n ' <smpdb-id>SMP0000278</smpdb-id>\\n'\n ' <name>Lepirudin Action Pathway</name>\\n'\n ' <category>drug_action</category>\\n'\n ' <drugs>\\n'\n ' <drug>\\n'\n ' <drugbank-id>DB00001</drugbank-id>\\n'\n ' <name>Lepirudin</name>\\n'\n ' </drug>\\n'\n ' <drug>\\n'\n ' <drugbank-id>DB01022</drugbank-id>\\n'\n ' <name>Phylloquinone</name>\\n'\n ' </drug>\\n'\n ' <drug>\\n'\n ' <drugbank-id>DB01373</drugbank-id>\\n'\n ' <name>Calcium</name>\\n'\n ' </drug>\\n'\n ' </drugs>\\n'\n ' <enzymes>\\n'\n ' <uniprot-id>P00734</uniprot-id>\\n'\n ' <uniprot-id>P00748</uniprot-id>\\n'\n ' <uniprot-id>P02452</uniprot-id>\\n'\n ' <uniprot-id>P03952</uniprot-id>\\n'\n ' <uniprot-id>P03951</uniprot-id>\\n'\n ' <uniprot-id>P00740</uniprot-id>\\n'\n ' <uniprot-id>P00451</uniprot-id>\\n'\n ' <uniprot-id>P12259</uniprot-id>\\n'\n ' <uniprot-id>P00742</uniprot-id>\\n'\n ' <uniprot-id>P02671</uniprot-id>\\n'\n ' <uniprot-id>P02675</uniprot-id>\\n'\n ' <uniprot-id>P02679</uniprot-id>\\n'\n ' <uniprot-id>P00488</uniprot-id>\\n'\n ' <uniprot-id>P05160</uniprot-id>\\n'\n ' <uniprot-id>P00747</uniprot-id>\\n'\n ' <uniprot-id>P00750</uniprot-id>\\n'\n ' <uniprot-id>P08709</uniprot-id>\\n'\n ' <uniprot-id>P13726</uniprot-id>\\n'\n ' <uniprot-id>Q9BQB6</uniprot-id>\\n'\n ' <uniprot-id>P38435</uniprot-id>\\n'\n ' </enzymes>\\n'\n ' </pathway>\\n'\n ' </pathways>\\n'\n '\\n'\n '```',\n 'provenance': {'original_provenance': {'attribution_required': True,\n 'collected_at': '2026-10-01T03:03:12.794960+00:00',\n 'license': 'CC BY-SA 4.0',\n 'license_url': 'https://creativecommons.org/licenses/by-sa/4.0/',\n 'raw_file': 'raw/codex_api_v1/01e5186067e30dc1b8d7a145670ab7edd6b017797b271a481af8b7b7f55f13c2_0.json',\n 'raw_sha256': '6c3960de7e1d3d7920bb88d02e2184614c219b391f39d9bddc2a582fdc9a71e7',\n 'source_api': 'Stack Exchange '\n 'API 2.3',\n 'source_url': 'https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=10&pagesize=100&site=biology&sort=creation',\n 'transformation': 'API HTML '\n 'retained; '\n 'mechanical '\n 'HTML-to-text; '\n 'no LLM '\n 'rewriting'},\n 'revision_attribution': [{'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'Orca',\n 'profile_url': 'https://biology.stackexchange.com/users/76494/orca',\n 'user_type': 'registered'},\n 'created_at': '2023-08-11T06:06:32+00:00',\n 'raw_file': 'raw/codex_api_v1/fe6e1ab1e4f14040deb1423c04616e4dd0e7de39b583b42e88a31f79f9375e98_1790824028764975800_0.json',\n 'raw_sha256': '08e023ccc811ec000989abb19f483814e44277588eeabf130aa5dbaf177079bf',\n 'revision_guid': '98663075-01EA-4309-B06F-A662D694541F',\n 'revision_number': 1,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/98663075-01EA-4309-B06F-A662D694541F/view-source'},\n {'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'Brendan '\n 'Darrer',\n 'profile_url': 'https://biology.stackexchange.com/users/35682/brendan-darrer',\n 'user_type': 'registered'},\n 'created_at': '2023-08-12T00:08:28+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '1A1830DF-479C-4EA6-8FAB-7D151F12D14C',\n 'revision_number': 2,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/1A1830DF-479C-4EA6-8FAB-7D151F12D14C/view-source'},\n {'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'MattDMo',\n 'profile_url': 'https://biology.stackexchange.com/users/948/mattdmo',\n 'user_type': 'registered'},\n 'created_at': '2023-08-12T00:08:28+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '797A7A2D-66A0-42C2-8856-C45C3E78810C',\n 'revision_number': 3,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/797A7A2D-66A0-42C2-8856-C45C3E78810C/view-source'},\n {'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'Orca',\n 'profile_url': 'https://biology.stackexchange.com/users/76494/orca',\n 'user_type': 'registered'},\n 'created_at': '2023-08-15T09:50:04+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '7F3B7812-28EA-4085-9361-2690329DB2A0',\n 'revision_number': 4,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/7F3B7812-28EA-4085-9361-2690329DB2A0/view-source'},\n {'content_license': 'CC BY-SA '\n '4.0',\n 'contributor': {'display_name': 'Orca',\n 'profile_url': 'https://biology.stackexchange.com/users/76494/orca',\n 'user_type': 'registered'},\n 'created_at': '2023-08-15T10:09:44+00:00',\n 'raw_file': 'raw/codex_api_v1/9b8fea4e5df4051aa25c1aa90b42eca7481ee703f92ba25aeabed3d0b53e7a04_1790824026598483100_0.json',\n 'raw_sha256': 'f252fc1b154815b8794116efb3b685202eda8dddb2cd870ae32ee5e82716c300',\n 'revision_guid': '51E7AEE3-B9D6-4FE6-AA59-BD33BD98B508',\n 'revision_number': 5,\n 'revision_type': 'single_user',\n 'revision_url': 'https://biology.stackexchange.com/revisions/51E7AEE3-B9D6-4FE6-AA59-BD33BD98B508/view-source'}],\n 'source_commit': '049a9227f533c13bbc10d1a38c271e055da0ed6e',\n 'source_data_file': 'dataset.jsonl',\n 'source_dataset': 'RegalFire/Scientific-Biology-QA',\n 'source_license': 'CC BY-SA 4.0',\n 'source_record_id': '112789',\n 'source_record_sha256': '685fe6af1a44935ae67045a2635453e5e1c3363ca9a71cc98f94fdada045bbca',\n 'source_url': 'https://biology.stackexchange.com/questions/112789/how-to-generate-pathway-fingerprints-of-drugs',\n 'transformation': 'RegalFire V3 deterministic '\n 'transformation; no LLM truth '\n 'labels'},\n 'question_html': '<p>I have studied a paper that constructs the '\n 'pathway fingerprint of a drug, which has a vector '\n 'of <span class=\"math-container\">$0$</span> and '\n '<span class=\"math-container\">$1$</span>, and they '\n 'compare the pathway fingerprint using a similarity '\n 'measure to assess how similar the drugs are.</p>\\n'\n \"<p>But I don't know where can I download pathways \"\n 'and how to generate their fingerprint vector to '\n 'evaluate them. I checked <a '\n 'href=\"https://www.genome.jp/kegg/\" rel=\"nofollow '\n 'noreferrer\">KEGG website</a> but could not find '\n 'anything there to download. The paper can be '\n 'downloaded from: <a '\n 'href=\"https://pubmed.ncbi.nlm.nih.gov/22426982/\" '\n 'rel=\"nofollow '\n 'noreferrer\">https://pubmed.ncbi.nlm.nih.gov/22426982/</a></p>\\n'\n '<p>I really appreciate answers that can help me to '\n 'solve the problem.</p>\\n'\n '<p><strong>Update</strong>\\n'\n 'Since i am not familiar with DrugBank and biology '\n 'science, when I parsed the xml file of drugbank, I '\n 'find a tag with name <code>pathway</code> . But i '\n 'am not sure that do these elements show the pathway '\n 'of drug or not? Is it possible to use them to '\n 'construct the pathway fingerprint vector for drugs? '\n 'what does '\n '<code>&lt;uniprot-id&gt;P00734&lt;/uniprot-id&gt;</code> '\n 'mean?</p>\\n'\n '<p>this is the content of <code>pathway</code> tag '\n 'for Lepirudin:</p>\\n'\n '<pre><code>&lt;pathways&gt;\\n'\n ' &lt;pathway&gt;\\n'\n ' &lt;smpdb-id&gt;SMP0000278&lt;/smpdb-id&gt;\\n'\n ' &lt;name&gt;Lepirudin Action '\n 'Pathway&lt;/name&gt;\\n'\n ' &lt;category&gt;drug_action&lt;/category&gt;\\n'\n ' &lt;drugs&gt;\\n'\n ' &lt;drug&gt;\\n'\n ' '\n '&lt;drugbank-id&gt;DB00001&lt;/drugbank-id&gt;\\n'\n ' &lt;name&gt;Lepirudin&lt;/name&gt;\\n'\n ' &lt;/drug&gt;\\n'\n ' &lt;drug&gt;\\n'\n ' '\n '&lt;drugbank-id&gt;DB01022&lt;/drugbank-id&gt;\\n'\n ' &lt;name&gt;Phylloquinone&lt;/name&gt;\\n'\n ' &lt;/drug&gt;\\n'\n ' &lt;drug&gt;\\n'\n ' '\n '&lt;drugbank-id&gt;DB01373&lt;/drugbank-id&gt;\\n'\n ' &lt;name&gt;Calcium&lt;/name&gt;\\n'\n ' &lt;/drug&gt;\\n'\n ' &lt;/drugs&gt;\\n'\n ' &lt;enzymes&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00734&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00748&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P02452&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P03952&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P03951&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00740&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00451&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P12259&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00742&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P02671&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P02675&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P02679&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00488&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P05160&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00747&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P00750&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P08709&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P13726&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;Q9BQB6&lt;/uniprot-id&gt;\\n'\n ' '\n '&lt;uniprot-id&gt;P38435&lt;/uniprot-id&gt;\\n'\n ' &lt;/enzymes&gt;\\n'\n ' &lt;/pathway&gt;\\n'\n ' &lt;/pathways&gt;\\n'\n '\\n'\n '<span class=\"math-container\">```</span>\\n'\n '</code></pre>\\n',\n 'question_title': 'How to generate pathway fingerprints of drugs?',\n 'selection_rule': 'question troubleshooting lexeme plus literal pre '\n 'block in question or answer; no root-cause '\n 'inference',\n 'source_url': 'https://biology.stackexchange.com/questions/112789/how-to-generate-pathway-fingerprints-of-drugs',\n 'split': 'holdout'}"
10
+ },
11
+ {
12
+ "mutation": "fabricated_source_hash",
13
+ "rejected": true,
14
+ "reason": "source record hash mismatch"
15
+ },
16
+ {
17
+ "mutation": "incorrect_license",
18
+ "rejected": true,
19
+ "reason": "license mismatch"
20
+ },
21
+ {
22
+ "mutation": "invalid_split",
23
+ "rejected": true,
24
+ "reason": "'unknown' is not one of ['train', 'validation', 'test', 'holdout']\n\nFailed validating 'enum' in schema['properties']['split']:\n {'enum': ['train', 'validation', 'test', 'holdout'], 'type': ['string']}\n\nOn instance['split']:\n 'unknown'"
25
+ },
26
+ {
27
+ "mutation": "duplicate_record",
28
+ "rejected": true
29
+ },
30
+ {
31
+ "mutation": "invented_error_message",
32
+ "rejected": true,
33
+ "reason": "fabricated error"
34
+ },
35
+ {
36
+ "mutation": "changed_code",
37
+ "rejected": true,
38
+ "reason": "code extraction mismatch"
39
+ },
40
+ {
41
+ "mutation": "changed_answer",
42
+ "rejected": true,
43
+ "reason": "answer field mismatch: answer_text"
44
+ },
45
+ {
46
+ "mutation": "fabricated_accepted_answer",
47
+ "rejected": true,
48
+ "reason": "accepted answer invented"
49
+ }
50
+ ]
51
+ }
schema.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "required": [
5
+ "id",
6
+ "domain",
7
+ "language",
8
+ "library_or_tool",
9
+ "question_title",
10
+ "problem_text",
11
+ "question_html",
12
+ "code_blocks",
13
+ "error_text_if_explicit",
14
+ "attempted_method_if_explicit",
15
+ "answers",
16
+ "accepted_answer",
17
+ "answer_scores",
18
+ "source_url",
19
+ "author_attribution",
20
+ "content_license",
21
+ "provenance",
22
+ "selection_rule",
23
+ "group_id",
24
+ "split"
25
+ ],
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "id": {
29
+ "type": [
30
+ "string"
31
+ ],
32
+ "minLength": 10
33
+ },
34
+ "domain": {
35
+ "type": [
36
+ "string"
37
+ ]
38
+ },
39
+ "language": {
40
+ "type": [
41
+ "array",
42
+ "null"
43
+ ]
44
+ },
45
+ "library_or_tool": {
46
+ "type": [
47
+ "array",
48
+ "null"
49
+ ]
50
+ },
51
+ "question_title": {
52
+ "type": [
53
+ "string"
54
+ ]
55
+ },
56
+ "problem_text": {
57
+ "type": [
58
+ "string"
59
+ ]
60
+ },
61
+ "question_html": {
62
+ "type": [
63
+ "string"
64
+ ]
65
+ },
66
+ "code_blocks": {
67
+ "type": [
68
+ "array"
69
+ ]
70
+ },
71
+ "error_text_if_explicit": {
72
+ "type": [
73
+ "array",
74
+ "null"
75
+ ]
76
+ },
77
+ "attempted_method_if_explicit": {
78
+ "type": [
79
+ "null",
80
+ "string"
81
+ ]
82
+ },
83
+ "answers": {
84
+ "type": [
85
+ "array"
86
+ ]
87
+ },
88
+ "accepted_answer": {
89
+ "type": [
90
+ "null",
91
+ "object"
92
+ ]
93
+ },
94
+ "answer_scores": {
95
+ "type": [
96
+ "array"
97
+ ]
98
+ },
99
+ "source_url": {
100
+ "type": [
101
+ "string"
102
+ ]
103
+ },
104
+ "author_attribution": {
105
+ "type": [
106
+ "object"
107
+ ]
108
+ },
109
+ "content_license": {
110
+ "type": [
111
+ "string"
112
+ ]
113
+ },
114
+ "provenance": {
115
+ "type": [
116
+ "object"
117
+ ],
118
+ "required": [
119
+ "source_dataset",
120
+ "source_record_id",
121
+ "source_record_sha256",
122
+ "source_license",
123
+ "transformation"
124
+ ],
125
+ "properties": {
126
+ "source_record_sha256": {
127
+ "type": "string",
128
+ "pattern": "^[a-f0-9]{64}$"
129
+ }
130
+ }
131
+ },
132
+ "selection_rule": {
133
+ "type": [
134
+ "string"
135
+ ]
136
+ },
137
+ "group_id": {
138
+ "type": [
139
+ "string"
140
+ ],
141
+ "pattern": "^[a-f0-9]{64}$"
142
+ },
143
+ "split": {
144
+ "enum": [
145
+ "train",
146
+ "validation",
147
+ "test",
148
+ "holdout"
149
+ ],
150
+ "type": [
151
+ "string"
152
+ ]
153
+ }
154
+ }
155
+ }
stats.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Scientific-Code-Troubleshooting",
3
+ "records": 50,
4
+ "splits": {
5
+ "holdout": 5,
6
+ "train": 36,
7
+ "test": 6,
8
+ "validation": 3
9
+ },
10
+ "domains": {
11
+ "biology": 4,
12
+ "statistics": 11,
13
+ "computational_science": 35
14
+ },
15
+ "families": {
16
+ "troubleshooting": 50
17
+ },
18
+ "rejected_records": 1017,
19
+ "target_shortfall": 450
20
+ }
test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
train.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
validation.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
validation_report.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "PASS",
3
+ "records": 50,
4
+ "independently_checked": 50,
5
+ "unique_ids": 50,
6
+ "semantic_duplicates": 0,
7
+ "group_count": 50,
8
+ "splits": {
9
+ "holdout": 5,
10
+ "train": 36,
11
+ "test": 6,
12
+ "validation": 3
13
+ },
14
+ "errors": [],
15
+ "validation_scope": "Schema, strict UTF-8/JSON, identities, exact semantic duplicates, source hashes/relationships, attribution, labels, independent computational oracles, recovery replay and grouped split leakage",
16
+ "near_duplicate_policy": "Scientific normalized text and question 5-shingle grouping; synthetic whole-template groups plus source symmetry-grid grouping. No claim of exhaustive semantic deduplication."
17
+ }
validator/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RegalFire
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
validator/validate.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Independent V3 validator. Does not import build.py or transformation functions."""
2
+ import json,re,html,hashlib,sys,copy,importlib.util
3
+ from pathlib import Path
4
+ from collections import Counter,defaultdict
5
+ from html.parser import HTMLParser
6
+ from jsonschema import Draft202012Validator
7
+ from huggingface_hub import hf_hub_download
8
+ def encoded(x):return json.dumps(x,sort_keys=True,ensure_ascii=False,separators=(',',':'),allow_nan=False)
9
+ def digest(x):return hashlib.sha256((x if isinstance(x,str) else encoded(x)).encode()).hexdigest()
10
+ def strict(s):
11
+ def pairs(xs):
12
+ d={}
13
+ for k,v in xs:
14
+ if k in d:raise ValueError('duplicate JSON key')
15
+ d[k]=v
16
+ return d
17
+ return json.loads(s,object_pairs_hook=pairs,parse_constant=lambda s:(_ for _ in ()).throw(ValueError('nonfinite number')))
18
+ def readrows(p):return [strict(s) for s in p.read_text('utf-8').splitlines() if s.strip()]
19
+ def require(v,message):
20
+ if not v:raise ValueError(message)
21
+ def module(path,name):
22
+ spec=importlib.util.spec_from_file_location(name,path);m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m);return m
23
+ def originals(folder):
24
+ result={};lock=json.loads((folder/'SOURCE_LOCK.json').read_text())
25
+ wanted=defaultdict(set)
26
+ for r in readrows(folder/'dataset.jsonl'):wanted[r['provenance']['source_dataset']].add(r['provenance']['source_record_id'])
27
+ for s in lock:
28
+ repo=s['repo_id']
29
+ if repo:
30
+ p=Path(hf_hub_download(repo,s['data_file'],repo_type='dataset',revision=s['commit']))
31
+ expected=s['files']['dataset.jsonl']['sha256'];require(hashlib.sha256(p.read_bytes()).hexdigest()==expected,'source snapshot hash mismatch')
32
+ else:p=folder/s['data_file'];repo='RegalFire/'+s['name']
33
+ for line in p.open(encoding='utf-8'):
34
+ r=strict(line);key=str(r.get('id',r.get('record_id',r.get('thread_id'))))
35
+ if key in wanted[repo]:result[(repo,key)]=r
36
+ return result
37
+ def thread(s):return s.get('thread',s)
38
+ def question(s):t=thread(s);return t.get('question_text'),t.get('question_html'),t.get('source_url',t.get('thread_url'))
39
+ class Links(HTMLParser):
40
+ def __init__(self):super().__init__(convert_charrefs=True);self.urls=[]
41
+ def handle_starttag(self,tag,attrs):
42
+ if tag=='a':
43
+ self.urls.extend(v for k,v in attrs if k=='href' and v and v.startswith(('http://','https://')))
44
+ def literal_blocks(body):
45
+ result=[]
46
+ for raw in re.findall(r'<pre\b[^>]*>(.*?)</pre\s*>',body,re.S|re.I):
47
+ raw=re.sub(r'<br\s*/?>','\n',raw,flags=re.I)
48
+ result.append(html.unescape(re.sub(r'<[^>]+>','',raw)))
49
+ return result
50
+ def scientific(r,s):
51
+ t=thread(s);text,body,url=question(s);aa=t['answers'];require(r['provenance']['source_url']==url,'thread URL mismatch')
52
+ require(r['provenance']['original_provenance']==t['provenance'],'original provenance changed')
53
+ require(r['provenance']['revision_attribution']==t['revision_attribution'],'revision contributors changed')
54
+ require(r['content_license']==t['question_license']=='CC BY-SA 4.0','question license mismatch')
55
+ require(all(a['content_license']=='CC BY-SA 4.0' for a in aa),'answer license not approved')
56
+ if r['id'].startswith('SCT'):
57
+ require(r['problem_text']==text and r['question_html']==body and r['question_title']==t['title'],'question content changed')
58
+ require(bool(r['code_blocks']),'no code')
59
+ posts={str(t.get('question_id',t.get('thread_id'))):body,**{str(a['answer_id']):a['answer_html'] for a in aa}}
60
+ for b in r['code_blocks']:
61
+ source=posts.get(str(b['post_id']),body)
62
+ blocks=literal_blocks(source);require(b['block_index']<len(blocks) and b['code_text']==blocks[b['block_index']],'code extraction mismatch')
63
+ require(digest(b['code_text'])==b['sha256'],'code hash mismatch')
64
+ expected_error=[line.strip() for line in text.splitlines() if re.match(r'^\s*(?:[A-Za-z]+Error:|Error(?: in .*?)?:|Warning:|Traceback \(most recent call last\):)',line)] or None
65
+ require(r['error_text_if_explicit']==expected_error,'fabricated error')
66
+ if r['attempted_method_if_explicit'] is not None:require(r['attempted_method_if_explicit'] in text and r['attempted_method_if_explicit'].startswith(('I tried ','I attempted ')),'fabricated attempt')
67
+ require(r['answer_scores']==[{'answer_id':a['answer_id'],'score':a['score']} for a in aa],'answer scores mismatch')
68
+ require(r['author_attribution']['question_author']==t['question_author'] and r['author_attribution']['question_author_url']==t['question_author_url'],'question attribution changed')
69
+ answers=r['answers'];accepted=r['accepted_answer']
70
+ else:
71
+ require(r['query']==t['title']+'\n'+text,'query changed')
72
+ expected=[text]+[a['answer_text'] for a in aa]
73
+ require([c['text'] for c in r['contexts']]==expected,'context changed')
74
+ require(len(r['context_sources'])==len(expected),'missing context attribution')
75
+ for c in r['context_sources']:require(c['content_license']=='CC BY-SA 4.0' and c['author'] is not None and 'revision_attribution' in c,'missing attribution')
76
+ accepted=next((a for a in aa if a['is_accepted']),None);families=[]
77
+ parser=Links();parser.feed(body)
78
+ for a in aa:parser.feed(a['answer_html'])
79
+ citations=sorted(set(parser.urls));require(r['external_citations']==citations,'citations invented or dropped')
80
+ if not accepted:families.append('no_accepted_answer')
81
+ if accepted and max(a['score'] for a in aa)>accepted['score']:families.append('accepted_vs_highest_score_disagreement')
82
+ if len(citations)>=2:families.append('multiple_sources')
83
+ if len(citations)>=5:families.append('citation_heavy')
84
+ if len(aa)>=2:families.append('multiple_answer_candidates')
85
+ if int(t['question_created_at'][:4])<=2021:families.append('old_thread_metadata')
86
+ require(r['hard_case_family']==families,'unsupported family')
87
+ require(r['accepted_status']['accepted_answer_id']==(accepted['answer_id'] if accepted else None),'acceptance mismatch')
88
+ require(r['ground_truth_type']=='metadata_grounded' and r['oracle']['canonical_answer'] is None and r['accepted_status']['scientific_correctness_verified'] is False,'unsupported scientific truth')
89
+ require(r['scores']==[{'answer_id':a['answer_id'],'score':a['score']} for a in aa],'scores mismatch')
90
+ answers=r['candidate_answers']
91
+ require(len(answers)==len(aa),'answer count mismatch')
92
+ for a,b in zip(answers,aa):
93
+ for key in ['answer_id','question_id','answer_text','answer_html','content_license','answer_url','score','is_accepted','revision_attribution','provenance']:
94
+ require(a[key]==b[key],'answer field mismatch: '+key)
95
+ require(a['author']==b.get('author',b.get('author_display_name')) and a['author_url']==b.get('author_url',b.get('author_profile_url')),'answer attribution mismatch')
96
+ if r['id'].startswith('SCT'):
97
+ expected=next((a for a in answers if a['is_accepted']),None);require(accepted==expected,'accepted answer invented')
98
+ def agent(r,s,nav,physics,horizon):
99
+ domain=r['domain'];available=True
100
+ if domain=='navigation':
101
+ nav.nav(s['input'],s['expected']);i=s['input'];before=s['expected']['before'];after=s['expected']['after'];grid=list(i['grid']);y,x=i['edit'];line=list(grid[y]);line[x]='#';grid[y]=''.join(line)
102
+ require(i['grid'][y][x]=='.' and i['edit'] in before['path'],'no explicit invalid legacy path')
103
+ require(r['initial_state']=={'grid':i['grid'],'costs':i['costs'],'position':i['start']},'initial state mismatch')
104
+ failed={'grid':grid,'costs':i['costs'],'position':i['start']};require(r['failure_state']==failed,'failure state mismatch')
105
+ require(r['action_history']==[{'action':'submit_path','path':before['path'],'result':'rejected_atomically_blocked_cell','state_unchanged':True}],'history mismatch')
106
+ available=after['path'] is not None;seq=after['path'][1:] if available else [];action={'action':'follow_path','path':after['path']} if available else None;final={**failed,'position':i['goal']} if available else failed;cost={'cost':after['cost'],'steps':len(seq) if available else None};failure='legacy_path_blocked_by_critical_edit';goal={'position':i['goal']}
107
+ elif domain=='multi_agent':
108
+ nav.coord(s['input'],s['expected']);i=s['input'];plan=s['expected']['plan'];available=plan is not None
109
+ initial={'grid':i['grid'],'positions':i['starts']};require(r['initial_state']==initial and r['failure_state']==initial,'joint state mismatch')
110
+ require(i['starts']!=i['goals'],'stop was not a failure')
111
+ require(r['action_history']==[{'action':'stop','result':'rejected_goals_unsatisfied','state_unchanged':True}],'joint history mismatch')
112
+ seq=plan[1:] if plan else [];action={'action':'execute_joint_plan','plan':plan} if plan else None;final={'grid':i['grid'],'positions':i['goals']} if plan else initial;cost={'cost':s['expected']['optimal_makespan'],'steps':len(seq) if plan else None};failure='premature_stop_goals_unsatisfied';goal={'positions':i['goals'],'vertex_collision_forbidden':True,'edge_swap_forbidden':True,'absorbing_goals':True}
113
+ elif domain=='counterfactual':
114
+ truth=physics.truth(s);require(physics.compare(truth,s['expected_state_t1']) and not physics.compare(truth,s['counterfactual_state_t1']),'physics source labels invalid')
115
+ require(r['initial_state']=={'state_t0':s['state_t0'],'action':s['action'],'dt':s['dt']},'physics initial mismatch')
116
+ require(r['failure_state']=={'predicted_state_t1':s['counterfactual_state_t1']},'physics failure mismatch')
117
+ require(r['action_history']==[{'action':'submit_prediction','prediction':s['counterfactual_state_t1'],'result':'rejected_analytical_inconsistency'}],'physics history mismatch')
118
+ action={'action':'replace_prediction','prediction':s['expected_state_t1']};seq=[action];final={'predicted_state_t1':s['expected_state_t1']};cost={'cost':1,'steps':1};failure='analytically_inconsistent_'+s['counterfactual_changed_field'];goal={'prediction_matches_analytical_transition':True}
119
+ elif domain=='planning':
120
+ correct,final=horizon.oracle(s);require(correct==s['optimal_action'] and final==s['expected_state_t1'],'planning source oracle mismatch')
121
+ require(r['initial_state']==s['observation']['state'] and r['failure_state']==s['observation']['state'],'planning initial/failure mismatch')
122
+ h=r['action_history'];require(len(h)==1 and h[0]['action'] in s['available_actions'] and h[0]['action']!=correct and h[0]['result']=='rejected_policy_mismatch' and h[0]['state_unchanged'] is True,'failure action not a wrong policy action')
123
+ action={'action':correct};seq=[action];cost={'cost':1,'steps':1};failure='next_step_policy_mismatch';goal={'short_horizon':s['success_condition'],'full_long_horizon_goal_claimed':False}
124
+ else:raise ValueError('unknown agent domain')
125
+ require(r['goal']==goal and r['failure_type']==failure,'failure/goal labels mismatch')
126
+ require(r['recovery_available'] is available and r['success'] is available,'success/availability mismatch')
127
+ require(r['recovery_action']==action and r['recovery_sequence']==seq and r['final_state']==final and r['cost_or_steps']==cost,'recovery trajectory mismatch')
128
+ require(r['oracle']['source_family']==s['family'] and r['oracle']['source_input']==s.get('input') and r['oracle']['source_expected']==s.get('expected'),'oracle metadata mismatch')
129
+ def validate(folder,records=None):
130
+ folder=Path(folder);data=readrows(folder/'dataset.jsonl') if records is None else records
131
+ sources=originals(folder);schema=Draft202012Validator(json.loads((folder/'schema.json').read_text()))
132
+ vendor=folder/'validator'/'vendor';sys.path.insert(0,str(vendor))
133
+ nav=module(vendor/'nav_check.py','nav_check') if (vendor/'nav_check.py').exists() else None
134
+ physics=module(vendor/'physics.py','physics') if (vendor/'physics.py').exists() else None
135
+ horizon=module(vendor/'horizon.py','horizon') if (vendor/'horizon.py').exists() else None
136
+ gcc=module(vendor/'gcc.py','gcc') if (vendor/'gcc.py').exists() else None
137
+ ids=set();semantic=set();groups={};templates={};procedural={};textsplits={};errors=[];question_grams=[]
138
+ for index,r in enumerate(data):
139
+ try:
140
+ schema.validate(r);require(r['id'] not in ids,'duplicate id');ids.add(r['id'])
141
+ body={k:v for k,v in r.items() if k not in ['id','provenance','group_id','split']};h=digest(body);require(h not in semantic,'exact semantic duplicate');semantic.add(h)
142
+ p=r['provenance'];key=(p['source_dataset'],p['source_record_id']);require(key in sources,'missing source relation');s=sources[key];require(digest(s)==p['source_record_sha256'],'source record hash mismatch')
143
+ require(r['content_license']==p['source_license'],'license mismatch')
144
+ require(groups.setdefault(r['group_id'],r['split'])==r['split'],'group leakage')
145
+ if r['id'].startswith('AFR'):
146
+ require(templates.setdefault((r['domain'],r['task_type']),r['split'])==r['split'],'template leakage')
147
+ if p.get('procedural_group_id'):require(procedural.setdefault(p['procedural_group_id'],r['split'])==r['split'],'procedural grid leakage')
148
+ agent(r,s,nav,physics,horizon)
149
+ elif p['source_dataset'].endswith('GCC-RAG-HardCases'):
150
+ truth=gcc.oracle(s)
151
+ require(all(s['expected'][k]==v for k,v in truth.items()),'independent GCC oracle mismatch')
152
+ require(r['query']==s['query'] and r['oracle']==s['expected'],'GCC source oracle/query mismatch')
153
+ require(r['hard_case_family']==['gcc_'+s['family']] and r['ground_truth_type']=='deterministic_source_grounded','GCC family/truth mismatch')
154
+ require([c['text'] for c in r['contexts']]==[d['content'] for d in s['documents']],'GCC context mismatch')
155
+ require(r['candidate_answers']==([{'answer_text':s['expected']['answer']}] if s['expected']['answerable'] else []),'GCC answer mismatch')
156
+ require(r['external_citations']==[] and len(r['context_sources'])==len(s['documents']) and all(c['synthetic'] and c['content_license']=='MIT' for c in r['context_sources']),'GCC sources/citations invalid')
157
+ require(templates.setdefault(s['family'],r['split'])==r['split'],'GCC template leakage')
158
+ else:
159
+ scientific(r,s)
160
+ t=thread(s)
161
+ words=re.sub(r'[^\w]+',' ',t['question_text'].lower()).split();grams={tuple(words[j:j+5]) for j in range(len(words)-4)}
162
+ for prior,split in question_grams:
163
+ if prior and grams and len(prior&grams)/len(prior|grams)>=.85:require(split==r['split'],'near-duplicate question split leakage')
164
+ question_grams.append((grams,r['split']))
165
+ for text in [t['question_text']]+[a['answer_text'] for a in t['answers']]:
166
+ normal=re.sub(r'[^\w]+',' ',text.lower()).strip()
167
+ if len(normal)>=50:require(textsplits.setdefault(digest(normal),r['split'])==r['split'],'shared text leakage')
168
+ except Exception as e:errors.append({'id':r.get('id'),'line':index+1,'reason':str(e)})
169
+ if records is None:
170
+ splitrows=[r for name in ['train','validation','test','holdout'] for r in readrows(folder/(name+'.jsonl'))]
171
+ require(Counter(encoded(r) for r in splitrows)==Counter(encoded(r) for r in data),'split files do not partition dataset exactly')
172
+ return {'status':'PASS' if not errors else 'FAIL','records':len(data),'independently_checked':len(data)-len(errors),'unique_ids':len(ids),'semantic_duplicates':len(data)-len(semantic),'group_count':len(groups),'splits':dict(Counter(r['split'] for r in data)),'errors':errors,'validation_scope':'Schema, strict UTF-8/JSON, identities, exact semantic duplicates, source hashes/relationships, attribution, labels, independent computational oracles, recovery replay and grouped split leakage','near_duplicate_policy':'Scientific normalized text and question 5-shingle grouping; synthetic whole-template groups plus source symmetry-grid grouping. No claim of exhaustive semantic deduplication.'}
173
+ if __name__=='__main__':
174
+ folder=Path(sys.argv[1]) if len(sys.argv)>1 else Path(__file__).resolve().parents[1]
175
+ report=validate(folder);(folder/'validation_report.json').write_text(json.dumps(report,indent=2)+'\n',encoding='utf-8');print(json.dumps({k:v for k,v in report.items() if k!='errors'}));sys.exit(0 if report['status']=='PASS' else 1)