Did some sniffing around on the RIT campus map (just watching the network traffic in Firefox), and I found something very useful: the building occupancy API!

Busyness indicators are something that I wanted, since the actual RIT dining website has them, but that's not included in the dining data so I assumed that my only option was to scrape the site if I really wanted them, which would suck because the site being slow is the main reason that I'm making this app. 1/?

#programming #iosdev #RIT

The API I stumbled across is fun because it includes the current building occupancy, the maximum building occupancy, as well as the busyness rating (1-5) for every hour and how it compares to the past two weeks.

The maps APIs like this one use a different set of IDs to identify each location, but fortunately there’s a *different* maps endpoint that I can pass the TigerCenter-compatible ID to and get the corresponding maps ID back from. It’s one more call than I’d like… 2/?

...but it gets the job done. Once I have the maps ID, I just hand that over to the density API and tada! I know how busy a location is.

From there the UI side was easy. I just have a row of four person icons, with each one representing 20% occupancy, and it fills them up as appropriate based on the current/max occupancy returned. Attached is a screenshot of how that looks in the DetailView of a location. 3/?

There is one caveat to this- the occupancy API is sloooooooow. Sometimes it returns data in a second or two, like you’d hope, but then other times it can take upwards of 15 seconds. This means that I can’t really wait for it behind the main loading screen, because that would massively slow the app down, which defeats the whole purpose. Instead, I load the main content, and then from there it loads the occupancy data separately. It works alright and I added a spinner to make it look better… 4/?

…but I wish it was more consistently fast.

The code for all of these changes is live on GitHub, and is pushed to TestFlight for the likely 0 active RIT students who are reading this post (but I can hope!)