Skip to content

Commit

Permalink
Implemented script to compile list of relevant courses
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWeng23 committed Feb 8, 2025
1 parent fe8f8d0 commit 138ee21
Show file tree
Hide file tree
Showing 3 changed files with 349 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ yarn-error.log*

.idea
.DS_Store

# ignore virtual environment
venv/
270 changes: 270 additions & 0 deletions src/classes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
Course,Professor,Emails
AEP 1100,Chris Xu,[email protected]
AEP 2170,Abigail T. Crites,[email protected]
AEP 2550,Or Katz,[email protected]
AEP 3100,Peter McMahon,[email protected]
AEP 3200,Ankit S Disa,[email protected]
AEP 3550,Valla Fatemi,[email protected]
AEP 3620,Kenji Yasuda,[email protected]
AEP 3630,Earl John Kirkland,[email protected]
AEP 4340,Lisa K. Wickham,[email protected]
AEP 4400,Jeffrey Moses,[email protected]
AEP 4450,Francesco Monticone,[email protected]
AEP 4840,David A. Hammer,[email protected]
AEP 4900,Chris Xu,[email protected]
AEP 4910,Craig J. Fennie,[email protected]
BTRY 3020,Jeremy Entner,[email protected]
BTRY 3080,Florentina Bunea,[email protected]
BTRY 4090,Marten H. Wegkamp,[email protected]
BTRY 4100,Dana Yang,[email protected]
CHEM 1008,Kris Reiser,[email protected]
CHEM 1058,Brandon Bogusz,[email protected]
CHEM 1570,Cynthia Kinsland,[email protected]
CHEM 2070,Julie Ellen Laudenschlager,[email protected]
CHEM 2080,Robert A. DiStasio,[email protected]
CHEM 2090,Youn Jue Bae,[email protected]
CHEM 2510,Cynthia Kinsland,[email protected]
CHEM 2780,Julie Ellen Laudenschlager,[email protected]
CHEM 2900,Dan Lorey,[email protected]
CHEM 3010,Dave Collum,[email protected]
CHEM 3030,H. Floyd Davis,[email protected]
CHEM 3570,Cynthia Kinsland,[email protected]
CHEM 3580,"Geoffrey Coates, Brett P. Fors","[email protected], [email protected]"
CHEM 3590,Bruce Ganem,[email protected]
CHEM 3880,Barbara A. Baird,[email protected]
CHEM 3900,Greg Ezra,[email protected]
CHEM 4100,Peter Thomas Wolczanski,[email protected]
CHEM 4210,Kyle M. Lancaster,[email protected]
CHEM 4330,Brian Crane,[email protected]
CHEM 4430,"Peng Chen, Prof.",[email protected]
CHEM 4610,Dave Collum,[email protected]
CHEM 4770,Barbara A. Baird,[email protected]
CHEM 4810,Fernando Escobedo,[email protected]
CHEM 4980,Nandini Ananth,[email protected]
CS 1110,"Michael Ryan Clarkson, Lillian Lee","[email protected], [email protected]"
CS 1112,Daisy Fan,[email protected]
CS 1132,Daisy Fan,[email protected]
CS 1133,Craig C. Frey,[email protected]
CS 1340,"Jon M. Kleinberg, Karen Levy","[email protected], [email protected]"
CS 1700,Haym B Hirsh,[email protected]
CS 1998,Walker Mcmillan White,[email protected]
CS 2043,Ronald DiNapoli,[email protected]
CS 2110,"Matthew Eichhorn, Curran Daniel Muhlberger","[email protected], [email protected]"
CS 2800,"Joe Halpern, Eva Tardos","[email protected], [email protected]"
CS 3110,Anshuman Mohan,[email protected]
CS 3152,Walker Mcmillan White,[email protected]
CS 3410,"Zachary John Susag, Hakim Weatherspoon","[email protected], [email protected]"
CS 3420,Nils Napp,[email protected]
CS 3700,Kevin Michael Ellis,[email protected]
CS 3780,"Tushaar Gangavarapu, Karthik Sridharan","[email protected], [email protected]"
CS 4090,Dexter Kozen,[email protected]
CS 4152,Walker Mcmillan White,[email protected]
CS 4220,Anil Damle,[email protected]
CS 4300,Cristian Danescu-Niculescu-Mizil,[email protected]
CS 4410,Robbert VanRenesse,[email protected]
CS 4411,"Yu-Ju Huang, Robbert VanRenesse","[email protected], [email protected]"
CS 4450,Rachit Agarwal,[email protected]
CS 4670,"Bharath Hariharan, Wei-Chiu Ma","[email protected], [email protected]"
CS 4701,Kevin Michael Ellis,[email protected]
CS 4740,"Claire T. Cardie, Tanya Goyal","[email protected], [email protected]"
CS 4744,Mats Rooth,[email protected]
CS 4754,Malte F Jung,[email protected]
CS 4756,Kuan Fang,[email protected]
CS 4758,Anastasia Sergeyevna Bizyaeva,[email protected]
CS 4782,"Jennifer J. Sun, Kilian Quirin Weinberger","[email protected], [email protected]"
CS 4789,Wen Sun,[email protected]
CS 4810,Dexter Kozen,[email protected]
CS 4813,Nicholas Perry Spooner,[email protected]
CS 4820,Michael PumShin Kim,[email protected]
CS 4850,Robert David Kleinberg,[email protected]
CS 4852,Cristobal Cheyre Forestier,[email protected]
CS 4997,Lillian Lee,[email protected]
CS 4998,Andrew C. Myers,[email protected]
CS 4999,Wen Sun,[email protected]
ECE 2100,Carl Bernard,[email protected]
ECE 2300,Zhiru Zhang,[email protected]
ECE 2400,Anne Bracy,[email protected]
ECE 2720,Vikram Krishnamurthy,[email protected]
ECE 3100,Qing Zhao,[email protected]
ECE 3140,Nils Napp,[email protected]
ECE 3150,Amit Lal,[email protected]
ECE 3200,Ziv Goldfeld,[email protected]
ECE 4070,Debdeep Jena,[email protected]
ECE 4150,David Lee Hysell,[email protected]
ECE 4160,Elizabeth Farrell Helbling,[email protected]
ECE 4180,Anastasia Sergeyevna Bizyaeva,[email protected]
ECE 4210,Francesca Parise,[email protected]
ECE 4271,David Forbes Delchamps,[email protected]
ECE 4361,H. Grace Xing,[email protected]
ECE 4370,Karan Kartik Mehta,[email protected]
ECE 4380,Francesco Monticone,[email protected]
ECE 4520,Lang Tong,[email protected]
ECE 4590,R. B. van Dover,[email protected]
ECE 4670,Aaron B. Wagner,[email protected]
ECE 4740,Alyosha Christopher Molnar,[email protected]
ECE 4760,Van Hunter Adams,[email protected]
ECE 4840,David A. Hammer,[email protected]
ECE 4910,Bruce Raymond Johnson,[email protected]
ECE 4920,Van Hunter Adams,[email protected]
ECE 4998,Christopher Batten,[email protected]
ECE 4999,Jayadev Acharya,[email protected]
ECON 1001,Albert W. Alexander,[email protected]
ECON 1002,Albert W. Alexander,[email protected]
ECON 1110,George Orlov,[email protected]
ECON 1120,Fikri Pitsuwan,[email protected]
ECON 2100,Douglas M. McKee,[email protected]
ECON 2300,Arnab K. Basu,[email protected]
ECON 3030,Philipp Kircher,[email protected]
ECON 3040,Mathieu Taschereau-Dumouchel,[email protected]
ECON 3110,Kevin C Packard,[email protected]
ECON 3120,Douglas M. McKee,[email protected]
ECON 3140,Joerg Stoye,[email protected]
ECON 3280,Milena Nikolaeva Djourelova,[email protected]
ECON 3430,Stephanie R Thomas,[email protected]
ECON 3475,Michele Belot,[email protected]
ECON 3550,Elizabeth Jane Tennant,[email protected]
ECON 3670,Brandon K Tripp,[email protected]
ECON 3711,John Cawley,[email protected]
ECON 3770,Evan Riehl,[email protected]
ECON 3825,Cristobal Cheyre Forestier,[email protected]
ECON 3860,C.-Y. Cynthia Lin Lawell,[email protected]
ECON 3865,Shanjun Li,[email protected]
ECON 4020,Lawrence Edward Blume,[email protected]
ECON 4210,Kristoffer Nimark,[email protected]
ECON 4270,Stephen Coate,[email protected]
ECON 4280,Milena Nikolaeva Djourelova,[email protected]
ECON 4600,Levon Barseghyan,[email protected]
ECON 4620,Adam Harris,[email protected]
ECON 4660,Ted O'Donoghue,[email protected]
ECON 4903,Eleonora Patacchini,[email protected]
ECON 4997,Terence Michael Murphy,[email protected]
ECON 4999,Anran Li,[email protected]
INFO 1260,"Jon M. Kleinberg, Karen Levy","[email protected], [email protected]"
INFO 1300,Royal Westwater,[email protected]
INFO 1998,Walker Mcmillan White,[email protected]
INFO 2310,Kyle J. Harms,[email protected]
INFO 2951,Benjamin Soltoff,[email protected]
INFO 3130,Moon Duchin,[email protected]
INFO 3140,Shimon Edelman,[email protected]
INFO 3152,Walker Mcmillan White,[email protected]
INFO 3200,Claire Wardle,[email protected]
INFO 3312,Benjamin Soltoff,[email protected]
INFO 3950,Paul Ginsparg,[email protected]
INFO 4100,Rene Kizilcec,[email protected]
INFO 4120,Cheng Zhang,[email protected]
INFO 4152,Walker Mcmillan White,[email protected]
INFO 4220,Cristobal Cheyre Forestier,[email protected]
INFO 4250,Daniel Susser,[email protected]
INFO 4260,Steven J. Jackson,[email protected]
INFO 4300,Cristian Danescu-Niculescu-Mizil,[email protected]
INFO 4310,Jeff Rzeszotarski,[email protected]
INFO 4320,Francois V. Guimbretiere,[email protected]
INFO 4340,Kyle J. Harms,[email protected]
INFO 4360,Drew Margolin,[email protected]
INFO 4400,Gilly Leshed,[email protected]
INFO 4410,Malte F Jung,[email protected]
INFO 4450,Susan R. Fussell,[email protected]
INFO 4900,Yian Yin,[email protected]
INFO 4910,Benjamin Soltoff,[email protected]
INFO 4940,Sharlane S. Cleare,[email protected]
INFO 4997,Lawrence Edward Blume,[email protected]
INFO 4998,Walker Mcmillan White,[email protected]
MATH 1006,Doug Knowles,[email protected]
MATH 1011,Doug Knowles,[email protected]
MATH 1012,Melanie Clemens Fraser,[email protected]
MATH 1021,Melanie Clemens Fraser,[email protected]
MATH 1106,Marie MacDonald,[email protected]
MATH 1110,Hosea D. Wondo,[email protected]
MATH 1120,Luke Stephen Serafin,[email protected]
MATH 1340,Matthew R. Haulmark,[email protected]
MATH 1910,Timothy James Healey,[email protected]
MATH 1920,Sergio Chaves,[email protected]
MATH 2210,Benjamin E Dozier,[email protected]
MATH 2220,Justin Tatch Moore,[email protected]
MATH 2240,Jason F. Manning,[email protected]
MATH 2310,Alex John Townsend,[email protected]
MATH 2930,David R. Freund,[email protected]
MATH 2940,Frans Schalekamp,[email protected]
MATH 3040,Anil Nerode,[email protected]
MATH 3110,Timothy R. Riley,[email protected]
MATH 3320,Dan Mihai Barbasch,[email protected]
MATH 3340,Rachel M. Webb,[email protected]
MATH 3360,Karola Meszaros,[email protected]
MATH 4030,Anil Nerode,[email protected]
MATH 4130,Slawomir Solecki,[email protected]
MATH 4140,Xin Zhou,[email protected]
MATH 4180,Chun Pong Chu,[email protected]
MATH 4200,John Hamal Hubbard,[email protected]
MATH 4260,Anil Damle,[email protected]
MATH 4280,Alexander B. Vladimirsky,[email protected]
MATH 4310,Andreea Iorga,[email protected]
MATH 4340,Martin Kassabov,[email protected]
MATH 4500,James Edward West,[email protected]
MATH 4540,Xiaodong Cao,[email protected]
MATH 4710,Laurent Pascal Saloff-Coste,[email protected]
MATH 4720,Marten H. Wegkamp,[email protected]
MATH 4740,Sungwoo Jeong,[email protected]
MATH 4900,Marcelo Aguiar,[email protected]
MATH 4901,Marcelo Aguiar,[email protected]
MATH 4980,Mary Ann Huntley,[email protected]
ORIE 3120,Peter Frazier,[email protected]
ORIE 3310,David B. Shmoys,[email protected]
ORIE 3510,Jim Dai,[email protected]
ORIE 3741,Soroosh Shafiee,[email protected]
ORIE 4126,Eric Lewis Gentsch,[email protected]
ORIE 4130,Shane G. Henderson,[email protected]
ORIE 4152,Negin Majedi,[email protected]
ORIE 4160,Paul Leon Golz,[email protected]
ORIE 4600,John Richard Callister,[email protected]
ORIE 4742,Sid Banerjee,[email protected]
ORIE 4990,David B. Shmoys,[email protected]
ORIE 4999,Brenda Lynn Dietrich,[email protected]
PHYS 1012,Jim Baker,[email protected]
PHYS 1013,Jim Baker,[email protected]
PHYS 1102,Nam Jung Kim,[email protected]
PHYS 1110,Cristina Schlesier,[email protected]
PHYS 1112,Philip D. Krasicky,[email protected]
PHYS 1116,Csaba Csaki,[email protected]
PHYS 1203,Nils Deppe,[email protected]
PHYS 2208,Matthias Ulf Liepe,[email protected]
PHYS 2210,Cristina Schlesier,[email protected]
PHYS 2213,Ryan Christopher Tapping,[email protected]
PHYS 2214,Itai Cohen,[email protected]
PHYS 2216,Eunah Kim,[email protected]
PHYS 2217,Abigail T. Crites,[email protected]
PHYS 2218,Liam McAllister,[email protected]
PHYS 3310,"Jim Alexander, Kyle M. Shen","[email protected], [email protected]"
PHYS 3316,Xiaomeng Liu,[email protected]
PHYS 3318,Ivan Bazarov,[email protected]
PHYS 3360,Earl John Kirkland,[email protected]
PHYS 4400,Anders Ryd,[email protected]
PHYS 4410,Anders Ryd,[email protected]
PHYS 4443,Katja C. Nowack,[email protected]
PHYS 4444,Yuval Grossman,[email protected]
PHYS 4484,Robert Edward Thorne,[email protected]
PHYS 4485,Jim Baker,[email protected]
PHYS 4486,Nam Jung Kim,[email protected]
PHYS 4487,Nam Jung Kim,[email protected]
PHYS 4488,James Patarasp Sethna,[email protected]
PHYS 4490,Eanna E. Flanagan,[email protected]
PHYS 4499,Tomas A. Arias,[email protected]
PHYS 4688,Georg Heinz Hoffstaetter de Torquat,[email protected]
STSCI 2100,Jeremy Entner,[email protected]
STSCI 2110,Kevin C Packard,[email protected]
STSCI 2150,Melissa Smith,[email protected]
STSCI 3080,Florentina Bunea,[email protected]
STSCI 3110,Kevin C Packard,[email protected]
STSCI 3200,Jeremy Entner,[email protected]
STSCI 3510,Jim Dai,[email protected]
STSCI 3600,M. Elizabeth Karns,[email protected]
STSCI 3740,Yang Ning,[email protected]
STSCI 4090,Marten H. Wegkamp,[email protected]
STSCI 4100,Dana Yang,[email protected]
STSCI 4520,David Kent,[email protected]
STSCI 4550,Younghoon Kim,[email protected]
STSCI 4850,Sreyoshi Das,[email protected]
STSCI 4970,Martin Timothy Wells,[email protected]
STSCI 4980,Martin Timothy Wells,[email protected]
STSCI 4990,Martin Timothy Wells,[email protected]
STSCI 4995,Sreyoshi Das,[email protected]
STSCI 4999,Martin Timothy Wells,[email protected]
76 changes: 76 additions & 0 deletions src/scripts/course-scrape.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import requests
import csv
import json

def grab_json(url):
return json.loads(requests.get(url).text)

rosterURL = "https://classes.cornell.edu/api/2.0/config/rosters.json"
rosters = grab_json(rosterURL)['data']['rosters']
# Get the most recent semester from the json
# Note that slug is sem/year (e.g SP25)
roster = rosters[-1]['slug']
# If the most recent semester is a WINTER or SUMMER sem, use the sem before it
if "WI" in roster or "SU" in roster:
roster = rosters[-2]['slug']

# Get all subjects for that semester
subjectsURL = "https://classes.cornell.edu/api/2.0/config/subjects.json?roster="+roster
subjects = grab_json(subjectsURL)['data']['subjects']

relevent_courses = [
'CS',
'BTRY',
'INFO',
'ORIE',
'ECON',
'PHYS',
'CHEM',
'ECE',
'AEP',
'BIO',
'MATH',
'STSCI'
]

classesJSON = []
for s in subjects:
if s['value'] in relevent_courses:
classURL = "https://classes.cornell.edu/api/2.0/search/classes.json?roster="+roster+"&subject=" + s['value']
classesJSON.extend(grab_json(classURL)['data']['classes'])

def getProfessorName(instructors):
accum_names = "" # To accumulate all the professor names
accum_emails = "" # To accumulate all the professor emails
for professor in instructors:
# Handle middle name if exists
middleName = professor['middleName'] + " " if professor['middleName'] else ""
name = professor['firstName'] + " " + middleName + professor['lastName'] + ", "
email = professor['netid'] + '@cornell.edu' + ", "
accum_names += name
accum_emails += email
# Remove preceding and trailing , and "
return accum_names.strip(', ').strip('\"'), accum_emails.strip(', ').strip('\"')

classes = []
for c in classesJSON:
instructors = c['enrollGroups'][0]['classSections'][0]['meetings'][0]['instructors']
names, emails = getProfessorName(instructors)
hasProfessor = names != ""
isUndergrad = int(c['catalogNbr']) < 5000
item = {
'Course': c['subject'] + " " + c['catalogNbr'],
'Professor': names,
'Emails': emails
}
classes.append(item) if hasProfessor and isUndergrad else None

with open('../classes.csv', 'w') as file:
field = ["Course", "Professor", "Emails"]
writer = csv.DictWriter(file, fieldnames=field)

# Write header
writer.writeheader()

# Write rows to the CSV
writer.writerows(classes)

0 comments on commit 138ee21

Please sign in to comment.