edmt.models

Submodules

Package Contents

class edmt.models.Airdata(api_key: str, skip_auth: bool = False)

Bases: edmt.base.base.AirdataBaseClass

Client for interacting with the Airdata API. Handles authentication and provides methods to fetch various data types such as flights,flight groups, drones, batteries, and pilots.

AccessGroups(endpoint: str) pandas.DataFrame | None
AccessItems(endpoint: str) pandas.DataFrame | None

Sends a GET request to the specified API endpoint and returns normalized data as a DataFrame.

Parameters:

endpoint (str) -- The full API path including query parameters.

Returns:

A DataFrame containing the retrieved data, or None if the request fails.

Return type:

Optional[pd.DataFrame]

get_drones() pandas.DataFrame

Fetch drone data from the Airdata API based on the provided query parameters.

Returns:

A DataFrame containing the retrieved flight data.

If the request fails or no data is found, returns an empty DataFrame.

Return type:

pd.DataFrame

get_batteries() pandas.DataFrame

Fetch batteries data from the Airdata API based on the provided query parameters.

Returns:

A DataFrame containing the retrieved flight data.

If the request fails or no data is found, returns an empty DataFrame.

Return type:

pd.DataFrame

get_pilots() pandas.DataFrame

Fetch pilots data from the Airdata API based on the provided query parameters.

Returns:

A DataFrame containing the retrieved flight data.

If the request fails or no data is found, returns an empty DataFrame.

Return type:

pd.DataFrame

get_flightgroups(sort_by: str = None, ascending: bool = True) pandas.DataFrame

Fetch Flight Groups data from the Airdata API based on query parameters.

Parameters:
  • sort_by (str, optional) -- Field to sort by. Valid values are 'title' and 'created'. If None, no sorting is applied.

  • ascending (bool) -- Whether to sort in ascending order. Defaults to True.

  • id (str, optional) -- Specific ID of a flight group to fetch.

Returns:

DataFrame containing retrieved flight data.

Returns empty DataFrame if request fails or no data found.

Return type:

pd.DataFrame

get_flights(since: str | None = None, until: str | None = None, created_after: str | None = None, battery_ids: str | List[str] | None = None, pilot_ids: str | List[str] | None = None, organizations: str | List[str] | None = None, location: List[float] | None = None, limit: int = 100, max_pages: int = 100, delay: float = 0.1, timeout: int = 15) pandas.DataFrame

Retrieve paginated flight records from the Airdata API.

Fetches flight data by automatically handling offset-based pagination across multiple API requests. Continues until no more results are returned or the maximum page limit is reached.

Parameters:
  • since (str, optional) -- Filter flights that started on or after this ISO 8601 timestamp

  • until (str, optional) -- Filter flights that started before this ISO 8601 timestamp.

  • created_after (str, optional) -- Include only flights created after this ISO 8601 timestamp.

  • battery_ids (str or list, optional) -- Filter by specific battery ID(s). Accepts either a comma-separated string or a list of strings

  • pilot_ids (str or list, optional) -- Filter by specific pilot ID(s).

  • organizations (str or list, optional) -- Filter flights by participant organization(s). Accepts either a single organization name or a list of organization names. Only flights with at least one participant belonging to one of the specified organizations are returned.

  • location (list, optional) -- Geographic center point for radius-based search as [latitude, longitude].

  • limit (int, optional) -- Number of records per page. Must be ≤ 100. Defaults to 100.

  • max_pages (int, optional) -- Maximum number of pages to retrieve. Prevents excessive API usage. Defaults to 100.

Returns:

A DataFrame containing all retrieved flight records with standardized columns. Returns an empty DataFrame if:

  • No flights match the query parameters

  • API returns an error

  • Authentication fails

Return type:

pd.DataFrame

Raises:

ValueError -- If location is provided but doesn't contain exactly two numeric elements (latitude and longitude).

edmt.models.get_flight_routes(df: pandas.DataFrame, filter_ids: List | None = None, max_workers: int = 8, lon_col: str = 'longitude', lat_col: str = 'latitude', time_col: str = 'time(millisecond)', crs: str = 'EPSG:4326') geopandas.GeoDataFrame

Extract flight routes from a DataFrame containing flight metadata and CSV URLs.

This function processes each flight record in the input DataFrame, retrieves the associated CSV file containing flight data, and computes the flight route as a LineString geometry. It supports filtering by specific flight IDs and parallel processing for efficiency.

Parameters:
  • df (pd.DataFrame) -- DataFrame containing flight metadata, including a column named 'csvLink' with URLs to CSV files.

  • filter_ids (list, optional) -- List of flight IDs to process. If provided, only flights with IDs in this list will be processed.

  • max_workers (int, optional) -- Number of parallel download threads.

  • lon_col (str, optional) -- Column name for longitude.

  • lat_col (str, optional) -- Column name for latitude.

  • time_col (str, optional) -- Column name for timestamp.

  • crs (str, optional) -- Coordinate Reference System for the output GeoDataFrame.

Returns:

A GeoDataFrame with one row per flight, containing the

flight metadata and a LineString geometry representing the flight route.

Return type:

gpd.GeoDataFrame

edmt.models.airPoint(*args, **kwargs)
edmt.models.airLine(*args, **kwargs)
edmt.models.airSegment(*args, **kwargs)