This project demonstrates the development of an ETL (Extract, Transform, Load) pipeline using Apache Airflow and BashOperator to automate toll data processing across diverse file formats. It was completed as the final project for Course 8 – ETL and Data Pipelines with Shell, Airflow, and Kafka in the IBM Data Engineering Professional Certificate.
- Extract data from CSV, TSV, and fixed-width file formats
- Transform and consolidate traffic toll data
- Automate the entire ETL process using Apache Airflow DAGs and Bash
- Output a single cleaned and transformed dataset for staging and further analysis
| Category | Tools/Technologies |
|---|---|
| Workflow Orchestration | Apache Airflow, BashOperator |
| Scripting & Utilities | Bash (cut, paste, tr, tar, curl) |
| File Formats | CSV, TSV, Fixed-width text |
- Unpacks
tolldata.tgzinto a working directory usingtar. - This is the first step to make the raw data files accessible to subsequent tasks.
- Extracts
Rowid,Timestamp,Anonymized Vehicle number, andVehicle typefromvehicle-data.csv. - Uses the
cutcommand to select only the first four columns of the CSV.
- Extracts
Number of axles,Tollplaza id, andTollplaza codefromtollplaza-data.tsv. - Fields are tab-separated;
cut -f5-7selects the required columns.
- Extracts
Type of Payment codeandVehicle Codefrom specific character ranges inpayment-data.txt. - Uses
cut -c59-67to grab the character positions andtrto clean spacing.
- Merges all extracted files into
extracted_data.csvusing thepastecommand. - This horizontally combines the extracted columns from all sources into one file.
- Capitalizes all values in the
vehicle_typecolumn usingtr. - The result is saved as
transformed_data.csvin the staging area.
The pipeline outputs a cleaned, consolidated file:
data/staging/transformed_data.csv
This file contains the following fields:
- Rowid
- Timestamp
- Anonymized Vehicle number
- Vehicle type (converted to uppercase)
- Number of axles
- Tollplaza id
- Tollplaza code
- Type of Payment code
- Vehicle Code
- Processed 10,000 records in 0.1 seconds (approximately 100,000 rows per second) on a local machine.
- Demonstrates the pipeline’s ability to handle high-throughput data preparation efficiently.
- DAG ID:
ETL_toll_data - Schedule: Daily
- Owner: Roy
- Retries: 1 (with 5-minute delay)
- Email alerts: Enabled for failure and retry
ETL_Toll_Data_Pipeline_Project/
├── README.md # Project overview, objectives, tools, and instructions
├── airflow/
│ └── ETL_toll_data.py # Final Airflow DAG script automating the ETL pipeline
├── data/
│ ├── raw/ # Original input files extracted from tolldata.tgz
│ │ ├── vehicle-data.csv # Vehicle metadata (CSV format)
│ │ ├── tollplaza-data.tsv # Toll plaza details (TSV format)
│ │ ├── payment-data.txt # Payment info in fixed-width text format
│ ├── staging/ # Intermediate and final output from ETL pipeline
│ │ ├── csv_data.csv # Extracted columns from vehicle-data.csv
│ │ ├── tsv_data.csv # Extracted columns from tollplaza-data.tsv
│ │ ├── fixed_width_data.csv # Extracted fields from payment-data.txt
│ │ ├── extracted_data.csv # Consolidated output of all extracted sources
│ │ └── transformed_data.csv # Final cleaned and capitalized output file
├── docs/
│ └── fileformats.txt # Provided documentation for file formats and field positions
├── images/ # Screenshots used for verification and documentation of DAG setup, execution, and task success
│ ├── dag_paused.png # DAG listed in Airflow but paused
│ ├── dag_active.png # DAG unpaused and active
│ ├── dag_tasks_success.png # Visual confirmation of successful task execution
│ ├── dag_run_triggered.png # Screenshot of DAG run and timing info
-
Place the entire project folder inside your Airflow DAGs directory:
~/airflow/dags/ETL_Toll_Data_Project/ -
Launch the Airflow UI in your browser and ensure the DAG
ETL_toll_dataappears. -
Unpause the DAG using the toggle switch.
-
Trigger the DAG manually from the Airflow UI or let it run according to its schedule.
-
After the DAG run completes, the output file will be located at:
data/staging/transformed_data.csv
This project was completed as part of the IBM Data Engineering Professional Certificate and is intended for educational use.