Giter VIP home page Giter VIP logo

nthu_course's Introduction

Build Status

NTHU Course

A system that fetch the course data and provide service that is instinctive, easy to use.

Getting Started

Install dependency

  • python

    • version: >= 3.5
  • tesseract

    • version: >= 3.03
    • mac: brew install tesseract --devel # Without --devel, it will install tesseract 3.02
    • ubuntu: sudo apt-get install tesseract-ocr
    • arch linux: sudo pacman -S tesseract tesseract-data-eng
  • mariadb

    • version: >= 10.0.27
    • mac: brew install mariadb
    • ubuntu: sudo apt-get install mariadb-server
    • arch linux: sudo pacman -S mariadb

Install and Setup Virtualenv (optional)

We highly recommend developers to setup environment with virtualenv.

You can install this package by typing pip3 install virtualenv in your console.

Basic Settings for Database

By default, the system will find a configuration file in NTHU_Course/mysql.ini.

So you need to create it and put your settings in this file. The following script is the example for mysql.ini.

[client]
database = <database name>
user = <mysql username>
password = <mysql password>
host = <mysql server ip>
port = <mysql server port>
default-character-set = utf8

Build the System.

Typing the commands below may help you build this system.

virtualenv VENV --python=python3
source VENV/bin/activate
pip3 install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py crawl_course
python3 manage.py update_index

To clear all contents in db, use python3 manage.py crawl_course clear

To update all syllabus, use python3 manage.py update_syllabus

Launch

python3 manage.py collectstatic
python3 manage.py runserver --insecure

Heroku settings

To use it in heroku, you have to set the following environment variables

TESSDATA_PREFIX=/app/.apt/usr/share/tesseract-ocr/tessdata
BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
DJANGO_SETTINGS_MODULE=NTHU_Course.settings.heroku
SECRET_KEY=hard-to-guess-string

this can be achieved by heroku config:set or the web panel

nthu_course's People

Contributors

afq984 avatar gitter-badger avatar henryyang42 avatar hydai avatar levirve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nthu_course's Issues

抓取在楓橋上的選課心得

我們有很多很棒的選課心得分享還在我們的楓橋 BBS 站上。
如果能將他們整合進來是很棒的,目前我會著手這部分。

Crawler failed, because of ValueError.

Crawling course for 105|10
Traceback (most recent call last):                                                                                                                           |
  File "manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/root/.venv/tmp/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/root/.venv/tmp/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/.venv/tmp/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/.venv/tmp/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/root/git/test/NTHU_Course/crawler/management/commands/crawl_course.py", line 42, in handle
    crawl_course(ACIXSTORE, auth_num, cou_codes, ys)
  File "/root/git/test/NTHU_Course/crawler/crawler.py", line 111, in crawl_course
    handle_curriculum_html(response.text, cou_code)
  File "/root/git/test/NTHU_Course/crawler/crawler.py", line 95, in handle_curriculum_html
    collect_class_info(tr, cou_code_stripped)
  File "/root/git/test/NTHU_Course/crawler/crawler.py", line 71, in collect_class_info
    course_dict = course_from_tr(tr)
  File "/root/git/test/NTHU_Course/crawler/course.py", line 126, in course_from_tr
    part['size_limit'], part['fr'] = get_slfr(extract_text(tds[6]))
  File "/root/git/test/NTHU_Course/crawler/course.py", line 75, in get_slfr
    sl = int(sl)
ValueError: invalid literal for int() with base 10: '25新生保留25人'

候選課表

選課若有衝堂可能會改變整個課表的排定
增加候選課表來查看多種可能的課表

Course.teacher is fucked up

Branches affected: master, dev

The field Course.teacher expects at most 40 characters, and only store Chinese names.
The teacher field in syllabs used to show only Chinese, so it was not a problem then.
However, now, english names are included.
image

DataError: value too long for type character varying(40) pops out.

Travis CI

To help maintain our code quality, could @hydai please help us build Travis CI?

替課表增加顏色

User Story:讓對課程不了解的人,可以直接用眼睛看預排課表的顏色得知自己這一個學期的課程是否過重

依據心得回饋的"甜度","涼度","選上機率" 三種
去更動課表的表格顏色

註:待 React 版本完成後開始

Sort function for search table

We receive lots of comment like "Can you make the search table sort by time, name or course_id?".
Should we support this function?

權重計算

提出的issue主要有兩個idea

第一是權重計算:
因為通常預排一堂課不僅包含必選修的考量
還有甜度涼度也會作為判斷的標準
對一個人而言,所有的課與自己的選擇
可以對應到一個payoff function
利用這種觀察,可讓使用者自行對課堂配權重
再利用brute force optimization
找出權重最‘重’課表(演算法部分不難,但BF輸入超過20堂課因複雜度會壞掉)

其次因為想修的課不一定選得上,可以乘上一個選上機率(計算參考稍後一個idea會提供)
在BF過程中sort出前十個可參考

第二是賽局設計以得到有用的資訊:
如何知道一堂課的熱門程度?
設計一套如未來事件交易所之市場機制
利用博弈賽局使得一堂課的價值直接地顯現選上的難度
要利用學生使用本資源的哪種貪婪我還沒想到(之前想到的都可以找到漏洞)
可能要去參考其他論文

擋修功能

我們沒有任何地方可以存取到擋修的連結,或許要加上擋修的資訊或資料重導

手動加演習課

課表常常會有隱藏版時段,像是 demo 時段、演習課, etc.

改進課表的輸出部分

目前:
最左欄只有第幾堂課,沒有上課時間
星期六如果沒有課還是會印出來,而且整個表格的形狀很寬,希望改成更好儲存閱讀的長寬比
文字的部分放大會模糊,希望能找到更好的方式匯出圖片

期望:
增加課表時間日期
改進長寬比例
提高圖片的畫質

審核心得,並告知發言之相關法律責任

開一個討論區
能讓大家在上面討論課程的心得
與老師的上課方式
為避免有偏激,涉及毀謗之不當**
所有心得文必須先經管理員審核,才能發表
並告知發文者與留言者相關法律責任(可以在進入頁面前讓大家同意使用者條約)

Uniform attribute names

I recall that attribute names are different across code.

Shall we document them somewhere (maybe in the wiki?) and put some effort to make them the same?

Syllabus background click

The syllabus popup seem to close if we click anywhere. I disable this by adding closeOnBgClick: false attribute. Now, however, it can only be closed if we click the close button, which is very annoying. Could someone help solve this? I hope to close the popup if click the background(gray area) as well.

Syllabus presentation

Now, we have the syllabus of all courses.
Currently, we use popup to represent the info, but it occupies the whole screen, which is not a good experience for uses.
Should we need to use popup, we can customize the css animation to make it prettier.

By the way, can someone make the syllabus table prettier XD

Use docker in builds

Maybe we can support docker in building environment?

Actually, I've done some experiment on dockerfile and docker-compose.

Somehow there's still some problems in MySQL container settings for non-ascii. 😐 Even though, I think we should make a standard procedure for environment builds.

Search result transition is strange

2015-05-26 4 49 19

When I resubmit search, it's likely that the original table will still there until the new one replaces the old one. Can you refine the transition to achieve better user experience?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.