Skip to main content

antecedent_data/
sample_policy.rs

1//! Sample construction policies.
2//!
3//! Distinct from `antecedent_counterfactual::AbductionMissingPolicy` (abduction).
4//!
5//! SPDX-License-Identifier: MIT OR Apache-2.0
6
7/// How missing values (validity bits) affect row selection.
8#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Default)]
9pub enum MissingPolicy {
10    /// Drop any row where a requested column is invalid.
11    #[default]
12    CompleteCase,
13    /// Fail if any requested column has an invalid value in a candidate row.
14    ErrorOnMissing,
15}
16
17/// How the optional analysis mask is applied.
18#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Default)]
19pub enum MaskPolicy {
20    /// Intersect the analysis mask with complete-case / validity filtering.
21    #[default]
22    Honor,
23    /// Ignore the analysis mask (still apply missingness policy).
24    Ignore,
25}
26
27/// How observation weights are exposed on the prepared sample.
28#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Default)]
29pub enum WeightPolicy {
30    /// Use storage weights when present; otherwise unit weights.
31    #[default]
32    Honor,
33    /// Always use unit weights.
34    Unit,
35    /// Ignore weights entirely (`PreparedSample.weights` is `None`).
36    Ignore,
37}