Skip to content

Commit

Permalink
Add support for Northeastern University 馃帀馃帀馃帀馃帀馃帀 (#1041)
Browse files Browse the repository at this point in the history
* Adding support for northeastern: initial commit

* Removed neu textbooks parser for now. Will add back in future

* Updated courses.py

* Added Northeastern to schools.jsx

* Fixed a comment

* Fixed linting erors

* Updated the regex

* Updated the regex in schools.jsx

* Removed unneeded code from neu/courses.py

* Changed hardcoded term for Spring 2018

* Added the jhu files back

* Tweaked the indentation in courses.py and fixed a bug in main.js
  • Loading branch information
ryanhugh authored and noahpresler committed Nov 7, 2017
1 parent ab995ae commit 4c2439d
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ venv/
.vscode/
webpack-stats.json
workfile.html
cache
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"reselect": "^3.0.1",
"sass-lint": "^1.10.2",
"sass-loader": "^6.0.3",
"searchneu": "^1.0.6",
"static-interval-tree": "^1.3.0",
"streamify": "^0.2.5",
"style-loader": "^0.17.0",
Expand Down
1 change: 1 addition & 0 deletions parsing/schools/active
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
chapman
neu
gw
jhu
queens
Expand Down
14 changes: 14 additions & 0 deletions parsing/schools/neu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (C) 2017 Semester.ly Technologies, LLC
#
# Semester.ly is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Semester.ly is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

from parsing.schools import load_school_logger
load_school_logger('neu')
19 changes: 19 additions & 0 deletions parsing/schools/neu/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"school": {
"code": "neu",
"name": "Northeastern University"
},
"course_code_regex": "([A-Z]{0,4} [0-9]{4})$",
"terms": [
"Spring"
],
"granularity": 5,
"ampm": true,
"full_academic_year_registration": false,
"single_access": true,
"active_semesters": {
"2018": [
"Spring"
]
}
}
43 changes: 43 additions & 0 deletions parsing/schools/neu/courses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (C) 2017 Semester.ly Technologies, LLC
#
# Semester.ly is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Semester.ly is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.


from __future__ import absolute_import, division, print_function

import re
import sys
import os
import subprocess

from parsing.library.base_parser import BaseParser

class Parser(BaseParser):

def __init__(self, **kwargs):
"""Construct NEU parser object.
Args:
**kwargs: pass-through
"""
super(Parser, self).__init__('neu', **kwargs)

# Required to prevent the python code from writing courses.json.
# The JS script saves the courses.json when using search neu scrapers.
def end(self):
pass

def start(self, **kwargs):

path = os.path.join(os.path.dirname(__file__), 'main.js')
subprocess.call(['node', '--max_old_space_size=8192', path])
print("done scraping neu")

Empty file.
Empty file.
19 changes: 19 additions & 0 deletions parsing/schools/neu/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require('babel-core/register');
require('babel-polyfill');
const searchneu = require('searchneu');
const path = require('path');
const fs = require('fs');

searchneu.default.main(true).then((retVal) => {
const semesterlyString = JSON.stringify(retVal, null, 4);
fs.writeFile(path.join(__dirname, 'data', 'courses.json'), semesterlyString, (err) => {
if (err) {
global.console.log(err);
return;
}

global.console.log('saved semesterly data');
});
}).catch((err) => {
global.console.log(err);
});
13 changes: 13 additions & 0 deletions static/js/redux/constants/schools.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GNU General Public License for more details.
export const VALID_SCHOOLS = [
'uoft',
'jhu',
'neu',
'umd',
'uo',
'queens',
Expand Down Expand Up @@ -116,6 +117,18 @@ export const getSchoolSpecificInfo = (school) => {
1: '',
},
};
case 'neu':
return {
primaryDisplay: 'name',
areasName: 'Areas',
departmentsName: 'Departments',
levelsName: 'Levels',
timesName: 'Times',
courseRegex: '([A-Z]{0,4} [0-9]{4})',
campuses: {
1: '',
},
};
case 'umich':
return {
primaryDisplay: 'name',
Expand Down

0 comments on commit 4c2439d

Please sign in to comment.