A web application that predicts how busy study spots are on the University of Illinois at Urbana-Champaign campus.
Students often struggle to find available study spaces on campus, especially during peak times like midterms and finals. Existing tools like Google Popular Times provide general foot traffic data but don't capture the specific dynamics of academic spaces (e.g., sudden emptying after a lecture ends). This project aims to provide a more accurate, real-time prediction of study spot occupancy by combining:
- Historical foot traffic data (Google Popular Times)
- Class schedules and exam schedules
- Historical occupancy patterns
- User-reported occupancy (optional)
The goal is to help students make informed decisions about where to study, reducing wasted time searching for available spaces.
The application consists of a Flask backend serving a vanilla JavaScript SPA (Single Page Application). There is no build step or frontend framework.
- Framework: Flask (Python)
- Data Source: Pre-processed CSV file (
data/master_campus_demand_W1_to_W16.csv) containing weekly/daily/hourly demand predictions for 8 campus buildings. - Academic Calendar Logic: Encodes semester start dates, breaks (spring break, Thanksgiving), and week mapping to ensure accurate date-to-week conversion.
- API Endpoints:
GET /- Serves the frontendindex.htmlGET /api/demand?week=&day=&hour=- Returns demand predictions for all buildings at a specific timeGET /api/buildings- Returns list of all building namesGET /api/all_days?week=&hour=- Returns demand for all buildings across all days of a week at a given hour (used for monthly calendar view)GET /api/calendar/<building>?week=- Returns a 24x7 grid of demand for a specific building and week (used for daily detail view)GET /api/semesters- Returns configured academic periodsGET /api/current_demand?date=- Returns demand for the current moment (or a specified date for testing)
- Language: Vanilla JavaScript (ES6)
- Styling: Custom CSS (no framework)
- Views (managed by toggling CSS classes):
- Home (
view-home) - Landing page with hero image and call-to-action - Hub (
view-hub) - Navigation to Map, Calendar, and Quick Search - Map (
view-map) - Interactive campus map with color-coded building overlays showing real-time demand - Monthly Calendar (
view-calendar-out) - Month-view calendar where each day is colored by average demand (at noon) - Daily Detail (
view-calendar-in) - Hourly bar chart for a selected building and day, plus a ranked list of all buildings for that hour
- Home (
- Real-time Map View: Building overlays update every 5 minutes with live demand data.
- Monthly Planning: Color-coded calendar helps identify generally busy/quiet days.
- Daily Detail View: See hour-by-hour demand for a specific building and compare across all buildings.
- Academic Calendar Awareness: Correctly handles semester breaks (spring break, Thanksgiving) and adjusts week numbering accordingly.
- Responsive Design: Works on desktop and mobile browsers.
The prediction model (not included in this repository) generates the master_campus_demand_W1_to_W16.csv file, which contains:
Week: Semester week (1-16)Day: Monday-SundayHour: 0-23Building: One of 8 campus buildingsDemand_Prediction: Float from -1.0 (closed) to 1.0 (fully occupied)Pressure_Multiplier: Internal model factor (not used in UI)Timestep: Sequential index
Due to the nature of the prediction model (trained on historical data), the tool provides reasonable estimates of building occupancy. During validation:
- The map view correctly reflects known busy periods (e.g., midterm weeks show higher demand in libraries).
- The Thanksgiving break logic correctly shows reduced demand during the holiday week.
- The semester end date correctly falls on a Friday, preventing erroneous "in-session" labels on weekends.
Screenshots would typically show:
- The home screen with the project introduction.
- The hub with navigation cards.
- The map view with colored building overlays.
- The monthly calendar with day-specific coloring.
- The daily detail view with an hourly bar chart and building list.
-
Prerequisites:
- Python 3.8+
- Conda (optional but recommended) or virtualenv
- Required Python packages: Flask, pandas
-
Setup:
# Clone the repository git clone <repository-url> cd uiuc-study-spots # (Optional) Create and activate a conda environment conda create -n uiuc-spots python=3.9 conda activate uiuc-spots # Install dependencies pip install flask pandas
-
Run the Server:
# From the project root python api/index.pyThe server will start on
http://localhost:5000. -
Usage:
- Open your browser to
http://localhost:5000. - Navigate via the hub or directly to views.
- In the calendar view, click a day to see the hourly demand breakdown for that day.
- Open your browser to
+---------------------+ +----------------------+
| Web Browser |<----->| Flask Server |
| (SPA Vanilla JS) | HTTP | (api/index.py) |
+---------------------+ +----------------------+
^ ^
| |
| Serves static | Serves JSON API
| files (HTML, CSS, | endpoints:
| JS) from /public | - /api/demand
| | - /api/buildings
| | - /api/all_days
| | - /api/calendar/<building>
| | - /api/semesters
| | - /api/current_demand
v v
+---------------------+ +----------------------+
| Static Assets | | CSV Data File |
| (HTML, CSS, JS, SVG)| | master_campus_demand_|
| served by Flask | | W1_to_W16.csv |
+---------------------+ +----------------------+
- The prediction model itself is not included in this repository; only its output CSV is used.
- To update predictions, replace
data/master_campus_demand_W1_to_W16.csvwith a newly generated file (same format). - The academic calendar is hardcoded for Spring 2026, Fall 2026, and Spring 2027. To add new semesters, update the
SEMESTERSlist in bothapi/index.pyandpublic/script.js.
- Integrate real-time user feedback to adjust predictions.
- Add push notifications for when a favorite building becomes available.
- Implement predictive caching to reduce API calls.
- Expand to more buildings and campuses.
- Add user accounts and saved preferences.
This project is provided as-is for educational purposes.
Last updated: July 2026