pub struct TemporalSampler { /* private fields */ }Expand description
Sampler for temporal patterns in transaction generation.
Implementations§
Source§impl TemporalSampler
impl TemporalSampler
Sourcepub fn with_config(
seed: u64,
seasonality_config: SeasonalityConfig,
working_hours_config: WorkingHoursConfig,
holidays: Vec<NaiveDate>,
) -> Self
pub fn with_config( seed: u64, seasonality_config: SeasonalityConfig, working_hours_config: WorkingHoursConfig, holidays: Vec<NaiveDate>, ) -> Self
Create a temporal sampler with custom configuration.
Sourcepub fn with_full_config(
seed: u64,
seasonality_config: SeasonalityConfig,
working_hours_config: WorkingHoursConfig,
holidays: Vec<NaiveDate>,
industry_seasonality: Option<IndustrySeasonality>,
holiday_calendar: Option<HolidayCalendar>,
) -> Self
pub fn with_full_config( seed: u64, seasonality_config: SeasonalityConfig, working_hours_config: WorkingHoursConfig, holidays: Vec<NaiveDate>, industry_seasonality: Option<IndustrySeasonality>, holiday_calendar: Option<HolidayCalendar>, ) -> Self
Create a temporal sampler with full enhanced configuration.
Sourcepub fn with_industry_seasonality(self, seasonality: IndustrySeasonality) -> Self
pub fn with_industry_seasonality(self, seasonality: IndustrySeasonality) -> Self
Set industry-specific seasonality.
Sourcepub fn with_holiday_calendar(self, calendar: HolidayCalendar) -> Self
pub fn with_holiday_calendar(self, calendar: HolidayCalendar) -> Self
Set regional holiday calendar.
Sourcepub fn set_industry_seasonality(&mut self, seasonality: IndustrySeasonality)
pub fn set_industry_seasonality(&mut self, seasonality: IndustrySeasonality)
Set industry seasonality (mutable reference version).
Sourcepub fn set_holiday_calendar(&mut self, calendar: HolidayCalendar)
pub fn set_holiday_calendar(&mut self, calendar: HolidayCalendar)
Set holiday calendar (mutable reference version).
Sourcepub fn industry_seasonality(&self) -> Option<&IndustrySeasonality>
pub fn industry_seasonality(&self) -> Option<&IndustrySeasonality>
Get the industry seasonality if set.
Sourcepub fn holiday_calendar(&self) -> Option<&HolidayCalendar>
pub fn holiday_calendar(&self) -> Option<&HolidayCalendar>
Get the holiday calendar if set.
Sourcepub fn generate_us_holidays(year: i32) -> Vec<NaiveDate>
pub fn generate_us_holidays(year: i32) -> Vec<NaiveDate>
Generate US federal holidays for a given year.
Sourcepub fn is_weekend(&self, date: NaiveDate) -> bool
pub fn is_weekend(&self, date: NaiveDate) -> bool
Check if a date is a weekend.
Sourcepub fn get_day_of_week_multiplier(&self, date: NaiveDate) -> f64
pub fn get_day_of_week_multiplier(&self, date: NaiveDate) -> f64
Get the day-of-week activity multiplier.
Returns a multiplier based on the day of the week:
- Monday: Higher activity (catch-up from weekend)
- Tuesday: Slightly elevated
- Wednesday/Thursday: Normal
- Friday: Reduced (early departures, winding down)
- Saturday/Sunday: Uses weekend_activity setting
Sourcepub fn is_holiday(&self, date: NaiveDate) -> bool
pub fn is_holiday(&self, date: NaiveDate) -> bool
Check if a date is a holiday.
Sourcepub fn is_month_end(&self, date: NaiveDate) -> bool
pub fn is_month_end(&self, date: NaiveDate) -> bool
Check if a date is month-end (last N days of month).
Sourcepub fn is_quarter_end(&self, date: NaiveDate) -> bool
pub fn is_quarter_end(&self, date: NaiveDate) -> bool
Check if a date is quarter-end.
Sourcepub fn is_year_end(&self, date: NaiveDate) -> bool
pub fn is_year_end(&self, date: NaiveDate) -> bool
Check if a date is year-end.
Sourcepub fn last_day_of_month(date: NaiveDate) -> NaiveDate
pub fn last_day_of_month(date: NaiveDate) -> NaiveDate
Get the last day of the month for a given date.
Sourcepub fn get_date_multiplier(&self, date: NaiveDate) -> f64
pub fn get_date_multiplier(&self, date: NaiveDate) -> f64
Get the activity multiplier for a specific date.
Combines:
- Base seasonality (month-end, quarter-end, year-end spikes)
- Day-of-week patterns (Monday catch-up, Friday slowdown)
- Weekend activity reduction
- Holiday activity reduction (from calendar or legacy list)
- Industry-specific seasonality (if configured)
Sourcepub fn get_base_date_multiplier(&self, date: NaiveDate) -> f64
pub fn get_base_date_multiplier(&self, date: NaiveDate) -> f64
Get the base multiplier without industry seasonality.
Sourcepub fn get_industry_multiplier(&self, date: NaiveDate) -> f64
pub fn get_industry_multiplier(&self, date: NaiveDate) -> f64
Get only the industry seasonality multiplier for a date.
Sourcepub fn sample_date(&mut self, start: NaiveDate, end: NaiveDate) -> NaiveDate
pub fn sample_date(&mut self, start: NaiveDate, end: NaiveDate) -> NaiveDate
Sample a posting date within a range based on seasonality.
Sourcepub fn sample_time(&mut self, is_human: bool) -> NaiveTime
pub fn sample_time(&mut self, is_human: bool) -> NaiveTime
Sample a posting time based on working hours.
Sourcepub fn expected_count_for_date(
&self,
date: NaiveDate,
daily_average: f64,
) -> u64
pub fn expected_count_for_date( &self, date: NaiveDate, daily_average: f64, ) -> u64
Calculate expected transaction count for a date given daily average.