Irvine Scheduler at Sourceforge.net
Home | Project Home Page | Download | Discussion | Schedule Generator | Searchable Schedule
The Irvine Scheduler allows University of California, Irvine students to generate a more readable version of their course schedule from TELE and to visually explore how different course choices would affect their schedule. (If you're wondering, my ex-rommmate conned me into doing this :)) Anyway, this is a surprisingly useful and elegant tool. However, I ran out of time to run and maintain this software so I'm releasing it to the public so others can develop their own sites. If you use this code, please email me so I know about it. :)
If you still don't know what I'm talking about, please see this sample schedule.
This project was created here at sourceforge.net to give developers or other interested parties a chance to give input and share any ideas in a easy to use manner. Please use the forum to ask any questions or discuss any features you might have questions about. Now I know no one is probably interested in running their own scheduler programs, but well if anyone is then this page is for you.
Before I start I want to say that I know the code is ugly and can be at times hard to understand, but is always intersting. It covers everything from dynamic table generation, to cookies, to mySQL databases, to web robots, to Perl and PHP. Please remember that this was an outgrowth of an overnight hack and was only designed to work on my specific website system. However, since I moved this project to sourceforge.net, hopefully I'll get some useful ideas and bugfixes I can add to the system!
Documentation for those interested
If you only want to make a schedule (booring!), check out the links above or click here. However, Sourceforge is intended as a colaberation server, so I hope you'll tell your ICS friends to get their asses down here and help me with this (or even better to run their own sites!)
Components of the system
* Using this feature requires mySQL database. Using the database allows users to search only using course codes and to use the searchable schedule.
- The Perl script which the user interacts with. The user inputs their raw schedule and out pops a nicely formatted schedule. **
- A globals file... keeps variables in one useful location.
- A bunch of tab-deliminated files storing the finals data. This is basically the same format used by UCI and can simply be copied from their site (well with a little modification).
- Header and footer files. If a PHP interpreter is available, PHP expressions will be parsed to maintain compatability with the rest of your site.
- (optional) A Perl script to download the data from SSOC into the mySQL database. It's a little awkward, but it works. I'll probably revise it to allow for more automatic downloads. *
- (optional) A searchable schedule. Since all the schedule data is in the database, why not allow users to search it? This is a fairly major program so it was be discussed later. *
- (optional) adv-tester.pl - you can test and search the database from the command line. *
** Some functionality (course code search) is missing without the mySQL database, but major functionality will remain.
- Perl 5 or greater.
- Linux or (probably) UNIX server. With minor modifications it should work on Windows systems with ActiveState Perl.
- (optional) mySQL database.
- (optional) PHP4 is required for the searchable schedule.
Component Description and Usage
1. The main program - uci-scheduler.cgi
This is the most important component in the system. This program is written in Perl using CGI.pm so it will generate XHTML (to be buzzword compliant :)) except maybe for a few hardcoded HTML tags. There isn't too much work necessary to configure this program. The script will use the globals.pl file discussed below for most of it's configuration details, except a few essential values in the main program itself. It should be fairly self-explanitory.
2. Globals file - globals.pl
This is one of the more important files -- the database settings and other global options are stored here (only for Perl files--PHP cannot read the Perl code). One of the most important configurations is the course hashes. This tells the program what database tables can be accessed and the file that stores the database described in part 3. Anyway, let me show you the hashes in question:
%quarter_db = (
"Fall 2000" => 'f2000',
"Winter 2001" => 'w2001',
"Spring 2001" => 's2001',
"Fall 2001" => 'f2001',
%quarter_hash = (
"Fall 2000" => "finals2000f.txt",
"Winter 2001" => "finals2001w.txt",
"Spring 2001" => "finals2001s.txt",
"Fall 2001" => "finals2001f.txt",
The first hash is the name the user sees pointing to the database to be used and the second hash contains a list of the finals courses and the quarter to which it relates. (See the secton on the SQL database for information what goes on the right side of the quarter_db hash and the next section for information on how to create the finals schedule file(s).) Even if a database is not used, both hashes need to be maintained so that the popup menu from which the user selects a quarter to generate a finals schedule for can be drawn. The rest of the file should be self-explanitory.
3. Finals data
This is the data used to generate the finals scedule. It is simply stored in a tab-deliminated file (in the exact format used by UCI) for simplicity. Get the data for these files from here.
Here is a sample of the data used:
8:00 or 8:30 M W F Mon, Mar 20 8:00 a.m. - 10:00 a.m.
8:00 or 8:30 T Th Tues, Mar 21 8:00 a.m. - 10:00 a.m.
9:00 or 9:30 M W F Wed, Mar 22 8:00 a.m. - 10:00 a.m.
9:00 or 9:30 T Th Thur, Mar 23 8:00 a.m. - 10:00 a.m.
10:00 or 10:30 M W F Mon, Mar 20 10:30 - 12:30 p.m.
10:00 or 10:30 T Th TBA TBA
11:00 or 11:30 M W F Wed, Mar 22 10:30 - 12:30 p.m.
4. Headers and Footers
By default the header and footer files are header.inc and footer.inc. Optionally, the Perl CGI script can run the header and footer through the command line version php to evaluate any PHP expressions within.
5. The Robot!
This is a very interesting program. It generates a robot which goes to the UCI website, downloads the relevant data, and stores it in the database. Actually, this is two program. uci-getbot.pl which is the user interface, and uci-sched-adder.pl (no configuration required, unless globals.pl is moved.) The important line to pay attention to is: my %quarters = ("Fall 2001" => "f2001", "Spring 2001 => "s2001");. This hash is what portion of the UCI website will be downloaded when the robot goes to work. The UI will ask you for confirmation before running (optional), so if you want to run this via cron, turn it off.
Important: The uci-getbot, by default, never deletes any courses. Therefore, if a course is changed or deleted, it will still be in database. To delete old courses, enable the delete_all function in uci-getbot.pl.
6. Searchable Schedule of Classes
This is a searchable schedule of classes. It uses the cached data to generate a page exactly the same as what UCI provides. It is composed of two files: ssoc.php (the front-end the user searches from), and ant-ssoc.cgi (the page that shows the search results). It should be self-explanitory and is useful for anyone interested in making use of the cached data.
7. Command Line Tester: adv-tester.pl
This program must be run from the command line. I use this to verify that all the data has been downloaded correctly when developing the program. You use it like this: After running it from the command line (./adv-tester.pl), it asks for the quarter. This is the internal quarter database name specified in globals.pl and in uci-getbot.pl. It then asks you which field you want to search (for example id). It then asks you to input a mySQL like query. A mySQL like query is a regular expression, but uses % instead of * and . (?) instead of ?. For example, if you wanted to find all courses with an id number that starts with 400, you'd type 400% and it'd print out all the applicable courses. Very similar to how the searchable schedule works, but more primitive. :)
mySQL Database Setup
I'm going to assume you know how to setup a mySQL database and how to interact with it. If you don't you should check out SitePoint.
First make a database (called, for example, ucihome_uci). In this database we have a seperate table for each quarter.
Lets say you wanted to add the table s2001 (for Spring 2001 by my naming convention. Summer could be "sum2001"). The following was extracted from the table_setup file. (I usually copy and paste into the mySQL command line chaning s2001 to whatever is appropriate when I want to setup a new table..)
CREATE TABLE s2001 (
id INT NOT NULL PRIMARY KEY,
dept TEXT NOT NULL,
course TEXT NOT NULL,
type TEXT NOT NULL,
name TEXT NOT NULL,
stime TIME NOT NULL,
etime TIME NOT NULL,
days TEXT NOT NULL,
#INSERT INTO s2001
# (id, dept, course, type, name, stime, etime, days, building, room)
# VALUES ( "39040", "I&C SCI", "21", "LEC", "INTRO CMPTR SCI I", "11:00",
# "01:50", " T T ", "ELH", "100" );
- Fairly inflexible -- doesn't know about Saturday classes, for example.
- Hard coded variables -- yeah, yeah, don't tell me.
- Manual database integration -- this was oringinally developed to be a much smaller project and flexible automation was never properly developed. As they say, I'll leave this as an exercise the the reader.
- Archaic database system. I actually developed a better one (not that it's too hard to do), but never added it to the code here. (That one used gopher to get much more information efficiently and stores it in a more elegant manner. If anyone is interested, I can post the code here.)
- Not technically a limitation, but the code is riddled with confusing variable names (cookie, cookies, and Cookies are all used) and the usual Perl/CGI.pm fun.
Not responsible for any lawsuits, damage, typographic errors, yada yada. BTW, If there are any typos here, please let me know. Also, please don't hesitate to email me with any questions you might have! Enjoy! -- Owen
Copyright (c) 2001 Owen Prater. All rights reserved.