/occupancy-scraper

Primary LanguagePythonMIT LicenseMIT

License: MIT

Interface of edu.epfl.ch, useful for finding free rooms or schedule by studyplan.

Features

  • Room Availability: Find available rooms based on selected date and time ranges. The system displays rooms that are not booked during the specified time slots.

  • Retrieve Course Information: Easily find detailed information about a specific course by providing its code. The system retrieves details such as the course's semester, assigned teachers, and schedules.

  • Explore Study Plans: Explore study plans using their unique study plan ID. The application showcases an interactive and organized timetable that covers the entire semester, highlighting courses, schedules, and room bookings.

Backend

Node.js TypeScript MongoDB Heroku

The backend repository can be found here

Frontend

React TypeScript TailwindCSS GitHub

The frontend repository can be found here

Scraper

Python MongoDB GitHub

The current repository is for the scraper, which is a set of Python scripts that interacts with MongoDB, using GitHub CI/CD for cron jobs.

Setup

To install the dependencies run:

pip install -r requirements.txt

And then set the environnement variables for the DB in .env.

Run

Before the start of a semester

Before each start of a semester, the DB needs to update the studyplans and courses details.

To do so you, or a cron job, can run the script:

python update_courses.py

On a weekly basis (or more)

Since edu.epfl.ch can change a lot during the first weeks for lots of reasons, the schedules needs to be updated accordingly.

To do so you, or a cron job, can run the script:

python update_schedules.py

It will find the current or next semester and then proceed to scrape its courses schedules and update them accordingly.

ER Model

erDiagram
    EVENT_BOOKING }o--|| EVENT_SCHEDULE : "is for (if meeting-related)"
    COURSE_BOOKING }o--|| ROOM : "occupies"
    COURSE_BOOKING }o--|| COURSE_SCHEDULE : "is for (if course-related)"
    COURSE ||--o{ COURSE_SCHEDULE : "has"
    EVENT_BOOKING }o--|| ROOM : "occupies"
    TEACHER }o--o{ COURSE: "teach in"
    COURSE ||--o{ PLANNED_IN : "is included in"
    STUDYPLAN ||--o{ PLANNED_IN : "consists of"
    STUDYPLAN }o--|| SEMESTER : "runs during"
    UNIT ||--o{ STUDYPLAN : "is composed of"

    COURSE_BOOKING {
        int schedule_id FK
        int room_id FK
        bool available
    }

    EVENT_SCHEDULE {
        int role_id FK
        string name
        date start_datetime
        date end_datetime
        string type
        string description
        bool available
        bool visible
        int status
    }


    ROOM {
        string name
        string capacity
        string type
        bool available
    }

    COURSE_SCHEDULE {
        int course_id FK
        date start_datetime
        date end_datetime
        string type
        bool available
    }
    
    COURSE {
        string code
        string name
        int credits
        string edu_url
        bool available
    }


    SEMESTER {
        string name
        string type
        date start_date
        date end_date
        bool available
    }

    UNIT {
        string name
        string code
        string promo
        string section
        bool available
    }

    TEACHER {
        string name
        string people_url
        bool available
    }

    EVENT_BOOKING {
        int schedule_id FK
        int room_id FK
        bool available
    }
Loading

Contributing

Pull requests are welcome 😄