Closed edward-shen closed 6 years ago
Sounds good to me! Would definitely be interesting to see this feature too. It gets a complicated if a class has mult-tier prereqs like CHEM3431 (prereqs are (MATH 1252 or MATH 1342) and (PHYS 1147 or PHYS 1155 or PHYS 1175) and CHEM 1214). Not sure how we want to handle this. Besides that, it shouldn't be too bad.
All the data needed to add this feature is already being scraped and processed. I would start by adding another processor here: https://github.com/ryanhugh/searchneu/blob/master/backend/scrapers/classes/main.js#L203
All the data for all the classes is available at dump.classes
and we can add another property to the classes object called prereqsFor. After than, we would just need to add it to the desktop frontend and to the mobile frontend near these two places
https://github.com/ryanhugh/searchneu/blob/master/frontend/components/panels/DesktopClassPanel.js#L268 https://github.com/ryanhugh/searchneu/blob/master/frontend/components/panels/MobileClassPanel.js#L116
How about two prereq sections then? "Prerequisite for" and "Optional Prerequisite for"? For example, MATH1252 would have:
Prerequisite for: MATHxxxx
Optional Prerequisite for: CHEM3431
I don't quite know your data format yet to see if this is a viable way, but if the prereqs element of each class is structured something like:
{
"class": "CHEM3431",
...
"prereqs": [ ["MATH 1252", "MATH 1342"],
["PHYS 1147", "PHYS 1155", "CHEM 1214"],
"CHEM1214" ],
}
You could definitely parse each element of the prereqs
as a required prereq, and if the element is an array, we could interpret each element in that array as a optional prereq.
Hmmmmmmmmmmmmm yeah that sounds good to me!
Heres the data format for classes. I do need to write some more docs haha. I'll make sure to include this.
{
"lastUpdateTime": 1507424946364,
"name": "Fundamentals of Computer Science 2",
"url": "https://wl11gp.neu.edu/udcprod8/bwckctlg.p_disp_listcrse?term_in=201730&subj_in=CS&crse_in=2510&schd_in=%",
"crns": [
"30360",
"30361",
"32084",
"34197",
"36430",
"37434"
],
"honors": false,
"prereqs": {
"type": "or",
"values": [
{
"subject": "CS",
"classUid": "2500_699845913",
"classId": "2500"
}
]
},
"coreqs": {
"type": "or",
"values": [
{
"subject": "CS",
"classUid": "2511_803118792",
"classId": "2511"
}
]
},
"maxCredits": 4,
"minCredits": 4,
"desc": "Continues CS 2500. Examines ...",
"classId": "2510",
"prettyUrl": "https://wl11gp.neu.edu/udcprod8/bwckctlg.p_disp_course_detail?cat_term_in=201730&subj_code_in=CS&crse_numb_in=2510",
"termId": "201730",
"host": "neu.edu",
"subject": "CS",
"classUid": "2510_699845912"
},
And here is how the prereqs of CHEM 3431 are saved:
"prereqs": {
"type": "and",
"values": [
{
"type": "or",
"values": [
{
"subject": "CHEM",
"classUid": "1214_630725570",
"classId": "1214"
},
{
"subject": "CHEM",
"classUid": "1214_1185870472",
"classId": "1214"
},
{
"subject": "CHEM",
"classUid": "1220_645042741",
"classId": "1220"
}
]
},
{
"type": "or",
"values": [
{
"subject": "MATH",
"classUid": "1342_301790371",
"classId": "1342"
},
{
"subject": "MATH",
"classUid": "1342_1247772461",
"classId": "1342"
}
]
},
{
"type": "or",
"values": [
{
"subject": "PHYS",
"classUid": "1147_2046221749",
"classId": "1147"
},
{
"subject": "PHYS",
"classUid": "1155_521395573",
"classId": "1155"
},
{
"subject": "PHYS",
"classUid": "1165_1407358073",
"classId": "1165"
},
{
"classId": "1175",
"subject": "PHYS",
"missing": true
}
]
}
]
}
Perhaps we could add two arrays to the class object, one for future classes where this class is a required prereq and another for future classes where this class is an optional prereq. We could also start with a general prerequisites for
and expand the feature later. Open to ideas. If you (or anyone) wants to take a stab at this that would be awesome!
I'll take a shot at this, but idk when I'll be free to do so. Also open to anyone willing to help.
haha yeah no problem at all we are all busy with school and stuff. I put some effort into this over last weekend and might have some time over the next couple weeks to spend some time on this feature.
Implemented in #31. Closing!
I think a really nice feature would be to have a "Prerequisite for" section for each class. e.g. CS2500 would have a "prerequisite for" section that contains CS2510, and CS2510 would have a "prerequisite for" section for CS3200, CS3500, and other ones I can't think of. This is super useful because it'd let us traverse the requirements tree in both directions.
You could probably implement this by iterating through all the classes, and if they have a prerequisite, add that class as a requisite for in the prerequisite class: