<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/bike-services-api-shiny-nice-app/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.blog.rdata.lu/post/2018-02-20-api-shiny-nice-app/"> rdata.lu Blog | Data science with R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p></p>
<p>Hi everyone,</p>
<p>In this blog post, I will be short and I will introduce our <a rel="nofollow" href="http://blog.rdata.lu/visualization/bike/" target="_blank">shiny application</a> on bike self-service stations. </p>
<div>
<video width="450" controls><source type="video/mp4" src="https://www.r-bloggers.com/video/demo_bike.mp4">Your browser does not support the video tag.</video>
</div>
<p>The code is in 2 parts, the <a rel="nofollow" href="https://github.com/krosamont/shiny_bike/blob/master/ui.R" target="_blank">ui.R</a> file for the interface and the <a rel="nofollow" href="https://github.com/krosamont/shiny_bike/blob/master/server.R" target="_blank">server.R</a> file for the backend. You can check the code on <a rel="nofollow" href="https://github.com/krosamont/shiny_bike/" target="_blank">GitHub</a> 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 </p>
<p>The JCDecaux API gives the data under the following format:</p>
<pre><code>{
  &quot;number&quot;: 123,
  &quot;contract_name&quot; : &quot;Paris&quot;,
  &quot;name&quot;: &quot;stations name&quot;,
  &quot;address&quot;: &quot;address of the station&quot;,
  &quot;position&quot;: {
    &quot;lat&quot;: 48.862993,
    &quot;lng&quot;: 2.344294
  },
  &quot;banking&quot;: true,
  &quot;bonus&quot;: false,
  &quot;status&quot;: &quot;OPEN&quot;,
  &quot;bike_stands&quot;: 20,
  &quot;available_bike_stands&quot;: 15,
  &quot;available_bikes&quot;: 5,
  &quot;last_update&quot;: </code></pre>