import json
from collections import Counter
todo = json.load(open('todo_upgrade.json', encoding='utf-8'))
c = Counter(t['s'] for t in todo)
print('todo by school:')
for k, v in sorted(c.items(), key=lambda x: -x[1]):
    print(f'  {k}: {v}')
print()
for sc in ['duke','cmu','dartmouth','geo','brown','emory','notre','vanderbilt','rice','wustl','cornell','mit','princeton','harvard','yale','caltech','stanford','berkeley','ucla','unc','gatech','ucsd','usc','nyu','col','up','jhu','nu','illinois','uchicago','uva','ubc','mcg','uw','ut','umich']:
    items = [t for t in todo if t['s'] == sc]
    if items:
        print(f'=== {sc} ({len(items)}) ===')
        for t in items[:10]:
            cn = t.get('cn') or t.get('n') or ''
            en = t.get('en', '')
            deg = t.get('deg', '')
            disc = t.get('disc', '')
            col = t.get('col', '')
            print(f'  - {cn} | {en} | {deg} | {disc} | {col}')
