15 changed files with 8858 additions and 3868 deletions
@ -0,0 +1,73 @@ |
|||||
|
#! /usr/bin/env python2 |
||||
|
|
||||
|
from elasticsearch_dsl import DocType, Date, Nested, Boolean, \ |
||||
|
analyzer, InnerObjectWrapper, Completion, Keyword, Text, Object |
||||
|
|
||||
|
from elasticsearch_dsl.connections import connections |
||||
|
|
||||
|
connections.create_connection(hosts=["localhost"]) |
||||
|
|
||||
|
class TextBook(InnerObjectWrapper): |
||||
|
pass |
||||
|
|
||||
|
class Section(InnerObjectWrapper): |
||||
|
pass |
||||
|
|
||||
|
class Course(DocType): |
||||
|
title = Text() |
||||
|
dept = Text() |
||||
|
code = Keyword() |
||||
|
|
||||
|
books = Object( |
||||
|
doc_class=TextBook, |
||||
|
properties = { |
||||
|
"author" : Text(), |
||||
|
"title" : Text(), |
||||
|
"price" : Text() |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
sections = Object( |
||||
|
doc_class=Section, |
||||
|
properties = { |
||||
|
"sem" : Keyword(), |
||||
|
"prof" : Text(), |
||||
|
"loc" : Text(), |
||||
|
"time" : Text(), |
||||
|
"day" : Text() |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
class Meta: |
||||
|
index = "course_test" |
||||
|
|
||||
|
def toSection(section): |
||||
|
return { |
||||
|
"sem" : section.sem, |
||||
|
"prof" : section.prof, |
||||
|
"loc" : section.loc, |
||||
|
"time" : section.time, |
||||
|
"day" : section.day |
||||
|
} |
||||
|
|
||||
|
|
||||
|
def toBook(book): |
||||
|
title, author, price = book |
||||
|
return { |
||||
|
"title" : title, |
||||
|
"author" : author, |
||||
|
"price" : price |
||||
|
} |
||||
|
|
||||
|
def indexCourse(course): |
||||
|
print "Trying to index course %s" % course |
||||
|
new_course = Course(sections=map(toSection, course.sections), |
||||
|
books=map(toBook, course.books), |
||||
|
title=course.title, |
||||
|
dept=course.dept, |
||||
|
code=course.code) |
||||
|
new_course.save() |
||||
|
|
||||
|
|
||||
|
#if __name__ == "__main__": |
||||
|
#Course.init() |
@ -0,0 +1,6 @@ |
|||||
|
#! /usr/bin/env racket |
||||
|
#lang racket |
||||
|
|
||||
|
(require net/url) |
||||
|
|
||||
|
|
File diff suppressed because it is too large
@ -0,0 +1,22 @@ |
|||||
|
appdirs==1.4.0 |
||||
|
click==6.7 |
||||
|
dominate==2.3.1 |
||||
|
elasticsearch==5.1.0 |
||||
|
elasticsearch-dsl==5.1.0 |
||||
|
Flask==0.12 |
||||
|
flask-appconfig==0.11.1 |
||||
|
Flask-Bootstrap==3.3.7.1 |
||||
|
itsdangerous==0.24 |
||||
|
Jinja2==2.9.4 |
||||
|
lxml==3.7.2 |
||||
|
MarkupSafe==0.23 |
||||
|
packaging==16.8 |
||||
|
pyparsing==2.1.10 |
||||
|
python-dateutil==2.6.0 |
||||
|
python-memcached==1.58 |
||||
|
requests==2.13.0 |
||||
|
six==1.10.0 |
||||
|
urllib3==1.20 |
||||
|
uWSGI==2.0.14 |
||||
|
visitor==0.1.3 |
||||
|
Werkzeug==0.11.15 |
@ -1,4 +1,4 @@ |
|||||
#! /usr/bin/python3 |
#! /usr/bin/python2 |
||||
|
|
||||
from classes import fallCourses |
from classes import fallCourses |
||||
import csv |
import csv |
File diff suppressed because it is too large
Binary file not shown.
Binary file not shown.
|
|
|
Loading…
Reference in new issue