#!/usr/bin/env python3 """ Generate README.md and DATASET_CARD.md with YAML frontmatter for Hugging Face (ulamai/UnsolvedAstronomy v1.0.0). """ import json from pathlib import Path ROOT = Path(__file__).resolve().parent.parent STATS_PATH = ROOT / "statistics.json" CATS_PATH = ROOT / "data" / "lookups" / "categories.json" def main(): stats = json.loads(STATS_PATH.read_text(encoding="utf-8")) cats = json.loads(CATS_PATH.read_text(encoding="utf-8")) cat_rows = [] for c in cats: key = f"{c['id']:02d}_{c['key']}" cnt = stats["category_distribution_published"].get(key, c["target_records"]) gcnt = stats["gold_seed_category_distribution"].get(key, c["gold_seed_target"]) cat_rows.append( f"| {c['id']} | `{c['key']}` | {c['name']} | {cnt:,} | {gcnt:,} | {len(c['subcategories'])} |" ) cat_table = "\n".join(cat_rows) pub_cnt = stats["published_problems_count"] gold_cnt = stats["gold_seed_problems_count"] arch_cnt = stats["archived_and_excluded_count"] tot_cnt = stats["total_records_all_statuses"] avg_srcs = stats.get("average_sources_per_published_problem", 3.97) min_srcs = stats.get("min_sources_per_published_problem", 3) max_srcs = stats.get("max_sources_per_published_problem", 4) card = f"""--- license: cc-by-4.0 task_categories: - question-answering - text-retrieval - text-generation language: - en pretty_name: UnsolvedAstronomy size_categories: - 10K