This project implements a software system to monitor the means of public transport in Dublin and provide recommendations for their sustainable and efficient management. The supported types of public transport include buses, bikes, trams and pedestian ways.
The real-time monitoring part of the system collects data from publicly available APIs. It visualises information about most delayed bus routes, current availability of shared bikes per station, position of trams and pedestian footfall density. It also includes forecasts about bike availability in the next hours through a custom Prophet model.
Moreover, the system provides two different types of recommendations. First, a greedy algorithm proposes dynamic bike reallocation between neighbouring stations, to prevent stations from running out of bikes. Second, a genetic algorithm is used to optimise bus and tram timetables. The algorithm takes as input the target number of daily routes, and the time of the first and the last routes. The optimisation objectives are the minimisation of the passenger waiting time and the approximation of the target number of routes.
The software system consists of 4 distinct components:
- A Postgres database.
- An ETL pipeline implemented with pySpark that ingest data from the publicly available transport APIs and stores it in the database.
- An MVC web application implemented with Django that covers backend functionalities.
- A Streamlit frontend application.
-
Create virtual environments and install requirements:
cd backend python -m venv venv source venv/bin/activate pip install -r requirements cd frontend python -m venv venv source venv/bin/activate pip install -r requirements cd etl python -m venv venv source venv/bin/actinvate pip install -r requirements
-
Run migrations
cd backend python manage.py makemigrations python manage.py migrate
-
Run ETL pre-deployment scripts
cd etl python scripts.py
-
Run the ETL pipeline
spark-submit --master local[*] --jars ./Driver/postgresql-42.7.1.jar ./ingest.py
-
Start the Django application
python manage.py runserver
-
Start the streamlit application
streamlit run streamlit-app.py
You can watch a demonstration here and a high-level presentation of the project here