import json, re
with open('todo_upgrade.json','r',encoding='utf-8') as f:
    todos = json.load(f)
with open('index_main.html','r',encoding='utf-8') as f:
    html = f.read()
existing_en = set(re.findall(r'en:"([^"]+)"', html))
existing_ids = set(re.findall(r'\{id:"([^"]+)"', html))
print('existing programs:', len(existing_en))
physics = [t for t in todos if isinstance(t,dict) and t.get('deg','').lower() in ('phd','ph.d.','doctor of philosophy') and re.search(r'physics|astronomy|astrophysics|applied physics|nuclear physics', t.get('en',''), re.I)]
cand = [t for t in physics if t.get('en','') not in existing_en]
print('physics PhD candidates remaining:', len(cand))
for t in cand[:30]:
    print(' -', t.get('s'), '|', t.get('en','')[:90], '|', t.get('deg'))
