Coder Social home page Coder Social logo

bensaine / mcgill.courses Goto Github PK

View Code? Open in Web Editor NEW

This project forked from terror/mcgill.courses

0.0 0.0 0.0 32.9 MB

A course search and review platform for McGill University

Home Page: https://mcgill.courses

License: Creative Commons Zero v1.0 Universal

Shell 0.25% JavaScript 0.14% Python 2.23% Rust 45.18% TypeScript 51.16% CSS 0.09% HTML 0.29% Dockerfile 0.18% Just 0.49%

mcgill.courses's Introduction

mcgill.courses

A course search and review platform for McGill university.

Development

You'll need docker, cargo and pnpm installed on your machine to spawn the various components the project needs to run locally.

First, join the discord server to get access to the development environment variables:

https://discord.gg/fSVSqfPHSV

In .env within the root directory you'll have to set

MS_CLIENT_ID=
MS_CLIENT_SECRET=
MS_REDIRECT_URI=http://localhost:8000/api/auth/authorized

...and then in client/.env you'll have to set the server url

VITE_API_URL=http://localhost:8000

Second, mount a local mongodb instance with docker and initiate the replica set:

docker compose up --no-recreate -d
sleep 5
docker exec mongodb mongosh --quiet --eval 'rs.initiate()' > /dev/null 2>&1 || true

Spawn the server with a data source (in this case the /seed directory) and initialize the database (note that seeding may take some time on slower machines):

cargo run -- --source=seed serve --initialize --db-name=mcgill-courses

Finally, spawn the react frontend:

pnpm install
pnpm run dev

n.b. If you have just installed, we provide a dev recipe for doing all of the above in addition to running a watch on the server:

just dev

See the justfile for more recipes.

Gathering seed data

The server command-line interface provides a load subcommand for scraping all courses from various McGill course information websites and building a JSON data source, for example:

RUST_LOG=info cargo run -- --source=seed \
  load \
  --batch-size=200 \
  --scrape-vsb \
  --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"

The current defaults include scraping all current 10,000+ courses offered by McGill, current schedule information from the official visual schedule builder, and courses offered in previous terms going back as far the 2009-2010 term.

For full usage information, see the output below:

Usage: server load [OPTIONS] --user-agent <USER_AGENT>

Options:
      --user-agent <USER_AGENT>      A user agent
      --course-delay <COURSE_DELAY>  Time delay between course requests in milliseconds [default: 0]
      --page-delay <PAGE_DELAY>      Time delay between page requests in milliseconds [default: 0]
      --retries <RETRIES>            Number of retries [default: 10]
      --batch-size <BATCH_SIZE>      Number of pages to scrape per concurrent batch [default: 20]
      --mcgill-terms <MCGILL_TERMS>  The mcgill terms to scrape [default: 2009-2010 2010-2011 2011-2012 2012-2013 2013-2014 2014-2015 2015-2016 2016-2017 2017-2018 2018-2019 2019-2020 2020-2021 2021-2022 2022-2023 2023-2024]
      --vsb-terms <VSB_TERMS>        The schedule builder terms to scrape [default: 202305 202309 202401]
      --scrape-vsb                   Scrape visual schedule builder information
  -h, --help                         Print help

Alternatively, if you have just installed, you can run:

just load

We parse prerequisites and corequisites using llama-index with custom examples, all the code lives in /tools/req-parser.

If you need to run the requirement parser on a file, simply:

cd tools/req-parser
poetry install
poetry shell
python3 main.py <file>

n.b. This will require an OpenAI API key to be set in the environment.

Deployment

We continuously deploy our site with Render using a docker image, and have a MongoDB instance hosted on Atlas.

We also use S3 to host a bucket for referring to a hash when deciding whether or not to seed courses in our production environment, and Microsoft's identity platform for handling our OAuth 2.0 authentication flow.

Prior Art

There are a few notable projects worth mentioning that are similar in nature to mcgill.courses, and have either led to inspiration or new ideas with regard to its functionality and design, namely:

  • uwflow.com - A course search and review platform for the University of Waterloo
  • cloudberry.fyi - A post-modern schedule builder for McGill students
  • mcgill.wtf - A fast full-text search engine for McGill courses

mcgill.courses's People

Contributors

terror avatar 39bytes avatar samzhang02 avatar bensaine avatar itsjoeoui avatar

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.