pub struct MetricsCalculator {
pub thresholds: IsoQualityConfig,
/* private fields */
}Expand description
Engine for calculating comprehensive data quality metrics.
Fields§
§thresholds: IsoQualityConfigConfigurable quality thresholds and score weights.
Implementations§
Source§impl MetricsCalculator
impl MetricsCalculator
Sourcepub fn new() -> MetricsCalculator
pub fn new() -> MetricsCalculator
Create a new calculator with default quality settings.
Sourcepub fn with_thresholds(thresholds: IsoQualityConfig) -> MetricsCalculator
pub fn with_thresholds(thresholds: IsoQualityConfig) -> MetricsCalculator
Create a calculator with custom thresholds
Sourcepub fn strict() -> MetricsCalculator
pub fn strict() -> MetricsCalculator
Create a calculator with strict thresholds (finance, healthcare)
Sourcepub fn lenient() -> MetricsCalculator
pub fn lenient() -> MetricsCalculator
Create a calculator with lenient thresholds (exploratory, marketing)
Sourcepub fn with_row_completeness(
self,
summary: Option<RowCompletenessSummary>,
) -> MetricsCalculator
pub fn with_row_completeness( self, summary: Option<RowCompletenessSummary>, ) -> MetricsCalculator
Supply the engine’s exact complete-record count over the full stream.
Without it the completeness dimension can only report a lower bound
for complete_records_ratio, because per-column null totals do not
say whether two nulls shared a record.
Sourcepub fn validate_sample_size(
sample_size: usize,
metric_type: &str,
) -> StatisticalValidation
pub fn validate_sample_size( sample_size: usize, metric_type: &str, ) -> StatisticalValidation
Validate statistical requirements for metric calculation
Sourcepub fn calculate_comprehensive_metrics(
&self,
data: &HashMap<String, Vec<String>>,
column_profiles: &[ColumnProfile],
requested_dimensions: Option<&[QualityDimension]>,
) -> Result<QualityMetrics, DataProfilerError>
pub fn calculate_comprehensive_metrics( &self, data: &HashMap<String, Vec<String>>, column_profiles: &[ColumnProfile], requested_dimensions: Option<&[QualityDimension]>, ) -> Result<QualityMetrics, DataProfilerError>
Calculate comprehensive data quality metrics from column data.
When requested_dimensions is None, all dimensions are computed
(backward-compatible default). When Some(&[...]), only the listed
dimensions are computed; the rest are None in the returned struct.
Sourcepub fn calculate_comprehensive_metrics_with_hints(
&self,
data: &HashMap<String, Vec<String>>,
column_profiles: &[ColumnProfile],
requested_dimensions: Option<&[QualityDimension]>,
semantic_hints: &SemanticHints,
row_duplicates: Option<RowDuplicateSummary>,
) -> Result<QualityMetrics, DataProfilerError>
pub fn calculate_comprehensive_metrics_with_hints( &self, data: &HashMap<String, Vec<String>>, column_profiles: &[ColumnProfile], requested_dimensions: Option<&[QualityDimension]>, semantic_hints: &SemanticHints, row_duplicates: Option<RowDuplicateSummary>, ) -> Result<QualityMetrics, DataProfilerError>
Calculate comprehensive metrics with explicit semantic column hints and, when the engine tracked whole rows, full-stream duplicate counts that supersede the sample-based duplicate scan.
Sourcepub fn calculate_bifurcated_metrics(
&self,
data: &HashMap<String, Vec<String>>,
column_profiles: &[ColumnProfile],
requested_dimensions: Option<&[QualityDimension]>,
) -> Result<BifurcatedResult, DataProfilerError>
pub fn calculate_bifurcated_metrics( &self, data: &HashMap<String, Vec<String>>, column_profiles: &[ColumnProfile], requested_dimensions: Option<&[QualityDimension]>, ) -> Result<BifurcatedResult, DataProfilerError>
Calculate quality metrics with bifurcated computation for streaming.
Phase A (exact from global counters): Completeness metrics are computed
from ColumnProfile stats (null_count, total_count) which are exact
even for infinite streams. Key uniqueness already uses ColumnProfile.
Phase B (sampled): Consistency, Accuracy, and Timeliness are computed from the bounded reservoir sample. Duplicate rows use a full-stream row tracker when supplied; otherwise they fall back to an aligned sample.
Returns a BifurcatedResult containing the metrics plus provenance
for which dimensions are exact vs sampled.
Sourcepub fn calculate_bifurcated_metrics_with_hints(
&self,
data: &HashMap<String, Vec<String>>,
column_profiles: &[ColumnProfile],
requested_dimensions: Option<&[QualityDimension]>,
semantic_hints: &SemanticHints,
row_duplicates: Option<RowDuplicateSummary>,
) -> Result<BifurcatedResult, DataProfilerError>
pub fn calculate_bifurcated_metrics_with_hints( &self, data: &HashMap<String, Vec<String>>, column_profiles: &[ColumnProfile], requested_dimensions: Option<&[QualityDimension]>, semantic_hints: &SemanticHints, row_duplicates: Option<RowDuplicateSummary>, ) -> Result<BifurcatedResult, DataProfilerError>
Calculate bifurcated metrics with explicit semantic column hints and, when the engine tracked whole rows, full-stream duplicate counts that supersede the sample-based duplicate scan.
Trait Implementations§
Source§impl Default for MetricsCalculator
impl Default for MetricsCalculator
Source§fn default() -> MetricsCalculator
fn default() -> MetricsCalculator
Auto Trait Implementations§
impl Freeze for MetricsCalculator
impl RefUnwindSafe for MetricsCalculator
impl Send for MetricsCalculator
impl Sync for MetricsCalculator
impl Unpin for MetricsCalculator
impl UnsafeUnpin for MetricsCalculator
impl UnwindSafe for MetricsCalculator
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more