import json, re
todos = json.load(open('todo_upgrade.json', encoding='utf-8'))
html = open('index_main.html', encoding='utf-8').read()
done = set(re.findall(r'\{id:"([^"]+)"', html))
print('done count:', len(done))
kw = ['biomedical','chemical engineering','materials science','materials engineering','operations research','aerospace','aeronautical','astronautical','nuclear engineering','civil engineering','environmental engineering','industrial engineering','systems engineering','engineering mechanics']
cand = []
for t in todos:
    en = (t.get('en','') or '').lower()
    deg = (t.get('deg','') or '').lower()
    if 'phd' not in deg and 'doctor' not in deg and 'ph.d' not in deg:
        continue
    if not any(k in en for k in kw):
        continue
    det = (t.get('det','') or t.get('url','') or '').replace('details/','').replace('.html','')
    if det and det in done:
        continue
    cand.append(t)
print('cand PhD remaining:', len(cand))
for c in cand[:40]:
    print(c.get('s'), '|', c.get('deg'), '|', (c.get('en') or '')[:90], '|', (c.get('cn') or '')[:30])
