Parking Availability API
I briefly attended IUPUI, and in my downtime between classes I often found myself exploring the different little apps that students had access to. Being a commuter student, one of these caught my eye and actually got a fair bit of use: the parking availability checker!
It's a pretty simple little app, it's a Google Maps app that overlays info about the occupancy status of the different parking garages around campus. It's pretty handy!
Something always bothered me about this app though... and the issue took a while to click in my head. Does it stand out to you?
Imagine this: you get ready to drive to school in the morning and decide to use the app to plan ahead. You see that Garage A has plenty of availability, so you start your half hour commute to campus. By the time you arrive at Garage A, your information is now 30 minutes out of date, and you find Garage A full! This is why I imagine most users of the parking availability app are likely checking garage availability on their phone during their drive to campus. Which brings us to our problem, using a Google Maps web app on a mobile device while driving just feels like a recipe for disaster. 😬
Making it easier
Working from our ideal use case, it seems natural to imagine a handsfree app that integrates with your phone's voice assistant, allowing you to request garage information with a simple "Hey Siri" or "OK Google." In order to do that, I needed a better way to interact with the data provided by IUPUI's app.
My solution was to create a web API that would take requests for a specific garage, and respond with that garage's current occupancy information. I can send a request like this:
1parking.example.com/blackford
...and get a response like this:
1{ 2 success: true, 3 message: "Blackford Garage currently has 552 spots available.", 4 address: "725 W Michigan St, Indianapolis, IN", 5 capacity: "1143", 6 occupied: "621", 7 available: "522" 8}
How sweet is that?
From there I built out a simple iOS Shortcut as a proof of concept, allowing me to ask Siri to check a garage and have Siri read out that garage's status as well as ask if I would like driving directions to that garage. It's pretty slick!
Technical challenges
While working on this project, I started to notice the occasional oddity in IUPUI's parking app. Sometimes I'd go to look at a garage and discover it had negative spots occupied! I'm not certain what specifically causes this issue, but I assume there's some issue with the actual system in place at the garages that results in the occupancy count getting wonky.
Because I didn't have access to the actual source of the data, and only its output, I had little choice but to embrace the bug whenever it appeared!
1{ 2 success: true, 3 message: "Barnhill Garage is currently reporting weird numbers, but appears to have 11902 spots available.", 4 address: "345 Barnhill Dr, Indianapolis, IN", 5 capacity: "1324", 6 occupied: "-10578", 7 available: "11902" 8}
Lessons learned
This project was a fun exercise in web APIs as well as a good opportunity to learn more about web scraping. But aside from the programming fun, I think even though this project was small scale and personal, it was a great way to reinforce the idea of thinking about the user when building something. "Who's going to be using this, and how?" I genuinely think that actively considering that question can transform a really good project into an amazing one.