(In progress - Basic direction timing captured, now working on saving it into a database)
TimeTraveler is a route traffic analysis system designed to study and compare traffic patterns on specific routes over time across different modes. It captures and analyzes route data at 15-minute intervals, to deliver insight on traffic patterns across days, weeks, months and years.
- Python 3.11 or higher
- PostgreSQL 15 or higher
- Virtual environment tool (venv recommended)
- Clone the repository:
git clone https://github.com/thushana/timetraveler
cd timetraveler
- Create and activate a virtual environment:
python -m venv timetraveler_venv
source timetraveler_venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env # Edit .env with your configuration settings
- Initialize the database:
python scripts/setup_db.py
Common project tasks can be simplified using the provided Makefile
commands:
-
Set up the environment and initialize the database:
make setup
-
Run the journey cron script in debug mode:
make run
-
Apply Alembic migrations manually:
make migrate
-
Reset the database (drop and recreate):
make reset-db
-
Clean the virtual environment:
make clean
We carefully considered how to divide and track time in our system. After exploring various options, including looking into Department of Transportation standards, we settled on a structure that combines precise measurement intervals with natural time periods:
- We use 15-minute measurement intervals, based on reading the FHWA Traffic Monitoring Guide and Travel Time Data Collection Handbook (Source)
- We divided the 24-hour day into six equal 4-hour periods:
- Overnight (00:00-03:59)
- Dawn (04:00-07:59)
- Morning (08:00-11:59)
- Afternoon (12:00-15:59)
- Evening (16:00-19:59)
- Night (20:00-23:59)
- Each poll of the travel time is slotted into one of these intervals to speed analysis.
References: