owned this note
owned this note
Published
Linked with GitHub
# NTU COURSE SELECTION WEB APP
[TOC]

https://docs.google.com/document/d/1fzTBzwQQ2mDulhAtEmgD48QgmhdMwSSb/edit
## Web project API
### Query 拿取課程資料
#### `[get] /api/syllabus?type={type}&year={}`
目前 type跟year隨便打 尚未支援
`
> query differnt type courses information
type = dep | co | gym |
Request
Response 200 OK Success
```json=
{
"message": "success",
"content": [course schema]
}
```
### Search 全文搜尋
#### `[get] /api/search?text={text}&year={}`
response
設個上限
```json=
{
"content": [course schema]
}
```
### Login 使用者登入
#### `[POST] /api/users/login`
> use session communicate
Request
```json=
{
"studentId": string,
"password": string
}
```
Response
Success 200
```json=
{
"message": "success"
}
```
Failed 400
```json=
{
"message": "username or password error"
}
```
#### `[POST] /api/users/register`
Request
參考Database ER
```json=
{
"username": string,
"studentCname": string,
"studentEname": string,
"password": string,
"email": string,
"studentDepartment": string,
"studentId": string,
"studentMaj": string,
"studentGrad": int,
"studentGender": int,
}
```
Response
Success 200
```json=
{
"message": Success,
"token": string
}
```
Failed 400
```json=
{
"message": username exists
}
```
#### `[POST] api/users/logout`
```json=
{
"username": string
}
```
### 我的課程
#### `[GET] /api/course_schedule`
response
```json=
{
"content": {}
}
```
#### `[POST] /api/course_schedule`
> add a new course
request
```json=
{
"courseId": int
}
```
#### `[PATCH] /api/course_schedule`
> delete a course
request
```json=
{
"courseId": int
}
```
### 課程內容
#### `[GET] /api/courseInform?year={}&courseId={}`
目前year 尚未支援
courseId可以用
```json=
{
"message": "success",
"content": {
"course": [schema],
"relative": []
}
}
```
### 課程交流
#### `[GET] /api/questions?courseId={}`
StudId/TimeStp/QuCont
```json=
{
"courseId": string,
"questions": [
{"questionId": string, answer: []},
{"questionId": string, answer: []},
]
}
```
#### `[POST] /api/questions/`
> ask question
```json=
{
"studentId": string,
"courseId": string,
"question": string
}
```
#### `[POST] /api/questions/answers`
> rate the answer
```json=
{
"studentId": string,
"questionId": string,
"answerId": string,
"rate": true|| false,
}
```
#### `[PATCH] /api/questions/`
> response question
ANSWER_RATE = 1 || -1
```json=
{
"studentId": string,
"courseId": string,
"questionId": string, // this is the
"answer": string
}
```
---
## 前端
### UI 參考
- Purdue
https://www.admissions.purdue.edu/majors/index.php?_ga=2.182848943.862654590.1607738111-1895840764.1600180501
- Aalto
https://mycourses.aalto.fi/course/index.php?categoryid=73
- UCLA
https://www.registrar.ucla.edu/Academics/Course-Descriptions#J
- 成大
https://course.ncku.edu.tw/index.php?c=qry11215
- 陽明
https://portal.ym.edu.tw/coursenew/cscs/cscs01S01
- 交大
https://timetable.nctu.edu.tw/
- 台科大
https://querycourse.ntust.edu.tw/querycourse/
- 課程網
http://ucourse-tvc.yuntech.edu.tw/web_nu/search_course.aspx
- 政大
https://qrysub.nccu.edu.tw/
### 台大課程網
課程欄位

- 課程代號:[流水號]與[課程識別碼]
- 授課對象:[授課對象]與[課號]與[班次]
- 課程名稱
- 學分
- 全/半年 (tag)
- 必/選修 (tag)
- 授課教師
- 加選方式
- 時間教室
- 總人數(異動)
- 65(含開放臺大系統人數:6)
- 選課限制條件
- 限本系所學生(含輔系、雙修生),本校修課人數上限:55人
- 備註(異動)
- 尚需另排時段作兩小時的實驗。上課地點:普通102。與顏家鈺、楊馥菱、張鈞棣、黃育熙合授
- 本學期我預計要選的課程
新增
- 已選人數
- Ptt
- Q&A
儲存filter

### filter

+每頁顯示幾筆、哪個學期
- 前端:上課時間、顯示欄位(Optional)
- 後端:歷史搜尋
## Database
### [Whole Schema](https://lucid.app/lucidchart/833fde79-ca70-4d69-b697-e289c4b052f8/edit?beaconFlowId=855CBD9AA019381C&page=0_0#?folder_id=home&browser=icon)
### Course table schema
| CourseId | 流水號 |
|- |- |
| DptCode | 學院代號 |
| DptName | 授課對象 |
| CouCode | 課程識別碼 |
| Class | 班次 |
| Cred | 學分 |
| ForH | 全/半年 |
| SelCode | 必/選修 |
| CouCname | 課程名稱(中) |
| CouEname | 課程名稱(英) |
| TeaCname | 授課教師 |
| ClsRom | 教室 |
| DayTime | 時間 |
| MaxCap | 總人數 |
| Mark | 選課限制條件 |
| CoSelect | 加選方式 |
### DB TODOs
- [x] Revise schema
- [x] answer 放進 question collection
- [x] course 年份field、tag field
- [x] course info 拉出來一個collection
- [x] Dump data
- [x] scrape data
- [ ] 編碼前端的filter



## What can be done better?
1. 使用SQL DB。課程資料屬於結構化資料,使用者生成的資料才比較適合使用NoSQL
2. 前端進度
## 未來展望
1. Graph visualize course categories/keywords by department/grade
2. Chatbot Q&A
3. 教授領域分析