This directory contains the dbt (data build tool) project for managing the analytics database of the Glideator platform - a machine learning-powered paragliding weather forecasting system.
This dbt project transforms raw flight data scraped from XContest and launch site data from the Paragliding Map API into a clean, analytics-ready format. The pipeline creates fact and dimension tables that feed into machine learning models for predicting paragliding conditions.
dbt_project.yml: Main configuration file defining the project structure and materialization strategiesprofiles.yml: Database connection configuration using environment variables for PostgreSQL.user.yml: User-specific settings (automatically generated)
flights/: Raw flight data from XContest, filtered to exclude hang gliders and unknown launchesstg_flights.sql: Cleans and standardizes flight data (coordinates, site names, etc.)_flights_sources.yml: Source configuration for the flights table
launches/: Launch site data from the Paragliding Map APIstg_launches.sql: Transforms launch site data including wind conditions and activity status_launches_sources.yml: Source configuration for the launches table
dim_sites.sql: Dimension table of launch sites with GFS weather grid coordinatesdim_launches.sql: Dimension table of launch sites with detailed metadatafact_flights.sql: Core fact table containing all flight data joined with site informationmart_daily_flight_stats.sql: Daily aggregated flight statistics by site for ML model training
seed_sites.csv: Master reference data for launch sites with coordinates and metadataseed_launch_mapping.csv: Mapping between different site naming conventionsseed_sites_old.csv: Legacy site data for backward compatibility
create_udfs.sql: Main macro that creates all user-defined functionsudfs/: PostgreSQL user-defined functions for weather data processing:get_gfs_coordinates.sql: Maps site coordinates to GFS weather grid pointsget_wind_direction.sql: Calculates wind direction from componentsget_wind_speed.sql: Calculates wind speed from componentsbin_wind_direction.sql: Bins wind direction into categorical ranges
- Raw Data: Flight data from XContest and launch site data from Paragliding Map API
- Staging: Clean and standardize data formats, filter out invalid records
- Mart: Create dimensional model with sites, launches, and flight facts
- Aggregation: Generate daily statistics for ML model training
The project uses a multi-schema approach:
source: Raw data tablesstage: Staging models (views)mart: Final dimensional models (views)glideator: Main application schema
dbt-core # Core dbt functionality
dbt-postgres # PostgreSQL adapter
psycopg2-binary # PostgreSQL Python driver
python-dotenv # Environment variable management
xarray # N-dimensional data processing
sqlalchemy # SQL toolkit
fastkml/lxml/pykml # KML/KMZ file processing
bs4 # HTML/XML parsing
-
Install dependencies:
pip install -r db_requirements.txt
-
Set environment variables:
export DB_HOST=localhost export DB_USER=postgres export DB_PASSWORD=your_password export DB_NAME=glideator export DB_PORT=5432
-
Initialize database schema: The project automatically creates the
glideatorschema and required UDFs on first run.
Navigate to the db/glideator directory and run:
# Install dependencies and compile project
dbt deps
dbt compile
# Run all models
dbt run
# Run tests
dbt test
# Build everything (run + test)
dbt build
# Generate documentation
dbt docs generate
dbt docs serve# Run specific models
dbt run --select stg_flights
dbt run --select mart.fact_flights
# Run models downstream from a specific model
dbt run --select +fact_flights
# Test specific models
dbt test --select dim_sitesThe project includes:
- Source data validation through schema definitions
- Geospatial filtering to remove flights too far from registered launch sites
- Site name normalization to handle inconsistencies between data sources
- Automatic UDF creation for weather data processing
The mart models feed directly into the Glideator ML pipeline:
fact_flightsprovides historical flight data for trainingdim_sitesprovides launch site metadata and GFS coordinatesmart_daily_flight_statsprovides aggregated features for model training
- Staging models: Materialized as views for real-time data access
- Mart models: Materialized as views for flexibility and storage efficiency
- Seeds: Static reference data loaded as tables