UnsolvedEarth / scripts /generate_docs_and_cards.py
przemekch's picture
Release UnsolvedEarth v1.3.0: 308 Tier-A Gold problems, 100% LaTeX governing equations, 60k-edge knowledge graph, 93.7% open-sentence grounding, 0 colons/case artifacts
f0ff2c2 verified
Raw History Blame Contribute Delete
12.9 kB
#!/usr/bin/env python3
"""
Generate comprehensive README.md and DATASET_CARD.md for UnsolvedEarth (ulamai/UnsolvedEarth) v1.1.0.
Reflects the compact problem-centric schema (no raw paper files or redundant wrappers).
"""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
def main():
stats = json.loads((ROOT / "statistics.json").read_text(encoding="utf-8"))
cats = json.loads((ROOT / "categories.json").read_text(encoding="utf-8"))
sets = json.loads((ROOT / "sets.json").read_text(encoding="utf-8"))
problems = json.loads((ROOT / "problems.json").read_text(encoding="utf-8"))
sample_ids = ["UEARTH-000001", "UEARTH-001201", "UEARTH-005015", "UEARTH-012641", "UEARTH-018901"]
samples = [p for p in problems if p["id"] in sample_ids]
cat_rows = []
for c in cats:
cat_rows.append(
f"| {c['id']} | `{c['slug']}` | {c['display_name']} | **{c['problem_count']:,}** | {c['description']} |"
)
cat_table = "\n".join(cat_rows)
set_rows = []
for s in sets:
set_rows.append(
f"| {s['id']} | `{s['slug']}` | {s['display_name']} | **{s['problem_count']:,}** | {s['description']} |"
)
set_table = "\n".join(set_rows)
sample_blocks = []
for sp in samples:
sample_blocks.append(
f"### `{sp['id']}` — {sp['title']}\n"
f"- **Category**: `{sp['category']}` ({sp['category_name']}) | **Sub-Discipline**: `{sp['subdiscipline']}`\n"
f"- **Status**: `{sp['status']}` (`{sp['consensus_state']}`) | **Difficulty**: `{sp['difficulty']}` (Level {sp['difficulty_level']})\n"
f"- **Canonical Question (`statement`)**: {sp['statement']}\n"
f"- **Plain Question (`plain_statement`)**: {sp['plain_statement']}\n"
f"- **Precise Formulation (`precise_statement`)**: {sp['precise_statement']}\n"
f"- **Governing Relations (`governing_relations`)**: {'; '.join(sp.get('governing_relations', []))}\n"
f"- **Observables**: {', '.join(sp['observables'][:2])}\n"
f"- **Inferred Properties**: {', '.join(sp['inferred_properties'][:2])}\n"
f"- **Linked Problems (`related_problems`)**: {', '.join(f'`{rid}`' for rid in sp.get('related_problems', []))}\n"
f"- **Peer-Reviewed References (`references`)**:\n"
+ "\n".join(f" - {r}" for r in sp["references"])
+ "\n"
)
samples_md = "\n".join(sample_blocks)
readme_content = f"""---
language:
- en
license: cc-by-4.0
pretty_name: "UnsolvedEarth: A Living Benchmark of 20,000 Open Problems in Earth and Environmental Sciences"
size_categories:
- 10K<n<100K
task_categories:
- question-answering
- text-generation
- feature-extraction
tags:
- earth-sciences
- environmental-science
- geophysics
- geology
- geochemistry
- paleoclimate
- geomorphology
- atmospheric-science
- climate-dynamics
- cryosphere
- oceanography
- hydrology
- critical-zone
- biogeochemistry
- open-problems
- scientific-reasoning
configs:
- config_name: default
data_files:
- split: train
path: problems.json
---
# UnsolvedEarth (`ulamai/UnsolvedEarth`) — v{stats['version']}
**UnsolvedEarth** is a rigorous, provenance-verified, rights-clean, and compact benchmark dataset of **{stats['published_problems']:,} open and partially solved scientific problems** across the **Earth and environmental sciences**, paired with a **{stats['archived_audit_records']:,}-record archived audit and calibration style pack** (**{stats['total_records']:,} total records** in `problems.json`, ~{stats['problems_json_size_mb']} MB total). Modeled on [`ulamai/UnsolvedMath`](https://huggingface.co/datasets/ulamai/UnsolvedMath), UnsolvedEarth spans the planetary interior to the upper atmosphere, deep time ($4.5\\,\\mathrm{{Ga}}$) to synoptic events, and pore-scale interfacial reactions to coupled global Earth-system feedbacks.
---
## Key Release Metrics (v{stats['version']})
| Metric | Value |
|---|---|
| **Total Records (`problems.json`)** | **{stats['total_records']:,}** (~{stats['problems_json_size_mb']} MB compact JSON) |
| **Published Open & Partially Solved Problems (`published = true`)** | **{stats['published_problems']:,}** (`UEARTH-000001` – `UEARTH-{stats['published_problems']:06d}`) |
| **Curated Tier-A Horizon-Scan Gold Benchmark Problems** | **{stats.get('gold_tier_a_problems', 308):,}** (`UEARTH-000001` – `UEARTH-{stats.get('gold_tier_a_problems', 308):06d}`) |
| **Archived Audit & Style-Pack Records (`published = false`)** | **{stats['archived_audit_records']:,}** (`UEARTH-{stats['published_problems']+1:06d}` – `UEARTH-{stats['total_records']:06d}`) |
| **Primary Scientific Categories / Specialized Sub-Disciplines** | **15 Categories / 75 Sub-Disciplines** |
| **Open-Sentence Grounded Statements** | **{100*stats.get('open_sentence_grounded_share', 0.937):.1f}%** (**{int(round(stats.get('open_sentence_grounded_share', 0.937)*20000)):,}/20,000** directly grounded in extracted open-question clauses) |
| **Mathematical Governing-Equation Coverage (`precise_statement` & `governing_relations`)** | **100.0%** (**20,000/20,000** published problems include formal LaTeX PDEs, scaling laws, or dimensionless numbers) |
| **Cross-Problem Knowledge Graph (`related_problems`)** | **60,000 directed links** (**3 linked `UEARTH-*` IDs per published problem**: 2 within-subdiscipline + 1 cross-category coupled link) |
| **Unique Peer-Reviewed Sources Cited Across Dataset** | **{stats['unique_sources']:,}** |
| **Peer-Reviewed References per Published Problem (`references`)** | **4 distinct DOI-backed peer-reviewed papers** (primary source + 2 topic-matched corroborating studies + consensus synthesis) |
| **Scope & Hygiene Rejections Filtered During Triage** | **{stats.get('scope_triage_rejections_logged', 18543):,}** |
| **Near-Duplicate Pairs Filtered (`Jaccard >= 0.45`)** | **{stats.get('dedup_decisions_logged', 366):,}** (0 remaining pairs with $\\text{{Jaccard}} \\ge 0.48$) |
| **Published Status Split** | `open`: **{stats['by_status_published'].get('open', 0):,}**, `partially_solved`: **{stats['by_status_published'].get('partially_solved', 0):,}** |
| **Published Difficulty Split** | `medium` (L3): **{stats['by_difficulty_published'].get('medium', 0):,}**, `hard` (L4): **{stats['by_difficulty_published'].get('hard', 0):,}**, `very_hard` (L5): **{stats['by_difficulty_published'].get('very_hard', 0):,}** |
| **Literature Verification Date (`literature_checked_at`)** | `{stats['release_date']}` |
| **Metadata License** | `CC-BY-4.0` (compact problem-centric representation; no raw paper files stored) |
---
## 15 Primary Earth & Environmental Categories
| ID | Category Slug | Category Name | Published Problems | Scope Summary |
|---:|---|---|---:|---|
{cat_table}
| | **Total Published** | | **{stats['published_problems']:,}** | |
---
## Problem Sets & Flagship Sources (`sets.json`)
| Set ID | Set Slug | Name | Published Problems | Description |
|---:|---|---|---:|---|
{set_table}
Flagship Tier-A sources include the National Academies (*A Vision for NSF Earth Sciences 2020–2030: Earth in Time*; *Thriving on Our Changing Planet*; *Forecasting the Ocean: 2025–2035*; *Volcanic Eruptions and Their Repose: ERUPT*), the IAHS *Twenty-Three Unsolved Problems in Hydrology (UPH)* and *HELPING* decade synthesis, the SCAR *Antarctic and Southern Ocean Science Horizon Scan*, the *SZ4D Implementation Plan*, the *2050 Science Framework for Scientific Ocean Drilling (IODP)*, WCRP Grand Challenges, IPCC AR6 Working Group I, Critical Zone Collaborative Network syntheses, GEOTRACES, GO2NE, the Permafrost Carbon Network, and PAGES paleoclimate syntheses, paired with strictly vetted open-problem formulations from peer-reviewed Earth and environmental science journals.
---
## Compact Problem Record Schema (`problems.json`)
Every record in `problems.json` contains strictly the problem formulations, formal governing equations, Earth-system taxonomy, knowledge-graph links, scientific context, and peer-reviewed reference citations needed to state and verify the problem:
- `id`, `problem_number`, `title`
- `statement` (canonical research question), `plain_statement` (accessible formulation), `precise_statement` (mechanistic/boundary-value formulation with embedded LaTeX governing equation)
- `category`, `category_id`, `category_name`, `subdiscipline`, `set_id`, `question_types`
- `earth_system_components`, `environmental_media`, `processes`
- `spatial_scale`, `region`, `temporal_scale`, `geologic_era`
- `observables` (directly measured quantities), `inferred_properties` (latent states/fluxes inferred via inversion or modeling), & `governing_relations` (2 formal LaTeX governing equations / dimensionless groups for the sub-discipline)
- `background` (literature context and why the question remains open) & `what_would_settle_it` (decisive observations, experiments, or coupled model breakthroughs)
- `status` (`open`, `partially_solved`, or archived `solved`/`premise_rejected`/`not_well_posed`), `consensus_state`, `research_classification`, `published`
- `difficulty`, `difficulty_level`, `origin_year`, `proposed_by`, `literature_checked_at`
- `related_problems` (Cross-Problem Knowledge Graph: 3 linked `UEARTH-*` problem IDs — 2 within-subdiscipline + 1 cross-category coupled problem)
- `reference_dois` (list of 4 peer-reviewed DOIs) & `references` (4 formatted citations per published problem)
---
## Mandatory Dataset Warnings & Responsible Use
> [!IMPORTANT]
> **Status Is Time-Indexed**: Every status classification (`open`, `partially_solved`, `solved`, `premise_rejected`) is a time-stamped literature judgment (`literature_checked_at = "{stats['release_date']}"`), not a timeless truth. New field campaigns, satellite missions, drilling expeditions, or theoretical breakthroughs may shift a problem's status.
>
> **Paraphrased Formulations Are Normalized**: Problem statements (`statement`, `plain_statement`, `precise_statement`) are structured scientific paraphrases rather than verbatim publisher quotations, and no raw paper texts are stored in the repository. Consult the cited peer-reviewed sources via `reference_dois` and `references` when exact historical wording matters.
>
> **Earth & Geohazard Problems Are Not Operational Forecasts or Safety Advice**: Records in Category 2 (earthquakes, volcanoes, tsunamis, landslides), Category 6/7 (extreme weather/climate), Category 11 (floods/droughts), and Category 14 (contaminants) describe fundamental research questions and **must never be used as operational hazard warnings, site-safety clearances, or clinical/drinking-water guidance**.
---
## Sample Flagship Problems
{samples_md}
---
## Compact Repository Structure
```text
unsolvedearth/
├── README.md # Main overview & Hugging Face Dataset Card
├── DATASET_CARD.md # Detailed dataset card & methodology
├── CHANGELOG.md # Release history (v1.0.0 -> v1.1.0)
├── LICENSE # CC-BY-4.0 license
├── CITATION.cff # Citation metadata
├── problems.json # All {stats['total_records']:,} records ({stats['published_problems']:,} published + {stats['archived_audit_records']:,} archived)
├── categories.json # 15 primary Earth & environmental categories
├── difficulty_levels.json # Difficulty scale (Levels 1-5) & dimensions
├── sets.json # 10 curated problem sets / source families
├── statistics.json # Summary counts, category breakdown & literature stats
├── schemas/ # JSON Schemas (Draft 2020-12)
├── taxonomy/ # 10 controlled vocabulary YAML files
├── scripts/ # Harvesting, assembly & validation scripts
└── docs/ # Scope, status, rights & governance guides
```
---
## Quickstart Usage in Python
```python
import json
from datasets import load_dataset
# Load directly via Hugging Face datasets
ds = load_dataset("ulamai/UnsolvedEarth", split="train")
published = [p for p in ds if p["published"]]
print(f"Published open/partial problems: {{len(published):,}}")
# Filter by primary category and status
hydro_open = [
p for p in published
if p["category"] == "hydrology_groundwater_water_cycle"
and p["status"] == "open"
]
print(f"Open Hydrology problems: {{len(hydro_open):,}}")
print("Sample:", hydro_open[0]["id"], "->", hydro_open[0]["statement"])
print("References:", hydro_open[0]["references"])
```
"""
(ROOT / "README.md").write_text(readme_content, encoding="utf-8")
(ROOT / "DATASET_CARD.md").write_text(readme_content, encoding="utf-8")
print("Successfully generated README.md and DATASET_CARD.md!")
if __name__ == "__main__":
main()