tseda.dataloader.ticket_resolution_data_loader module

Downloader and normalizer for an hourly ticket-resolution time series.

class tseda.dataloader.ticket_resolution_data_loader.TicketResolutionDataLoader(file_path: str = 'data/ticket_resolution_hourly_nyc311.csv', lookback_days: int = 30)[source]

Bases: LocalDataLoader

Build an hourly resolved-ticket count dataset from NYC 311 closed tickets.

Configure output location and default lookback window.

Parameters:
  • file_path – Destination CSV path for prepared hourly data.

  • lookback_days – Number of days to include ending at current UTC hour.

__init__(file_path: str = 'data/ticket_resolution_hourly_nyc311.csv', lookback_days: int = 30) None[source]

Configure output location and default lookback window.

Parameters:
  • file_path – Destination CSV path for prepared hourly data.

  • lookback_days – Number of days to include ending at current UTC hour.

download_and_prepare(start_utc: datetime | None = None, end_utc: datetime | None = None) pandas.DataFrame[source]

Download, aggregate, regularize, and persist hourly resolved ticket counts.

The output is constrained for tseda ingestion: 1) exactly two columns (date, signal), 2) regular hourly cadence, 3) no missing values, and 4) at most 2,000 rows.

Parameters:
  • start_utc – Optional inclusive window start in UTC.

  • end_utc – Optional inclusive window end in UTC.

Returns:

Prepared DataFrame written to self.file_path.

load_ticket_resolution(refresh: bool = False, start_utc: datetime | None = None, end_utc: datetime | None = None) pandas.DataFrame[source]

Load prepared ticket-resolution data; download first if missing or refresh requested.

Returns:

DataFrame with columns date and signal. Returns an empty DataFrame if source data cannot be loaded.

get_series(refresh: bool = False, start_utc: datetime | None = None, end_utc: datetime | None = None) pandas.Series[source]

Return the hourly ticket-resolution count as a pandas Series indexed by date.

Returns:

signal series indexed by date. Returns an empty float series when no data is available.