pat2vec.util.generate_date_list

Functions

generate_date_list(start_date, years, ...[, ...])

Generates a list of dates within a range, constrained by global boundaries.

pat2vec.util.generate_date_list.generate_date_list(start_date, years, months, days, time_window_interval_delta=relativedelta(days=+1), config_obj=None)[source]

Generates a list of dates within a range, constrained by global boundaries.

This function calculates a date range based on a start date and a duration (defined by years, months, days). It then generates a list of dates within this range at a specified interval (time_window_interval_delta). The final list is clamped to global start and end dates defined in the config_obj.

Parameters:
  • start_date (datetime) – The anchor date for the calculation.

  • years (int) – The number of years to add or subtract.

  • months (int) – The number of months to add or subtract.

  • days (int) – The number of days to add or subtract.

  • time_window_interval_delta (relativedelta) – The step interval between dates.

  • config_obj (Optional[Any]) – A configuration object with ‘lookback’ and global date attributes (e.g., global_start_year).

Return type:

List[Tuple[int, int, int]]

Returns:

A chronologically sorted list of (year, month, day) tuples.