Skip to content
This repository has been archived by the owner on Nov 21, 2021. It is now read-only.
/ Paris-Dashboard Public archive

Display the Paris Metro schedules 🚇 and the number of Velibs 🚴 (bicycle-system in Paris) available.

Notifications You must be signed in to change notification settings

ibaaj/Paris-Dashboard

Repository files navigation

update

2017 : Now, the RATP Group is letting everyone access their realtime API : I will release a proper code and tutorial for this project ASAP.

#Paris Dashboard ⚡️

🌀 Display the Paris Metro schedules 🚉 and the number of Velibs 🚲 (bicycle-system) available just near my home 😌.

Requirements 👜

You need an Arduino board 💎 with PWM and Digital outputs. As "4-digit 7-segment display" 💫 I bought 3x TM1637 (3*~8€), which requires 1x PWM intput (CLK), 1x Digital intput (DIO) and 5V input for each.

It's very easy to communicate 📢 with a TM1637.

#include "TM1637Display.h"
#define CLK_TM1637 7       
#define DIO_TM1637 42
TM1637Display tm1637(CLK_TM1637,DIO_TM1637);

void setup()
{
  tm1637.setBrightness(0x0f);
  tm1637.showNumberDec(1337,false,4,0);
}  
void loop() {
}

using this library.

To communicate with my Arduino board, I use simply the screen shell function 💻.

How it works ?

Get RATP schedules 📋 and alerts 💩 in realtime 🌟

GTFS Data

Definition from Wikipedia (en)

A GTFS feed is a collection of CSV files (with extension .txt) contained within a .zip file. Together, the related CSV tables describe a transit system's scheduled operations. The specification is designed to be sufficient to provide trip planning functionality, but is also useful for other applications such as analysis of service levels and some general performance measures. GTFS only includes scheduled operations, and does not include real-time information.

Downloads

It's a little bit difficult to understand how the data is linked 🔬, but you will find the station-id of your station in stops.txt, all the stop schedules (but not the full date, just hh:mm:ss) of your station in stop_times.txt (and all the trips)..

Parser

I recommend to use a parser to aggregate the data. I extracted them with "Node-GTFS" which contains a lot of methods to query for agencies, routes, stops and times. But you can easily find another one in another language.

Real time

To detect if an issue happened 🔶, you can use the Twitter Streaming API and get all the new tweets of one RATP line. As they always use the same sentences, you will be able to detect if there is a problem or not, or when it has disappeared.

This example will print the new tweets from TWEET_ID_RATP_LINE using TwitterAPI (python)

api = TwitterAPI(consumerKey,consumerSecret,accessToken, accessTokenSecret)

r = api.request('statuses/filter', {'follow': TWITTER_ID_RATP_LINE })

for item in r:
    print(item['text'] if 'text' in item else item)

When there is a new tweet, you have to check 👓 what is happening. Check if it contains words that refer to an issue ( "colis", "ralenti", "interrompu") or an end of issue ("Retour", "reprise", "régulier" ) or other thing.

Those words can be found by analyzing what are the most used words by the community manager.

You can get the 💯x most used words in a file with :

tr -c '[:alnum:]' '[\n*]' < file.txt | sort | uniq -c | sort -nr | head  -100

Just save a html page with a lot of tweets of one RATP line account and fire that query.

They always use the same sentences 😊 :

grep RER A

Twitter accounts :

Wap 💥

You can "grep" the RATP wap site, but it's clearly not adviced ❗️ - the "CheckMyMetro" app got a lot of issues using this way with RATP.

curl --silent -A "Mozilla/5.0" "http://wap.ratp.fr/{YOURURI}" 2>&1 | grep -E -o "([0-9]+) mn"

Get the number of available bikes 🚲 in a Velib station

✏️ Register an account here and get an API key 🔑.

You can get what you want with a simple query (edit STATIONID and KEY) :

URL_VELIB="https://api.jcdecaux.com/vls/v1/stations/{STATIONID}?contract=paris&apiKey={KEY}"
curl --silent "$URL_VELIB" 2>&1 \
| grep -E -o "\"available_bikes\":[0-9]+," | \
| awk -F ':' '{ print $2 }' | cut -d , -f1;

About 👀

🙏 Special Thanks to : Pupanimbas, Wyb0t, Mathemagie, FrançoisG, E-S, & difrrr.

If you have any question, open an issue.

M.Berchon invited me to introduce this project at the « Paris Hardware Startup Meetup #2 »

Paris Hardware Startup Meetup #2 Paris Hardware Startup Meetup #2

License

About

Display the Paris Metro schedules 🚇 and the number of Velibs 🚴 (bicycle-system in Paris) available.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published