0.2.21 • Published 11 years ago
uoft-api v0.2.21
A Node.js module which parses data from the University of Toronto's course listings into JSON to help developers create applications for students with ease.
Getting Started
Install:
$ npm i uoft-apiReference:
var uoftAPI = require('uoft-api');Supported Functions
getAllCourseDepartmentsgetCourseDepartmentgetProgramCourses
getAllCourseDepartments(callback)
- Takes a callback which handles error and an array of JSON objects, where each object contains a department field which has the name of the department specified by the code.
Number of Requests:
getAllCourseDepartmentsperforms 1 request to retrieve all department names.
Usage:
uoftAPI.getAllCourseDepartments(function(err, allDepartments) {
// do whatever with the course department array
});Examples
uoftAPI.getAllCourseDepartments(function(err, allDepartments) {
console.log(allDepartments);
/*
[ { department: 'Aboriginal Studies' },
{ department: 'American Studies' },
{ department: 'Anatomy' },
< ... etc, ordered by department name ... >
{ department: 'Victoria College Courses' },
{ department: 'Woodsworth College Courses' },
{ department: 'Women and Gender Studies' } ]
]
*/
});getCourseDepartment(courseCode, callback)
courseCodeis a valid three-letter code representing a department at the University (ie/ the first three letters of any course code).- Takes a
callbackwhich handles error and an array of JSON objects, where each object contains a department field which has the name of the department specified by the code.
Number of Requests:
getCourseDepartmentperforms 1 request to retrieve the department name of the specified program.
Usage:
uoftAPI.getCourseDepartment(programCode, function(err, department) {
// do whatever with the course department array
});Examples
uoftAPI.getCourseDepartment('csc', function(err, department) {
console.log(department);
/* [ { department: 'Computer Science' } ] */
});uoftAPI.getCourseDepartment('env', function(err, department) {
console.log(department);
/* [ { department: 'Environment, School of' } ] */
});getProgramCourses(programCode, acceptCancelledCourses, callback)
- Takes a valid three-letter
programCoderepresenting a department at the University (ie/ the first three letters of any course code). - Takes a value
trueorfalse, which determines whether cancelled courses will be included in the array of course JSON objects. - Takes a callback which handles error and an array of courses represented as JSON objects (as demonstrated below), where each JSON object contains a single course's information and has the following structure:
{
courseName: 'Computational Thinking', // Title of the course
courseCode: 'CSC104H1', // Course code
courseTerm: 'F', // Course semester
courseWait: 'Y', // If the course contains a wait-list (Y/N)
courseProf: [ 'D. Heap' ] // Professor(s) teaching the course
}Number of Requests:
getProgramCoursesperforms 2 requests to retrieve all course data of the specified program.
Usage:
uoftAPI.getProgramCourses(programCode, acceptCancelledCourses, function(err, courseData) {
// do whatever with the returned courseData json
});Examples
uoftAPI.getProgramCourses('csc', true, function(err, courseData) {
console.log(courseData);
/*
[
{
courseName: 'Computational Thinking',
courseCode: 'CSC104H1',
courseTerm: 'F',
courseWait: 'Y',
courseProf: [ 'D. Heap' ]
},
{
courseName: 'Computational Thinking',
courseCode: 'CSC104H1',
courseTerm: 'S',
courseWait: 'Y',
courseProf: [ 'G. Baumgartner' ]
},
< ... etc, ordered by course code ... >
{
courseName: 'Computabil & Logic',
courseCode: 'CSC438H1',
courseTerm: 'F',
courseWait: 'Y',
courseProf: [ 'T. Pitassi' ]
}
]
*/
});Function Addition Roadmap
- Extending
getProgramCoursesto include the lecture and tutorial sections of each respective class in their own arrays. - Extending
getProgramCoursesto include when each tutorial and lecture section takes place (day of the week and time). - Extending the module to support course data from the University of Toronto Mississauga and Scarborough campus time-tables.
- Extending the module to support course data from the St. George campus Faculty of Engineering.