GYM TRACKER

For Occupancy of UW's Gym

UW-Madison has over 40,000 students on campus. With one of the two major fitness centers closed for renovation, many students turn to the Nicholas Recreation Center (The Nick) for their workouts. Because all of UW’s student body is limited to one on-campus gym option, it can become extremely busy, with significantly longer wait times.


I was never sure of the best time to go to The Nick, as it usually seemed to be packed, yet every so often it would be very quiet. The UW-Madison Recreation & Wellbeing website offers a “live” tracker that updates approximately every hour, but in order to get any valuable data, I’d have to check constantly throughout the day to gauge the best time to go.


So, I decided to create a way to keep a log on all of the occupancies recorded and graph them. I recently added functionality for UW's other major gym, The Shell. You can view the finished product here:

How It Works


The idea of the application is quite simple: collect data and log it on a graph.


For the data collection side, I created a simple Python script that runs every five minutes on my Raspberry Pi. It scrapes the UW RecWell webpage for the desired data, and if the data has been updated, then it executes a SQL query to insert data onto a server.


On the front-end side, I used chart.js which is an open-source data visualization library. When the page is opened, an Ajax GET request is executed, which runs a PHP script to fetch from the database. The data is then parsed, and displayed on the graph.