nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.
https://nusmods.com
MIT License
588 stars 319 forks source link

Filter out Modules that offer Evening Classes #3285

Open thebirdgr opened 3 years ago

thebirdgr commented 3 years ago

Feature Request

So some of us go for semester long Industrial Attachments as part of our curriculum. And during those semesters, we have extra MCs that we can take and would like to fill them up with some classes. But the thing is, there is no way to search for evening modules. It's only that your own home Faculty emails you the list. But sometimes you want to clear modules from other faculties/departments too. And finding their list is a hassle as they have different websites.

Describe the solution you'd like

Since NUSMODS has all the information of modules, we could add an extra filter that will show modules that offer classes after 18:00, as that's what the University considers as an evening class. And this would apply to all faculties, and we can browse at our whim.

Describe alternatives you've considered

Right now, trying to compile a pdf list that contains the module timings released from various faculties. But this is a slow process as we have to reach out on platforms such as Reddit and wait for students to send in the files. "Ctrl-F" is a nice feature on Pdfs, but I think we can do better.

Additional context

Not any. Just want a filter button to filter the evening modules, that's all! Thanks y'all! =)

chrisgzf commented 3 years ago

Hey @thebirdgr, thanks for the feature request!

Just so that we can refine what we should constitute as a "evening class", do you mind sharing or directing me to information about "classes after 18:00, as that's what the University considers as an evening class"?

Specifically, we need to know what NUS constitutes as an evening class for us to write the filtering logic. e.g. Do all lectures/tutorials/sectional teaching sessions have to be after 1800 to be considered an "evening class"? What if a module has a 2 lecture options, one after 1800, one at 1200. Will that mod be counted as a "evening class", etc. etc.

thebirdgr commented 3 years ago

Hello @chrisgzf,

I cannot find any NUS website that has information on what constitutes as an evening module. Because it's mainly based on the emails that they've sent to students.

So based on the email, here are the assumptions:

I hope this information is enough to implement this feature. Right now we're running a python script to call the API and register for classes, all based on the above assumptions. Thanks!

chrisgzf commented 3 years ago

@thebirdgr nice! That's very useful. Do you mind sharing the python script?

thebirdgr commented 3 years ago

@chrisgzf Sorry for the late reply!

This script was written by : @yanquantan

EDIT: The code doesn't fit in the code block for some reason, but it's everything below this line.

` import requests import pprint import pickle5 as pickle

AY = "2021-2022" sem = 2 cutoffTime = 1800

x = requests.get("https://api.nusmods.com/v2/" + AY + "/moduleList.json") moduleList = x.json()

wantedMods = {} count = 0

for mod in moduleList: modCode = mod["moduleCode"]

modNum = "".join(char for char in modCode if char.isdigit())

if int(modNum) < 5000:
    x = requests.get("https://api.nusmods.com/v2/" + AY + "/modules/" + modCode + ".json")
    modInfo = x.json()

    for modInfoBySem in modInfo["semesterData"]:
        if modInfoBySem["semester"] == sem:
            for lesson in modInfoBySem["timetable"]:
                if int(lesson["startTime"]) > cutoffTime - 1:
                    wantedMods[modCode] = modInfoBySem
                    count += 1
                    print(count)

print(wantedMods.keys()) try: geeky_file = open("geekyfile", "wb") pickle.dump(wantedMods.keys(), geeky_file) geeky_file.close()

except: print("Something went wrong") `

MarcusGitty commented 1 month ago

@thebirdgr Thank you for the python script !! It works and will help in my search !

thebirdgr commented 1 month ago

@MarcusGitty Glad it still does! It's even been a year since I've graduated.