项目作者: dipsywong98

项目描述 :
Find Secret Available Room in UST
高级语言: JavaScript
项目地址: git://github.com/dipsywong98/USThing-FindRoom.git
创建时间: 2017-08-26T08:26:38Z
项目社区:https://github.com/dipsywong98/USThing-FindRoom

开源协议:

下载


USThing-FindRoom

Finding secret available locations in UST

  • node/ :server, get course datas and available room calculations API,

    • index.js :get all courses in UST, outputs all.json, locations.json, courses.json, and courses_dict.json.
    • find_room.js :out available locations in different time in a week places.json.
    • search.js :start express server serving findroom service: returns a dictionary of available locations in different length of available time, given a start time and a day of week.
    • locations.js :generate location json file for getting timetable of certain classroom
  • view/ :UI, using the node script’s API

  • offline/ :UI, no need server

structures:

courses_dict.json:

Note: courses.json is just courses_dict.json using number as index instead of course_id

  1. courses: {
  2. course_id: {
  3. id,
  4. department,
  5. code,
  6. name,
  7. credit
  8. details: { //its content is dynamic, some index may not exist
  9. attrubutes[],
  10. pre-requisite:[{
  11. other, //either other or course
  12. course
  13. }]
  14. co-requisite:[{
  15. other,
  16. course
  17. }]
  18. exclusion:[{
  19. other,
  20. course
  21. }]
  22. description,
  23. ...
  24. }
  25. sections: [{
  26. name,
  27. class_number,
  28. classes: [{
  29. day
  30. start_time
  31. end_time
  32. location
  33. instructors[]
  34. }],
  35. quota: {
  36. total,
  37. public
  38. hold{
  39. department:{
  40. quota,
  41. enrol,
  42. avail
  43. }
  44. }
  45. },
  46. enrol,
  47. avail,
  48. wait
  49. }]
  50. }
  51. }

example: TBA

locations.json:

It is just an array of locations which may have lessons

all.json :
  1. {
  2. "courses":{
  3. //content of courses.json
  4. },
  5. "locations":{
  6. //content of locations.json
  7. }
  8. }
##### places.json:
  1. places:[
  2. day[
  3. time[
  4. available_locations[]
  5. ]
  6. ]
  7. ]

list_of_locations_available = places[day_in_week][hour_in_day]

Use of search.js

Request places.json, and use SearchRoom function (day_in_week, start_hour) to return locations of different available length (without duplication)

example:

SearchRoom(2,12) returns:

  1. { '3':
  2. [ 'Lecture Theater J (300)',
  3. 'Rm 6591, Lift 31-32 (60)',
  4. 'Rm 2407, Lift 17-18 (126)' ],
  5. '0.5':
  6. [ 'G011, LSK Bldg',
  7. 'Rm 3005, Lift 4',
  8. 'Rm 3301, Lift 17-18',
  9. 'Rm 4621, Lift 31-32 (126)',
  10. 'G004, CYT Bldg (30)',
  11. 'G005, CYT Bldg (30)',
  12. 'Rm 6131, Lift 19, 22',
  13. 'Rm 6135, Lift 19, 22',
  14. 'Rm 6315, Lift 19, 22',
  15. 'Rm 6140',
  16. 'Rm 2014, CYT Bldg',
  17. 'Rm 3121, Lift 19, 22',
  18. 'Rm 3111, Lift 19, 22',
  19. 'Rm 3119, Lift 19, 22',
  20. 'Rm 3115, Lift 19, 22',
  21. 'Rm 2134, Lift 19, 22',
  22. 'Rm 2133, Lift 19, 21, 22',
  23. 'Rm 6580',
  24. 'Rm 2128C, Lift 19 (28)',
  25. 'Rm 4402, Lift 17-18',
  26. 'G005, LSK Bldg',
  27. 'Rm 1504, Lift 25-26 (52)',
  28. 'Rm 1505, Lift 25-26 (61)',
  29. 'Rm 4160, Lift 33',
  30. 'Multi-function Room, LG4, LIB',
  31. 'LG5 Multi-function Room',
  32. 'Rm 2136, Lift 22',
  33. 'Rm 4225C, Lift 23, 24',
  34. 'Rm 5506, Lift 25-26 (30)',
  35. 'Rm 2209',
  36. 'Rm 1206',
  37. 'Rm 1002, CYT Bldg',
  38. 'Rm 6581, Lift 27-28',
  39. 'Rm 4223, Lift 23',
  40. 'Rm 3207, Lift 21',
  41. 'Rm 2007, CYT Bldg',
  42. 'Rm 4221, Lift 19 (32)',
  43. 'G009A, CYT Bldg (80)',
  44. 'Rm 4214, Lift 19 (52)',
  45. 'Rm 2504, Lift 25-26 (84)',
  46. 'Rm 4504, Lift 25-26 (54)',
  47. 'G009B, CYT Bldg (70)',
  48. 'Rm 6602, Lift 31-32 (60)',
  49. 'Rm 4619, Lift 31-32 (126)',
  50. 'Lecture Theater F (134)',
  51. 'Lecture Theater E (143)',
  52. 'Rm 1034, LSK Bldg (80)',
  53. 'G001, CYT Bldg (24)',
  54. 'Rm 1026, LSK Bldg (24)',
  55. 'Rm 5562, Lift 27-28 (30)',
  56. 'Rm 5508, Lift 25-26 (30)',
  57. 'G002, CYT Bldg (30)',
  58. 'Rm 1004, CYT Bldg',
  59. 'G003, CYT Bldg (30)' ],
  60. '1.5': [ 'Rm 2465, Lift 25-26 (122)' ] }