Skip to content
/ velib Public

doing things with open data about Paris' Vélib'

Notifications You must be signed in to change notification settings

VJean/velib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Velib

Make use of a dataset from opendata.paris.fr (Vélib' - Disponibilité temps réel), that is updated every minute, and describes the status of every Vélib' station.

Get the data

get-records.sh pulls the data from the API.

No need to create an account, the quota for an anonymous access is limited to 5000 queries a day, which is enough for this use case. (5000 queries/day == 3 queries/minute)

What I did was putting get-records.sh in a crontab to be executed every minute and 20 seconds. In case the data wasn't available at this time, I put a second cron entry 30 seconds later. The script make sure that it doesn't pull the same data twice in a row.

Here's a trick to get around the minute-resolution of crontab (credits) :

* * * * * sleep 20 ; ~/velib/get-records.sh >> ~/velib/velib.log 2>&1
* * * * * sleep 50 ; ~/velib/get-records.sh >> ~/velib/velib.log 2>&1

Display in Grafana

datasource.py was created to serve datapoints by acting as a datasource for Grafana. Note: this has not been tested since 2019.

Generate reports

velib.py is a one-file-fits-all script that provides functions to generate static and animated charts based on the data available. This is in a draft state for now and could be greatly improved.

Python libraries

Uses Cartopy, which depends on geos and proj. On archlinux: sudo pacman -S geos proj and also Cython (pip)

Proj version error: see SciTools/cartopy#1289 (comment) Let's target cartopy@23e31dd to get the compatibility with proj >= 6 Cartopy requirements needs to be specified as: git+https://github.com/SciTools/cartopy.git@23e31dd#egg=Cartopy

About

doing things with open data about Paris' Vélib'

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published