The goal of this project is to get Brussels mobility data that are available to the public.
Ultimately, we want to display traffic data as well as other mobility data on a dynamic map of Brussels. You can check the latest version of our map on our Tableau Online link (you will have to create an account).
For the moment, we only have snapshots of real-time data that were extracted at certain points in time.
On several locations in the Brussels Region, traffic is measured using magnetic loops or cameras. To access this data, we can use the API or the geowebservices. For the moment, only real-time data is available, historical data is coming.
In this project, we use the API. For more information on the latter, please visit the Brussels open datastore documentation.
In the Traffic counts api
folder, you'll find
- the
API to CSV
folder explaining how to extract data via the public API and store them in .csv files. The folder contains:- a Jupyter Notebook detailing how to get the latest livestream data (the last 1-min interval available) for all detectors by traverse or by lane each time the code is run. We're going to extract, among other things, the number of vehicules passed between start and end time as well as the average speed of those counted vehicules.
- 2 .csv files (outputs of the code once run):
traverse_devices.csv
: the details of each device (magnetic loop or camera) such as name, longitude, latitude, etc.traverse_live.csv
: the traffic data measured by all devices at several points in time such as the number of vehicules passed during the 1-min interval, the average speed of those counted vehicules, etc.
- the
API to BQ
folder explaining how to extract data via the public API and store them in BigQuery tables. The folder contains:- a Jupyter Notebook detailing the same procedure as the one in the
API to CSV
folder except that the outputs are stored in BigQuery tables. The notebook was developed in Google Cloud Datalab in the Google Cloud Platform environment in order to easily create BigQuery tables. - the
Google Cloud Function
subfolder containing:- the
main.py
script that we scheduled to be run every minute in order to update our BigQuery tables. You'll notice that we transformed the code you can find in the Jupyter Notebook into functions so that it can be triggered by a scheduler. We detail how we did implement scheduled refresh of our database in a below section. - the
requirements.txt
which detail the specific version of some libraries that are needed.
- the
- a Jupyter Notebook detailing the same procedure as the one in the
The number of bikers are counted on several locations in the Brussels Region. The number of counters will be extended in the next years. To access the data, we can use the API or the geowebservices. Real time and historical data are available.
In this project, we use the API. For more information on the latter, please visit the Brussels open datastore documentation.
In the Bike counts api
folder, you'll find a Jupyter Notebook detailing how to get the latest livestream data for all bike counting poles each time the code is run. We're going to extract the livestream count with the number of bikers passed last hour, day and year. The counts are only updated when a bike passes the sensor.
You'll also find in the folder 2 .csv files (outputs of the code once run):
pole_devices.csv
: the details of each bike counting pole such as name, longitude, latitude, etc.pole_live.csv
: the information captured by all bike counting poles at several points in time such as the number of bikers passed last hour, etc.
How our BigQuery Tables are updated in Google Cloud Platform environment and then published in Tableau
- In order to update our BigQuery tables every minute, we defined a Google Cloud Function (cfr.
main.py
script) that will add livestream traffic data to our BigQuery tables each time it is triggered. - We then used Google Cloud Scheduler to schedule the function to be ran every minute.
- We connected directly our Tablea dashboard to our BigQuery tables through the user interface.
- Finally, we set up a hourly refresh of our dataset through Tableau.
- Improve current visualizations and develop new ones in Tableau
- Shift from .csv files to BigQuery tables to store bike information
- Add bike information on the map
- Add Villo! real-time data on the map
- Develop AI models to predict traffic and usage of bikes