$ show xoolive/traffic
traffic is a Python library and CLI tool for processing, analyzing, and visualizing air traffic data. It ingests trajectory data from multiple sources including OpenSky Network (via REST/Trino), FlightRadar24, Eurocontrol (DDR, AIXM), FAA, and local ADS-B decoders. The core abstractions are `Flight` (single trajectory) and `Traffic` (collection) built on pandas DataFrames, with extensive methods for cleaning, resampling, filtering, geometric operations, navigation event detection (landing, go-around, holding patterns), performance estimation (fuel flow, emissions), and clustering. The library provides a declarative lazy evaluation pipeline (`LazyTraffic`) that chains operations before a single `.eval()` call, enabling efficient parallel processing. It also offers visualization backends for Matplotlib, Altair, Leaflet, and Plotly, and includes a Vue.js/Deck.gl plugin (Tangram) for real-time landing alignment in a web dashboard.
The LLM identified 5 files worth highlighting for reuse:
Implements a lazy evaluation pattern for chaining `Flight` methods on `Traffic` objects. The `@lazy_evaluation` decorator allows transparent stacking of operations that are deferred until `.eval()` is called, at which point they are executed concurrently via multiprocessing. This enables declarative, composable data processing pipelines that are reusable across different trajectory collections.
Provides `Interval` and `IntervalCollection` classes for efficient manipulation of time intervals, supporting union, intersection, subtraction, and containment checks. These are used internally for trajectory segmentation and filtering but are generic enough to be extracted for any application requiring interval algebra, such as scheduling or log analysis.
Defines a set of reusable mixin classes (`DataFrameMixin`, `GeographyMixin`, `ShapelyMixin`, `GeoDBMixin`, `HBoxMixin`) that provide consistent interfaces for data handling, geographic projections, and display. These mixins are used across `Flight`, `Airspace`, and navaid classes, demonstrating a clean, compositional design that can be adopted in other geospatial data libraries.
Contains decorators (`@cache_results`, `@property_cache`) for transparent disk caching of expensive computations, such as API calls and DataFrame operations. The caching is configurable (path, expiration, hash-based filenames) and uses Parquet/JSON serialization. This pattern is self-contained and can be extracted as a standalone caching utility.
Implements a configurable Kalman filter framework with base classes (`FilterBase`, `ProcessXYFilterBase`, `ProcessXYZFilterBase`) and a concrete 6D Kalman filter. The `TrackVariable` descriptor stores state history, and the filter supports smoothing via Rauch-Tung-Striebel. This modular design can be reused for any linear state-estimation task beyond aviation.