#!/usr/bin/env python3 """Write the dataset card (README.md) and the per-environment index files (data//.jsonl) from environments.json and tasks.jsonl. Run after tools/export.py.""" import json, os, shutil ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ISCED = {"0232": "Literature and linguistics", "0414": "Marketing and advertising", "0522": "Natural environments and wildlife", "0723": "Textiles (clothes, footwear and leather)", "0812": "Horticulture", "0831": "Fisheries", "1021": "Community sanitation", "0111": "Education science", "0222": "History and archaeology", "0223": "Philosophy and ethics", "0311": "Economics", "0312": "Political sciences and civics", "0313": "Psychology", "0314": "Sociology and cultural studies", "0521": "Environmental sciences", "0721": "Food processing", "0731": "Architecture and town planning", "0821": "Forestry", "0913": "Nursing and midwifery", "0923": "Social work and counselling", "1022": "Occupational health and safety"} envs = sorted(json.load(open(os.path.join(ROOT, "environments.json"))), key=lambda e: e["isced"]) tasks = [json.loads(l) for l in open(os.path.join(ROOT, "tasks.jsonl"))] shutil.rmtree(os.path.join(ROOT, "data"), ignore_errors=True) for e in envs: for split in ("train", "eval"): p = os.path.join(ROOT, "data", e["name"], split + ".jsonl"); os.makedirs(os.path.dirname(p), exist_ok=True) with open(p, "w") as f: for t in tasks: if t["env"] == e["name"] and t["split"] == split: f.write(json.dumps({k: t[k] for k in ("id", "env", "isced_f", "family", "difficulty", "seed", "title", "instruction", "checks", "path", "languages", "task_meta")}, ensure_ascii=False) + "\n") yaml = ["---", "pretty_name: Practice", "license: mit", "language:", "- en", "- sv", "task_categories:", "- other", "tags:", "- rl-environment", "- harbor", "- agents", "- reinforcement-learning", "- verifiable-rewards", "- isced-f", "size_categories:", "- 1K