#!/usr/bin/env python3 """Package source, rights evidence, measured documentation and a tiny local explorer.""" import argparse import hashlib import html import json import pathlib import shutil def main(): parser = argparse.ArgumentParser() parser.add_argument("--project", type=pathlib.Path, default=pathlib.Path(__file__).resolve().parents[1]) args = parser.parse_args() project = args.project release = project / "release" stats = json.loads((release / "stats.json").read_text()) baselines = json.loads((release / "reports" / "baselines.json").read_text()) for folder in ("raw", "code"): shutil.copytree(project / folder, release / folder, dirs_exist_ok=True, ignore=shutil.ignore_patterns("__pycache__", "*.pyc")) # The two license files are maintained with the source project, outside the build output. shutil.copyfile(project / "LICENSE", release / "LICENSE") shutil.copyfile(project / "code" / "LICENSE", release / "code" / "LICENSE") (release / "code" / "requirements.txt").write_text("pyarrow==26.0.0\n") (release / "requirements.txt").write_text("pyarrow==26.0.0\n") counts = "\n".join(f"| `{op}` | {count:,} |" for op, count in sorted(stats["operations"].items())) split_rows = "\n".join(f"| {split} | {len(data['economies'])} | {data['observations']:,} | {data['questions']:,} | {data['structure_holdout_diagnostic']:,} |" for split, data in stats["per_split"].items()) configs = "\n".join(f"- config_name: {config}\n" + (" default: true\n" if config == "questions" else "") + " data_files:\n" + "\n".join(f" - split: {split}\n path: data/{config}/{split}-*.parquet" for split in ("train", "validation", "test")) for config in ("questions", "observations", "tables")) first = baselines["baselines"]["first_visible_cell"]["all"] readme = f'''--- pretty_name: Bayanat Arabic Public Data Reasoning language: - ar - en license: cc-by-4.0 task_categories: - question-answering size_categories: - 1K"}}`. Incompatible addition returns `{{"status":"incompatible_units","value":null,"unit":null}}`. These schema snippets are illustrative, not answers to a released item. ## Measured contents The frozen cohort contains 22 selected Arab League economies, eight explicitly licensed WDI indicators and 25 requested years, 2000–2024. The cohort is a current selection, not a reconstruction of historical membership or boundaries. Source names are preserved, including the World Bank's economy naming. **4,300 cells are numeric; 100 are missing.** An API `lastupdated` value of 2026-10-08 accompanies all eight collected observation responses, retrieved on 2026-10-26. Indicator metadata and provider statements remain separately inspectable in `series.json` and `raw/`. | Split | Economies | Source observations | Questions | Test-only structure diagnostic | |---|---:|---:|---:|---:| {split_rows} | Operator | Questions | |---|---:| {counts} Only 28 questions have the `missing` target and 109 have `incompatible_units`; the other 6,282 have `ok`. Report status metrics by class: an always-`ok` style method can achieve high status accuracy without computing correct values. Lookup questions are deliberately easy and form 893 records. The eight series cover population, current-dollar GDP, published current-dollar GDP per capita, annual GDP growth, life expectancy, electricity access, consumer-price inflation, and urban population share. See [SOURCES.md](SOURCES.md) for exact IDs, providers and licenses. ## Arithmetic and task boundaries Lookup answers reproduce the exact displayed source numeric string. Arithmetic uses Python `Decimal`, with derived outputs rounded to six decimal places using `ROUND_HALF_UP`; trailing zeros can be omitted under numeric normalization. Values are never rounded before display and then secretly computed from hidden precision. Missing values stay `null`, rather than zero. Relative change requires a positive base and applies only to quantity series, not percentage rates. Rate differences use percentage points. Negative signed differences are retained. The GDP/population task divides the two displayed source values for the same economy and year. It is explicitly a **calculated ratio**, which need not equal the separately published GDP-per-capita series. Current-dollar GDP changes are changes in recorded nominal values, not real economic growth. Comparisons of urban population shares concern recorded values; national definitions can differ. Ranking questions concern only non-missing cells actually displayed, return all ties, and do not establish a ranking over absent years or all economies. Cross-economy questions name both displayed economies and never claim to cover the full cohort. `second_highest_years` is a test-only question-structure diagnostic over the second **distinct** highest value. Its 113 rows must be reported separately from the 6,306 rows using shared operators. Its parser is explicitly implemented in the symbolic baseline, so that baseline is not a demonstration of learning an unseen operation. ## Splits, duplication and evidence Economies are assigned by a fixed SHA256 ordering, with 16 in train, three in validation and three in test; [splits.json](splits.json) contains the exact algorithm and allocation. All years, series, question families, joins and tables involving an economy stay in its split. Cross-economy comparisons are constructed only within a split. Source-cell and economy overlap across splits is zero under the audit. Indicator definitions, question grammar and numerical values can recur, so this is a narrow economy holdout with a separate operator diagnostic, not broad out-of-distribution evidence. Exact context/question inputs and IDs are deduplicated. Related tasks can reuse a source cell inside a split. `family_id` identifies the operator and its ordered evidence cells; it does not make reused-source families statistically independent. For uncertainty estimates, cluster at least by economy or connected source-cell groups rather than individual question rows. Only three held-out economies are available in either validation or test, so inference beyond this cohort is limited. Evidence IDs are the cells read by the formal answer program. They form an auditable software reference, not a human proof or a uniquely minimal explanation. **Contexts contain only the program's evidence cells**, so citing every displayed cell satisfies the evidence target. Citation scores here do not measure distractor rejection, retrieval quality, or faithful internal reasoning. ## Reproduce, verify and score ```sh python -m pip install -r requirements.txt python code/build.py --project . --output ../rebuilt-public-data python code/verify.py --release . --raw raw --output reports/validation-rerun.json python code/tests.py -v python code/baselines.py --release . python code/score.py --release . --split all \\ --predictions reports/template_aware_symbolic.predictions.jsonl \\ --output reports/symbolic-score-rerun.json ``` Rebuilding uses frozen `raw/` bytes and checks their hashes; it does not contact the API. `code/fetch.py` is the bounded acquisition recipe. Running it with `--refresh` explicitly starts a fresh mutable source collection. The original receipt URLs, retrieval times, successful HTTP status, hashes and source update fields are retained. The tested packaging environment used Python 3.14 and PyArrow 26.0.0. `code/verify.py` independently implements the algebra and source checks without importing the generator's oracle. To score a model, write JSONL rows as `{{"id":"","answer":{{"status":"ok","value":"","unit":""}},"evidence_ids":[""]}}`. Use `--split test` for a test-only submission; default scoring includes both shared and diagnostic rows and reports each separately. A submission must use only the IDs in its selected scope. Missing predictions are wrong; duplicate, unknown or out-of-scope prediction IDs fail the submission. Nonfinite values fail numeric matching. Boolean values remain distinct from numeric 0/1; exact rank matching requires ordered string years. Nonexistent or duplicated citations fail strict joint. See [EVALUATION.md](EVALUATION.md). ## Actual validation and transparent baselines The software auditor passed all 6,419 released tasks, all 4,400 source observations, raw snapshot hashes, source licenses, context/source equivalence, Parquet/JSONL parity, evidence sufficiency and split boundaries. Separate agent review independently recomputed every task at Decimal precision 60 and found no mismatches; this is software review, not native-speaker or domain-professional review. Exact reports are in `reports/`. | Input-only method | Rows | Exact answer | |---|---:|---:| | Return first visible cell | 6,419 | {first['exact_answer']:,}/{first['rows']:,} ({100 * first['exact_answer_rate']:.2f}%) | | Template-aware symbolic parser | 6,419 | 6,419/6,419 (100.00%) | The symbolic parser recognizes every declared authored Arabic template, including the diagnostic operator, then applies an exact programmed calculation to visible cells. This demonstrates a controlled-format ceiling. It is not a learned-model result, unrestricted Arabic parser, or evidence of training benefit. The first-cell method has {100 * first['status_exact_rate']:.2f}% status accuracy despite only {100 * first['exact_answer_rate']:.2f}% exact answers, illustrating why status alone is insufficient. No LLM benchmark score is claimed. Frozen prediction rows and per-split/per-operator results are included. ## Rights, credits and limitations Data and original annotations/documentation are distributed under [CC BY 4.0](LICENSE); **World Bank source data additionally retain the mandatory source terms** documented in [DATA_LICENSE.md](DATA_LICENSE.md), [ATTRIBUTION.md](ATTRIBUTION.md), and the frozen rights pages. Code is separately [Apache-2.0](code/LICENSE). Each of the eight individual series explicitly reports CC BY-4.0 in its frozen metadata. World Bank and the original data providers receive attribution; neither endorses this adaptation. No third-party benchmark examples, article prose, microdata or model responses are redistributed. Limitations include controlled template language, limited operators, uneven source coverage and metadata quality, possible estimation/revision and cross-country definitional differences, rare missing-value targets, no distractor evidence, only three economies per held-out split, and public answers/programs that permit contamination. Software checks establish consistency with the frozen displayed source, not the truth of every economic claim or readiness for consequential decisions. This release makes no first/largest or guaranteed adoption claim. Related resources include [Arabic WikiTableQA](https://www.mdpi.com/2079-9292/14/19/3829), [AraTable](https://github.com/rana-alshaikh/AraTable-Benchmark), [SAHM](https://mbzuai-nlp.github.io/SAHM/), and [ArabicNumBench](https://arxiv.org/abs/2602.18776). The contribution is this particular official-source snapshot, original controlled tasks, explicit rights provenance, exact executable answers and economy-held-out packaging. ```bibtex @dataset{{bayanat_arabic_public_data_reasoning_2026, author = {{{{Bayanat Labs}}}}, title = {{Bayanat Arabic Public Data Reasoning}}, year = {{2026}}, version = {{0.1.0}}, url = {{https://huggingface.co/datasets/Bayanat-Labs/arabic-table-reasoning}}, note = {{Controlled Arabic QA over real World Bank WDI observations; CC BY 4.0 with retained source terms}} }} ``` ''' (release / "README.md").write_text(readme) series = json.loads((release / "series.json").read_text()) rights_rows = "\n".join(f"| `{s['indicator_code']}` | {s['label_en']} | {s['source_unit']} | [CC BY-4.0 metadata]({s['source_metadata_url']}) |" for s in series) providers = "\n\n".join(f"### `{s['indicator_code']}` — {s['label_en']}\n\n{s['source_providers']}\n\n[Indicator page]({s['indicator_url']}) · [Exact metadata]({s['source_metadata_url']})" for s in series) (release / "SOURCES.md").write_text(f'''# Frozen source register World Bank: World Development Indicators (WDI), API source 2. Requested period: 2000–2024. Acquisition: 26 October 2026. Observation API update field: 8 October 2026. Exactly 550 source observations were returned for each series (22 economies × 25 years). The API observation `unit` fields are empty, so the dataset uses the explicit `Unitofmeasure` in series metadata; authored `unit_code` and Arabic unit glosses make it executable. Original status and decimal-hint fields are retained. | Series | Official English label | Official source unit | Individual license evidence | |---|---|---|---| {rights_rows} Native Arabic labels and source definitions are retained from `/v2/ar/`. Some definitions returned by that endpoint are English, and some Arabic metadata lag the current English metadata. Bayanat does not silently describe those as verified official Arabic translations. No facts are independently audited against national source systems. The [raw manifest](raw/manifest.json) supplies every exact request, retrieval time, status and SHA256. Mutable URLs alone do not reproduce the frozen release. ## Provider attributions {providers} ## Source policy [World Bank public licenses](https://datacatalog.worldbank.org/public-licenses) and [Summary Terms of Use](https://data.worldbank.org/summary-terms-of-use) were frozen with receipts in `raw/`. The legacy `terms-of-use-for-datasets` URL redirects to general site terms, so this release cites the operative dataset-license and summary pages directly. Only these eight individually qualified indicators are included; an open API is not a blanket clearance for every series. ''') (release / "ATTRIBUTION.md").write_text(f'''# Attribution and change notice **The World Bank: World Development Indicators: source providers identified per series in [SOURCES.md](SOURCES.md) and [series.json](series.json).** Original source: https://data.worldbank.org/ ; individual data sources and metadata URLs are preserved. See https://data.worldbank.org/summary-terms-of-use and https://datacatalog.worldbank.org/public-licenses. World Bank and its listed data providers created/compiled the underlying source observations and native indicator/economy metadata. Bayanat Labs selected 22 economies and eight series, froze the requested 2000–2024 responses, assigned exact source-cell identifiers and economy splits, added explicit unit glosses, authored controlled Arabic and English question templates with AI assistance, calculated answers with software, and packaged source-linked contexts and annotations. Original source spellings and missing numeric values are preserved. These are adaptations and newly generated task annotations. Neither the World Bank nor a source provider has reviewed or endorsed them. No source logo or emblem is included. Follow the same World Bank/provider acknowledgment requirement when redistributing or facilitating access to these source data, and pass the acknowledgment requirement to downstream recipients. The source terms URL above may be used to meet the provider's stated attribution requirement. Cite the Bayanat release as well when referring to this task construction. ''') (release / "DATA_LICENSE.md").write_text('''# Data licensing and retained source terms Original Bayanat question templates, computed annotations, visible table assembly, split manifests and documentation: Creative Commons Attribution 4.0 International (CC BY 4.0), with the legal text in `LICENSE`. Original source code: Apache License 2.0, in `code/LICENSE`. Executable programs are supplied as annotation records; code implementations have the separate code license. Underlying World Bank WDI data and referential series metadata: the eight retained indicators each explicitly identify **CC BY-4.0** in `License_Type`, with `License_URL=https://datacatalog.worldbank.org/public-licenses#cc-by`. World Bank adds mandatory dispute-resolution terms and provider attribution conditions. This release retains those terms; its CC BY metadata does not remove them or establish rights to unrelated WDI series. Read the complete frozen pages `raw/world-bank-public-licenses.html` and `raw/world-bank-summary-terms.html`, their receipts and the current policy URLs. ## Mandatory World Bank addition The following dataset-source addition is reproduced from the World Bank public-licenses page frozen for this release: > Any and all disputes arising under this License that cannot be settled amicably shall be resolved in accordance with the following procedure: > > Pursuant to a notice of mediation communicated by reasonable means by either You or the Licensor to the other, the dispute shall be submitted to non-binding mediation conducted in accordance with rules designated by the Licensor in the copyright notice published with the Work, or if none then in accordance with those communicated in the notice of mediation. The language used in the mediation proceedings shall be English unless otherwise agreed. > > If any such dispute has not been settled within 45 days following the date on which the notice of mediation is provided, either You or the Licensor may, pursuant to a notice of arbitration communicated by reasonable means to the other, elect to have the dispute referred to and finally determined by arbitration. > > The arbitration shall be conducted in accordance with the rules designated by the Licensor in the copyright notice published with the Work, or if none then in accordance with the UNCITRAL Arbitration Rules as then in force. The arbitral tribunal shall consist of a sole arbitrator and the language of the proceedings shall be English unless otherwise agreed. The place of arbitration shall be where the Licensor has its headquarters. > > The arbitral proceedings shall be conducted remotely (e.g., via telephone conference or written submissions) whenever practicable. Source: https://datacatalog.worldbank.org/public-licenses . The frozen original HTML is authoritative if punctuation/formatting differs in this readable transcription. World Bank also requires acknowledgment of World Bank and data providers, including passing that requirement to downstream recipients; prohibits implied endorsement/name/logo use in conjunction with endorsement; and disclaims warranties. See `ATTRIBUTION.md` and the complete summary terms at https://data.worldbank.org/summary-terms-of-use . This license register covers aggregate indicator observations and permitted metadata. It does not include microdata, national-site prose, third-party benchmark content, source logos, or learned-model outputs. No permission for such excluded material is implied. ''') (release / "CITATION.cff").write_text('''cff-version: 1.2.0 message: "Please cite the task dataset and credit World Bank WDI and each source provider." title: "Bayanat Arabic Public Data Reasoning" type: dataset version: 0.1.0 date-released: 2026-10-26 authors: - name: Bayanat Labs url: "https://huggingface.co/datasets/Bayanat-Labs/arabic-table-reasoning" repository-code: "https://github.com/Bayanat-Labs/arabic-public-data-reasoning/tree/v0.1.1" license: CC-BY-4.0 abstract: "Controlled Arabic and English numerical QA over real frozen World Bank WDI observations, with exact programs, visible source-cell evidence and economy-disjoint splits. World Bank source data retain mandatory additional terms." ''') (release / "EVALUATION.md").write_text('''# Evaluation protocol Model input consists only of `question_ar` and the parsed `context` table, plus the answer contract. `code/model_input.py` implements that boundary. Gold answer, program, operation, evidence labels, template/family IDs and diagnostic metadata are not inputs. All split gold is public, so a public test is not evidence of contamination-free evaluation. Optional `question_en` is a controlled authored counterpart; evaluate English separately with the same source cells, not as a second independent dataset. Predict one JSON object per line: `{"id":"...","answer":{"status":"ok","value":"...","unit":"..."},"evidence_ids":["..."]}`. Use a boolean for comparisons and ascending string-year arrays for ranks. Numeric values may be decimal strings; finite JSON numbers also normalize numerically. Booleans never normalize to numeric 0/1. Lookup requires exact displayed precision; derived numeric answers are rounded to six decimals, HALF_UP. Missing source cells are null; incompatible-unit outputs have null value and unit. `python code/score.py --release . --predictions predictions.jsonl --split test --output score.json` reports answer, status, value, unit, reference-evidence micro precision/recall and strict joint. Strict joint requires exact answer and the exact set of reference evidence IDs, with no duplicate/nonexistent citations. Missing prediction IDs are wrong; duplicate or unknown/out-of-scope IDs fail the entire submission. Use only IDs for the selected split and scope. `--scope shared` or `--scope diagnostic` changes the expected submission IDs. Nonstandard JSON NaN/Infinity values fail parsing; string forms fail numeric correctness. Extra answer keys fail its exact schema. Report the test shared-operator population (820 questions) separately from the second-highest-distinct-value structure diagnostic (113 questions). Include per-operator results and missing/incompatible status slices. Test has only DZA, EGY and SOM; validation has DJI, KWT and SAU. Do not report 933 unrelated independent samples: questions share cells, series and templates. Cluster uncertainty at economy or connected source-cell level; three test clusters are a severe limitation. A single aggregate score can hide lookup simplicity and rare abstention targets. Source-cell references are a software program read set. Every displayed cell is evidence for its question, so citing all displayed cells passes the evidence criterion. This does not test distractor rejection, retrieval quality, minimal human proof or internal reasoning faithfulness. No explanations/chain-of-thought text is scored or required. The supplied first-cell baseline reads the first visible cell and returns its recorded value without understanding the question. The symbolic baseline reads only the whitelisted input, identifies one of the declared controlled Arabic templates, and runs exact arithmetic; all template/operator forms, including the test diagnostic, are explicitly implemented. It is a programmed format ceiling, not a learned-model, unknown-template or production result. Neither baseline calls a model or uses a paid API. ''') examples = [json.loads(line) for line in (release / "examples.jsonl").read_text().splitlines()] payload = json.dumps(examples, ensure_ascii=False).replace("<", "\\u003c") page = '''Arabic Public Data Reasoning — Bayanat Labs

Bayanat Labs · Open datasets

Arabic Public Data Reasoning

Inspect actual controlled questions over real frozen World Bank observations. This tiny embedded sample is not full-corpus search. Arabic source names are preserved; navigation and explanations default to English.

6,419 generated tasks · 4,400 real source cells · 22 economies · eight indicators · 2000–2024. Questions and software labels have no human linguistic/statistical validation. No LLM score is claimed.

Cell IDEconomyIndicatorYearExact displayed valueUnit

Download dataset · Source and verification · World Bank source terms

Data/annotations: CC BY 4.0 with mandatory World Bank source terms; code: Apache-2.0. Credit World Bank WDI and each series provider. Neither endorses this adaptation.

'''.replace('PAYLOAD', payload) page = page.replace('World Bank source terms', 'Series providers and source evidence · World Bank source terms') (release / "explorer.html").write_text(page) demo = project / "demo" demo.mkdir(exist_ok=True) (demo / "index.html").write_text(page) (demo / "README.md").write_text('''--- title: Arabic Public Data Reasoning emoji: 📊 colorFrom: green colorTo: blue sdk: static app_file: index.html pinned: false license: apache-2.0 --- # Bayanat Arabic Public Data Reasoning — actual sample explorer This static sample shows 11 actual question records, source cells, computed answers and programs from the 6,419-task dataset. It is not full-corpus search. Primary navigation is English; original Arabic source names and controlled Arabic questions are preserved. Questions/annotations were generated with software and AI-assisted templates, with no human linguistic/statistical review established. No LLM score is claimed. [Dataset and full source/provider attribution](https://huggingface.co/datasets/Bayanat-Labs/arabic-table-reasoning) · [Bayanat release page](https://www.bayanatlabs.com/open/arabic-public-data-reasoning) · [Source code](https://github.com/Bayanat-Labs/arabic-public-data-reasoning/tree/v0.1.1) HTML/JavaScript code: Apache-2.0 (`LICENSE`). Embedded observations: World Bank WDI, CC BY 4.0 with mandatory additional World Bank source terms. Original templates/annotations/documentation: CC BY 4.0. See `DATA_LICENSE.md`, `ATTRIBUTION.md`, and the full dataset's `SOURCES.md` for individual providers and license evidence. World Bank and providers do not endorse this adaptation. No remote scripts, models, API keys or network data fetches are required by this explorer. ''') for name in ("DATA_LICENSE.md", "ATTRIBUTION.md"): shutil.copyfile(release / name, demo / name) shutil.copyfile(project / "code" / "LICENSE", demo / "LICENSE") (demo / ".gitattributes").write_text("*.parquet filter=lfs diff=lfs merge=lfs -text\n") (release / ".gitattributes").write_text("*.parquet filter=lfs diff=lfs merge=lfs -text\n") print(json.dumps({"readme_bytes": len(readme.encode()), "explorer_examples": len(examples), "release": str(release)})) if __name__ == "__main__": main()