mod bands;
mod metrics;
mod paths;
pub use bands::{
BandSet, BAR_COLOR_BAND, CERTIFICATE, COVER_PHRASE, FIVE_BAND, FIVE_BAND_LETTERS, LETTER_GRADE,
MEDAL, SCORE_RANGE, SECURITY_GRADE, SEO_BAND,
};
pub use metrics::REGISTRY;
pub use paths::json_path_candidates;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MetricKind {
Score,
Risk,
Ratio,
Ranking,
Impact,
Count,
Classification,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Direction {
HigherIsBetter,
LowerIsBetter,
Neutral,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Scope {
Single,
Batch,
Both,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Aggregation {
None,
Average,
WeightedAverage,
Sum,
Max,
}
#[derive(Debug, Clone, Copy)]
pub struct MetricSpec {
pub id: &'static str,
pub json_path: &'static str,
pub kind: MetricKind,
pub unit: &'static str,
pub band_set: Option<&'static BandSet>,
pub direction: Direction,
pub scope: Scope,
pub aggregation: Aggregation,
pub needs_explanation: bool,
pub docs_url: &'static str,
pub reference_urls: &'static [&'static str],
pub reviewed_at: &'static str,
pub pdf_component: Option<&'static str>,
pub meaning: &'static str,
pub meaning_batch_override: Option<&'static str>,
}
impl MetricSpec {
pub fn meaning_for(&self, report_type: &str) -> &'static str {
if report_type == "batch" {
self.meaning_batch_override.unwrap_or(self.meaning)
} else {
self.meaning
}
}
}