Add CTU catalogue parser and research contract
parse_catalog.py turns a saved copy of the CTU Mobility catalogue (FEL, Master, 2027/28) into data/catalog.json: 186 agreements merged into 170 schools. research/BRIEF.md is the contract for per-school research (JSON shape, scoring anchors, source rules); validate_research.py enforces its structure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gXkMmmRRKLSnY6vQN3
This commit is contained in:
parent
fcfb2bcd87
commit
3980fbd62b
16 changed files with 16805 additions and 0 deletions
39
scripts/make_assignments.py
Normal file
39
scripts/make_assignments.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Split data/catalog.json into per-region research assignments.
|
||||
|
||||
Usage: python3 -I scripts/make_assignments.py
|
||||
Writes research/assignments/<group>.json - one file per research agent.
|
||||
Grouping by region lets one researcher reuse city/country context.
|
||||
"""
|
||||
import json
|
||||
from collections import Counter
|
||||
|
||||
GROUPS = {
|
||||
"germany": ["Germany"],
|
||||
"alps-benelux": ["Austria", "Switzerland", "Belgium", "Netherlands"],
|
||||
"france": ["France"],
|
||||
"nordic-atlantic": ["Sweden", "Norway", "Denmark", "Finland", "Iceland", "Ireland"],
|
||||
"central-east-europe": ["Croatia", "Slovenia", "Slovakia", "Hungary", "Poland", "Romania",
|
||||
"Bulgaria", "Ukraine", "Estonia", "Lithuania"],
|
||||
"south-europe": ["Spain", "Italy", "Portugal", "Greece", "Türkiye"],
|
||||
"korea": ["Korea (the Republic of)"],
|
||||
"taiwan-china": ["Taiwan", "China"],
|
||||
"asia-other": ["Japan", "Singapore", "Thailand", "Viet Nam", "Indonesia", "India"],
|
||||
"anglo-overseas": ["United States of America", "Canada", "Australia"],
|
||||
"latin-america": ["Mexico", "Brazil", "Argentina", "Chile", "Colombia", "Costa Rica",
|
||||
"Peru", "Uruguay", "Venezuela"],
|
||||
}
|
||||
|
||||
catalog = json.load(open("data/catalog.json", encoding="utf-8"))
|
||||
by_country = {c: g for g, cs in GROUPS.items() for c in cs}
|
||||
missing = {s["country"] for s in catalog["schools"]} - set(by_country)
|
||||
assert not missing, f"countries without a group: {missing}"
|
||||
|
||||
counts = Counter()
|
||||
for group in GROUPS:
|
||||
schools = [s for s in catalog["schools"] if by_country[s["country"]] == group]
|
||||
counts[group] = len(schools)
|
||||
with open(f"research/assignments/{group}.json", "w", encoding="utf-8") as f:
|
||||
json.dump({"group": group, "schools": schools}, f, ensure_ascii=False, indent=1)
|
||||
f.write("\n")
|
||||
print(dict(counts), "total", sum(counts.values()))
|
||||
Loading…
Add table
Add a link
Reference in a new issue