preprocessing.target_corruption.TargetCorruptionReport(
fired,
n_flagged_cells,
n_flagged_hours,
spans,
action,
first_flagged_hour,
pre_policy_last_target,
)
Immutable summary of a target-corruption detection and policy run.
Parameters
fired
bool
True when the detector identified at least one flagged hour-slot; False means no corruption was found (or the detector was not configured).
required
n_flagged_cells
int
Number of native-cadence (e.g. 15-min) slots that were flagged across all target columns.
required
n_flagged_hours
int
Number of distinct calendar hours that contain at least one flagged slot.
required
spans
List [Tuple [str , str ]]
Contiguous flagged hour-runs as (start_iso, end_iso) string pairs. Empty list when the detector did not fire.
required
action
str
The policy action taken: one of "abort", "heal", "truncate", or "noop".
required
first_flagged_hour
Optional [pd .Timestamp ]
The earliest flagged calendar hour, as a tz-aware pd.Timestamp floored to the hour, or None when the detector did not fire.
required
pre_policy_last_target
Optional [pd .Timestamp ]
The last observed-target timestamp BEFORE any policy mutation. None when the detector did not fire. Used by the "truncate" path in prepare_data to compute how many hours were retracted so that predict_size can be bumped idempotently.
required
Examples
from spotforecast2_safe.preprocessing.target_corruption import (
TargetCorruptionReport,
)
report = TargetCorruptionReport(
fired= False ,
n_flagged_cells= 0 ,
n_flagged_hours= 0 ,
spans= [],
action= "noop" ,
first_flagged_hour= None ,
pre_policy_last_target= None ,
)
print (report.fired, report.action)
assert not report.fired
assert report.action == "noop"