pub struct ReliabilityScore {
pub overall: f32,
pub schema_completeness: f32,
pub transformation_success: f32,
pub retry_penalty: f32,
pub band: ReliabilityBand,
pub reasons: Vec<String>,
}Expand description
A 0.0–1.0 reliability score for an crate::domain::ExtractionResult.
The score is the weighted sum of three sub-scores (see module-level docs
for the table) and is paired with a discrete ReliabilityBand so
callers can branch on coarse-grained quality without inspecting the
continuous overall field.
§Example
use stygian_plugin::reliability::{ReliabilityScore, ReliabilityBand};
let score = ReliabilityScore {
overall: 0.92,
schema_completeness: 1.0,
transformation_success: 1.0,
retry_penalty: 0.0,
band: ReliabilityBand::High,
reasons: vec!["all regions extracted".to_string()],
};
assert_eq!(score.band, ReliabilityBand::High);Fields§
§overall: f32Weighted sum of the sub-scores, clamped to [0.0, 1.0].
schema_completeness: f32Fraction of regions that produced data (0.0 = none, 1.0 = all).
transformation_success: f32Fraction of regions whose transformations succeeded without error (0.0 = none, 1.0 = all).
retry_penalty: f32Penalty for retries taken to produce this result (0.0 = no retries, 1.0 = capped retries).
band: ReliabilityBandDiscrete interpretation band.
reasons: Vec<String>Human-readable reasons that contributed to the score.
Rendered as a list of short strings (one per contributing factor) so
log lines, MCP debug payloads, and JSON output stay compact.
Implementations§
Source§impl ReliabilityScore
impl ReliabilityScore
Sourcepub const HIGH_THRESHOLD: f32 = 0.85
pub const HIGH_THRESHOLD: f32 = 0.85
Lower bound of the High band (inclusive).
Sourcepub const MEDIUM_THRESHOLD: f32 = 0.50
pub const MEDIUM_THRESHOLD: f32 = 0.50
Lower bound of the Medium band (inclusive).
Sourcepub fn from_overall(overall: f32) -> Self
pub fn from_overall(overall: f32) -> Self
Construct a ReliabilityScore from a raw overall value, clamping
it to [0.0, 1.0] and computing the matching band.
§Example
use stygian_plugin::reliability::{ReliabilityScore, ReliabilityBand};
let score = ReliabilityScore::from_overall(0.93);
assert_eq!(score.band, ReliabilityBand::High);
let score = ReliabilityScore::from_overall(0.30);
assert_eq!(score.band, ReliabilityBand::Low);Sourcepub fn with_reasons(self, reasons: Vec<String>) -> Self
pub fn with_reasons(self, reasons: Vec<String>) -> Self
Attach human-readable reasons to this score, returning the modified value (consuming builder style).
§Example
use stygian_plugin::reliability::ReliabilityScore;
let score = ReliabilityScore::from_overall(0.7).with_reasons(vec!["partial".into()]);
assert_eq!(score.reasons, vec!["partial".to_string()]);Trait Implementations§
Source§impl Clone for ReliabilityScore
impl Clone for ReliabilityScore
Source§fn clone(&self) -> ReliabilityScore
fn clone(&self) -> ReliabilityScore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReliabilityScore
impl Debug for ReliabilityScore
Source§impl<'de> Deserialize<'de> for ReliabilityScore
impl<'de> Deserialize<'de> for ReliabilityScore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ReliabilityScore
impl PartialEq for ReliabilityScore
Source§fn eq(&self, other: &ReliabilityScore) -> bool
fn eq(&self, other: &ReliabilityScore) -> bool
self and other values to be equal, and is used by ==.