from typing import Optional from pydantic import BaseModel, ConfigDict, Field class DriftCalRow(BaseModel): sample_id: str scenario_id: str split: str shift_type: str = Field(description="none|covariate|label|concept|novel_class|adversarial") shift_magnitude: float difficulty: str = Field(description="easy|medium|hard|expert") label_binary: int = Field(ge=0, le=1) label_family: str family_id: int family_is_novel: bool perturbation_applied: bool perturbation_budget: float spurious_shuffled: bool = Field( description="True only in the spurious_ablation eval, where spurious " "feature columns have been permuted across rows to break their " "correlation with the label" ) generator_seed: int timestamp_synth: int provenance: str = "synthetic:driftcal-v0.1-validation" qc_status: str = "unchecked" # feature_* columns are validated separately (70 numeric columns) rather # than declared individually here to keep the schema readable; see # DATASET_SCHEMA.md for the full per-feature-block description. model_config = ConfigDict(extra="allow")