by Kevin Rosamont

BIKE SERVICES API + SHINY = NICE APP

Hi everyone,

In this blog post, I will be short and I will introduce our shiny application on bike self-service stations.

The code is in 2 parts, the ui.R file for the interface and the server.R file for the backend. You can check the code on GitHub if you want to download the code and run it on your computer.


JCDecaux provides an API that gives us real time information on each bike self-service station. This infomation is:
•Station id
•Station name
•Address
•Position latitude/longitude
•Presence of a payment terminal
•Presence of a bonus station
•If the station is open
•How many bike stands are in the station
•how many bike stands are available in the station (no bikes on the stand)
•How many bikes are available
•Time of the last api update

The JCDecaux API gives the data under the following format:

{
  "number": 123,
  "contract_name" : "Paris",
  "name": "stations name",
  "address": "address of the station",
  "position": {
    "lat": 48.862993,
    "lng": 2.344294
  },
  "banking": true,
  "bonus": false,
  "status": "OPEN",
  "bike_stands": 20,
  "available_bike_stands": 15,
  "available_bikes": 5,
  "last_update": <timestamp>
}

Hence, our shiny application gets real time information on bike stations in 27 cities.

We also used the modern open-source library leaflet to display city map (open street map).

This application works better on computer than on smartphone because shiny is not fully smartphone friendly. However, Shiny has a user-friendly interface.

If you want to try your own Shiny app, I advice you to check this gallery. It contains a lot of examples that will serve as a good introduction.

Don’t hesitate to follow us on twitter @rdata_lu and to subscribe to our youtube channel.
You can also contact us if you have any comments or suggestions. See you for the next post!