Inspiration
All of our team members have encountered some stress while trying to plan our education path at UofA. We've all been there; at 2 AM, or in a really boring statistics course, scrolling through the UAlberta course catalog and trying to track prerequisites for future courses. Because it is typically onerous and time consuming to ensure all prerequisites have been met, our team wanted to streamline this process, allowing users to switch from pen and paper to a single button click that shows them everything they need to know.
What it does
Our project is a website specially created for the University of Alberta course catalog. A user can input their class code, such as "MATH 315", and it will generate a flowchart of all of the pre-requisite classes it needs starting from the first year entry classes. For example, with MATH 315, it will show MATH 214 as a pre-req, MATH 136, 146, or 156 as pre-reqs for MATH 214, all the way to the entry level MATH courses.
How we built it
We built the project on a Python backend that goes to the UAlberta course catalog for a given course name and scrapes the data from it. It then breaks down the text into the relevant course prerequisites and will go to every course catalog website for those repeating the process. After a map of all of the required courses is created, the information is fed into our website that will display the information in a concise and visually appealing way.
Challenges we ran into
Parsing:
In scraping data from the course catalog, we ran into inconsistencies in the formatting of how prerequisites were listed: for example, in "MATH 100, 114, 117, 134, 144, or 154", the course name is listed only once. The semicolon and the word "and" are used interchangeably at times, and there are many "or" cases involved: for example, MATH 154, 144, 134 are all equivalent. Some courses have ambiguous or non-UofA prereqs, like "Mathematics 30-1", or "3 credits of Junior ENGL". Sorting through this syntax led to a lot of parsing and edge cases.
Accomplishments that we're proud of
Parsing:
We used a stack to store course names and attach them to course numbers: for example, consider the made-up course "MATH 999" with "Prerequisites: one of MATH 100, 114, 117, 134, 144, or 154; one of STAT 151, 161, SCI 151; and MA PH 181." Parsing through the string, we store "MATH" into the coursename stack, and for every number we encounter next, we peek into the stack for the coursename. You'll notice that "MA PH" has a space in the code: no worries! We'll hold on to "MA" and "PH" until we come across a non-uppercase word, and then push the entire code "MA PH" to the stack. Additionally, prerequisites are sorted in to "AND" and "OR" in a 2D array; all elements in inner lists are equivalents to each other.
For example, this string is returned as a tuple ('MATH 999', [['MATH 100', 'MATH 114', 'MATH 117', 'MATH 134', 'MATH 144', 'MATH 154'], ['STAT 151', 'STAT 161', 'SCI 151'], ['MA PH 181']])
Recursive solution:
We took quite a long time deciding what solution to use in order to find every single pre requisite for a given class. We eventually decided on a recursive solution that will start from the main course and go to each pre-requisite to find those pre-requisites until it reaches a base case of a class that require no prior credits in classes.
Flask and Javascript:
We had to learn a new module that could interact with Javascript and Python. We decided to use Flask's API to post messages encrypted in JSON to a python file. From the python file we're able to decrypt the message and pass the information into the recursive solution described above.
Graphing
Using the list of courses with their dependencies, we iterated through it while saving the level in relation to the original course so that we can visualize the graph in layers. We then dump the sorted data into a JSON file so that we can read it in the javascript diagram file. Using Go.JS we create the graph and update it every time we update the corresponding JSON.
Website
We learned how to do front-end development... including centering divs.
What we learned
We learned to scrape data from a website, use Flask to create a web application with a Python backend. We learned how to parse data and we faced the notorious complexity of dealing with bugs in recursion. We learned that after 14 hours of straight coding, you'll have dreams of python and javascript syntax. Most of all, we learned how to develop projects in a group setting with an amazing team.
What's next for UAlberta Course PreReq Helper
Instead of charting prereqs for one single course, we can expand to multiple courses inputted by the user, or create a grandplan for a certain major. It would also be user-friendly and convenient to include a hyperlink to the course in the UofA catalogue in the courses diagram. If we implemented more web scraping in the course description, we could include key topics about what courses are about. Finally, if we had more time, we would make the legend also pretty pink for our "pretty" version.

Log in or sign up for Devpost to join the conversation.