app.data_loader¶
data_loader ¶
DuckDB-based data engine for lazy querying of BirdCurve data sources.
DataEngine ¶
Unified query engine. Attaches the on-disk DuckDB read-only and discovers model/forecast dirs.
Source code in dashboard/backend/app/data_loader.py
query_wide ¶
query_wide(table: str, columns: list[str], start: str | None = None, end_exclusive: str | None = None, timestamp_col: str = 'timestamp_utc') -> list[dict]
Select named wide-schema columns + timestamp, optionally filtered
by [start, end_exclusive). Callers with an inclusive calendar-date end
promote it via _helpers.end_exclusive() first.
Source code in dashboard/backend/app/data_loader.py
query_forecast_file ¶
query_forecast_file(scenario: str, filename_pattern: str, start: str | None = None, end_exclusive: str | None = None, datetime_col: str | tuple[str, ...] | None = None) -> list[dict]
Query a forecast .feather or .csv file from a scenario directory,
filtered to [start, end_exclusive). Callers with an inclusive
calendar-date end promote it via _helpers.end_exclusive() first.
NOTE: DuckDB read_parquet() CANNOT read .feather (Arrow IPC) files. Feather files are loaded via pandas.read_feather() and registered as cursor-local DuckDB tables for SQL filtering.
Returns [] when the file or expected datetime column is missing (so callers don't need to special-case partial scenario dirs).