Conversation
|
I'm not sure if I like storing data as a JSON string on the course object. It seems like it's a little hacked on when using a RDBMS. An improvement might be to make another model to store that information. Doing it that way would also have the advantage of being able to directly get the prerequisites for any given course instead of having to get the course object, get the I'm also a little wary of using something as heavy as a LLVM translation of a C application to JS. We can't have people downloading ~2MB of Javascript just to view a graph. Is there some way to do more of the work in Python and only do the final rendering with some lighter JS? I'm pretty sure the webhost won't allow installation of arbitrary packages, so installing GraphViz probably isn't possible (@ChrisCooper confirm?). Another option would be to use D3.js to render, as it's pretty light (140KB, uncompressed). That being said, I really like the idea here and the generated graph looks really cool (if a little confusing at first glance). I think it could be a really nice addition to the site. |
|
It shouldn't be to big of a deal to use foreign keys instead of the json object. D3 could work, but I haven't done any work with it before. I'll look into making a simple force directed layout tonight after work. I worry that it will look even more confusing than the graphviz one though, as graphviz makes an effort to keep things in a hierarchy. I only wonder what the advantage of moving the from json to a series of tables is, I worry that instead of making it any easier it will simply make it more of a pain to modify a course's prerequisites as multiple different rows in different tables will need to be modified. I agree that viz.js is a bad solution. Gzipped it takes 600k of space, which is still a bit absurd. Graphviz would be the best solution IMO, but if webfaction doesn't allow for arbitrary binary installs, I don't suppose we have much of a choice. I'll post pictures of the d3 solution once I get it up, I should have a prototype by this evening I hope. If we decide to go the rdbms route with the tables I will work on that another time, it will be a bit more work to transition to that. |
|
I did a quick shot at making a graph layout using D3.js. The same graph which you see above currently looks something like this with a force-directed layout. It feels a bit noisy, especially for a complicated prerequisite tree like BCHM 410. Also, the course of interest is just placed randomly in the frame, meaning that I had to color it differently so that you could identify it at all. Personally I prefer the appearance of the graphviz solution, but I understand that it is likely impractical. Also you can drag this one around, good old fashioned D3 style. I based the code to get that off of this example. EDIT: Found another promising option: dagre. I will need to modify the dot output & generate some CSS, but other than that it should work pretty well (theoretically). |
|
Nice, looks awesome! It seems like most of the stylistic properties can be set via CSS too so the look can be customized later if needed. The most important thing is that it's fast and light. |
|
Yes, the style can be changed using CSS and small Python code changes if needed. In terms of things I would like to fix before this is merged, there are likely a few code quality problems (e.g. I am not proud of the parser, it is poorly designed IMO), and I am still using the JSON field on the model. If we decide to use a rdbms system, I guess we would merge the current prerequisite parser into this one, such that the models could be merged as well. That shouldn't be too difficult to do (however it is likely that this parser captures less courses than the current one). I don't have time to look into that right now, but in the coming weeks I will try to find time to make these changes. If I make this change, the prerequisite parser will probably be separate from the scraping process, hopefully this isn't too much of an issue, I could possibly make it automatically run after the parser. |
|
This is amazing work, you guys. I'm one of Chris's friends who's been following and helping out with qcumber with anything that doesn't involve computer knowledge ... because I have none (unless you count CISC 100 lol). I think this visualization project has really great potential. My wheels are already spinning and once this gets off the ground, I'm sure I'll have lots more ideas as to where to go from here (as Chris can attest to, lols). The main concern I have right now is readability. Visually it looks logical, but tracing the path from a first year course to the upper year courses gets confusing at the junctions with multiple exits, or when AND leads to OR. There should be some kind of highlighting mechanism to delineate one path separate from the others. Great work! I'll be lurking and periodically offering opinions and encouragement :) |
|
I agree, it can be confusing to traverse visually, once I switch the backend to using RDBMS, I will look into implementing something like that. It shouldn't be too difficult to do. |
|
Another thing that might help with readability (since some of these graphs are by nature quite complex) is to be able to limit it to a number of steps backward. For example, the BCHM 315 example could be optionally limited to MBIO 218, BCHM 218, CHEM 222, CHEM 223, and CHEM 282, since these are the first courses you encounter along that chain. |
|
I am not sure whether that would be a good idea. The primary reason which I can think of for viewing these graphs is to see what first, second & third year courses you need to take in order to take a fourth year class which you are interested in. If we limited how far back you can go, I feel like that would defeat the purpose. |


Fixes #89
Features
Parses Prerequisite text to determine prerequisites, corequisites, recommended courses, and exclusions
This produces JSON which is entered into the
parsed_reqsfield on the Course object.The following is BCHM 410's JSON:
{ "prerequisite": { "items": [ "BCHM 313", "BCHM 315", "BCHM 316", "BCHM 317", { "items": [ "BCHM 218", "MBIO 218" ], "type": "or" } ], "type": "and" } }And BIOL 410
{ "prerequisite": { "items": [ "BIOL 302", "BIOL 303" ], "type": "or" }, "recommend": { "items": [ "BIOL 335" ], "type": "and" } }Generates dotfile code for a specific course's prerequisites
BCHM 410:
This is then rendered, either using Viz.js on the client (this branch) or using GraphViz through pydot on the server this branch. This gets you a result like the following:
Small link to visualize the prerequisite graph on the course's detail page
Decisions to be made before merging
Testing status
ABC xxx and ABC yyy or ABC zzzorABC xxx; yyy; zzz). Not sure how to fix either of these problems.