Continuing my interest in the bicycle rental scheme in Leicester, in December last year I began collecting the station usage data from the city council’s open data API.

At the outset of this post I should highlight that all the information here is now redundant. As of yesterday, the company running the scheme (Ride On) have gone into administration. The scheme is no longer operating.

I wrote a lambda function to call this endpoint every 22 minutes and save the data in a csv file. That function has been running for around 8 weeks, in which time it has made ~4,000 requests, and collected ~33,000 unique1 data points.

The code is nothing special, it’s probably not the most efficient way to collect, store, or process the data. If I had more time, and knew what I was doing, I would’ve used a key-value store.

Availability heatmaps

With this code, I averaged the number of bikes docked at each station every 20 minutes, then followed this tutorial for QGIS to come up with a heatmap video.

Base map ©OpenStreetMap contributors, data ©Leicester City Council and used under Open Government License v3.0.

I’ve added subtitles to count the hours, otherwise it’s straightforward – the video is 24 seconds long and every second represents one hour.2

You’ll see there’s a pretty big shift in availability at Leicester University and London Road around mid-day. I guess that’s down to students coming in or out for morning/afternoon lectures.

stations

I was inspired to do this partly out of frustration on more than one occasion walking all around the city centre late in the evening, looking for available bicycles. So following personal experience, my assumption was that availability in the city centre generally followed a commuter pattern. I was expecting the heatmap to show bikes concentrated in the centre during the day, and emptying out from the centre after 5pm.

Here’s the same map, zoomed in on the city centre.

Base map ©OpenStreetMap contributors, data ©Leicester City Council and used under Open Government License v3.0.

I spent a while playing with the gradient curve on the heatmap, and set a quite big radius for each point. My amateur data-viz skills aside, I don’t see many obvious patterns on the map.

Individual station availability curves

The availability curve for individual stations is below; select the station you want from the drop-down list.

<img id=”graphcontainer” src=”/media/2023/02/bike_usage_patterns/charts/bbf0e4e1-8372-4e36-ae35-c87a4910dec3.svg.jpg –alt “graph of Saffron Lane availability” width=”786” height=”480”>

Thse were generated with MatPlotLib and this code. I’ve smoothed out the curves with gaussian_filter1d from SciPy, and when combined with the averaging of many points, the graphs don’t show much variation.
One exception to that is the station at Gallowtree Gate, which does show availability climbing up in the morning, peaking at 9am, then moving up and down during the day.

Not all changes in availability between stations are down to normal journeys. Some bicycles were moved between stations by this cheerful man with his mega-bike transport trailer.

bike transport

Overall this data wasn’t all that useful, and any conclusions I could have made no longer matter now anyway. Still, it was a fun coding exercise.

What happened to the bike scheme

On Thursday 16th February all bicycles were unavailable due to a ‘communications timeout’. By coincidence, the communications problem occurred the same day that liquidators were appointed for the Ride On company.

error_message

On Tuesday last week there were rumours that Ride On had gone under. On Thursday the BBC reported that the company had folded and was selling off the bicycle fleet. Yesterday it was confirmed by the Leicester Mercury.

Anecdotally, in the months leading up to this I had felt a reduction of bicycles in circulation. In July last year there were 675 bicycles in circulation, and now Ride On are selling 300 at auction. That leaves at most 375 bicycles unaccounted for?

At the moment the API still shows 39 bicycles docked in stations around the city, and since I have all the data since December, I could track how the numbers dwindled. I have also sent a last-minute FOI request for the final ridership figures, so might write a follow-up to this post when/if that sheds any light on what happened.

  1. A hash is generated for each object, and then duplicates removed, so we know for certain that each object is unique. 

  2. To explain the final 9fps frame rate, I used minterpolate in FFmpeg to blend frames together for more smooth motion.