Bike shares have become increasingly popular as a supplement to public transportation in major cities, and present a convenient alternative to lugging your own bike along with you everywhere. Provided that bikes are available in the vicinity of where you’re located at the time you actually need them.
Large parts of Oslo is elevated, and even if you’re situated just outside the core city center, bike racks are prone to be empty. For some reason, people tend to favor rolling downhill rather than riding uphill, and empty racks are only refitted by the bike company ever so often.
So I needed to figure out when bikes were actually available in my area.
All I needed to do was make periodic dumps of the availability endpoint to gather historical data, so I could graph and find an optimal schedule for city bike riding. I put together a simple Go application to solve this.
Every 15 minutes I run the application to store data on all available bike rack’s available and used slots, and feed it to an InfluxDB time series database. I then use Grafana to browse and visualize the data.
I won’t cover how to set up InfluxDB and Grafana, but it you’re familiar with Docker, running them in containers is probably the easiest approach. The Go application can be found on my GitLab (it includes a x64 Linux binary built for Ubuntu), and instructions for use can be found in the project readme.
Scheduling can be done by setting up a cronjob, a Docker runtime environment, or by using any other compatible scheduler.
I might make a follow-up post on how I dig into and use the data, but for now - feel free to set up your own implementation. (Just stay away from my bike racks.)