#![cfg_attr(coverage_nightly, coverage(off))]
use serde::{Deserialize, Serialize};
use std::fmt;
use std::path::PathBuf;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperScore {
pub raw_score: f64,
pub max_available: f64,
pub normalized_score: f64,
pub grade: PopperGrade,
pub gateway_passed: bool,
pub categories: PopperCategoryScores,
pub recommendations: Vec<PopperRecommendation>,
pub metadata: PopperMetadata,
pub analysis: PopperAnalysis,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum PopperGrade {
APlus,
A,
AMinus,
BPlus,
B,
C,
D,
F,
InsufficientFalsifiability,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperCategoryScores {
pub falsifiability: PopperCategoryScore,
pub reproducibility: PopperCategoryScore,
pub transparency: PopperCategoryScore,
pub statistical_rigor: PopperCategoryScore,
pub historical_integrity: PopperCategoryScore,
pub ml_reproducibility: PopperCategoryScore,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperCategoryScore {
pub name: String,
pub earned: f64,
pub max: f64,
pub is_applicable: bool,
pub is_not_applicable: bool,
pub sub_scores: Vec<PopperSubScore>,
pub findings: Vec<PopperFinding>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperSubScore {
pub id: String,
pub name: String,
pub earned: f64,
pub max: f64,
pub description: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum FindingSeverity {
Positive,
Info,
Warning,
Critical,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperFinding {
pub severity: FindingSeverity,
pub message: String,
pub location: Option<PathBuf>,
pub impact: f64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum RecommendationPriority {
Low,
Medium,
High,
Critical,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperRecommendation {
pub category: String,
pub description: String,
pub priority: RecommendationPriority,
pub potential_percent: f64,
pub command: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PopperAnalysis {
pub falsifiability_status: AnalysisStatus,
pub reproducibility_status: AnalysisStatus,
pub scrutiny_status: AnalysisStatus,
pub methodology_status: AnalysisStatus,
pub validation_status: AnalysisStatus,
pub verdict: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum AnalysisStatus {
Pass,
Partial,
#[default]
Fail,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PopperMetadata {
pub timestamp: String,
pub project_name: String,
pub version: String,
pub project_path: Option<PathBuf>,
}
include!("models_impls.rs");
include!("models_findings.rs");
include!("models_tests.rs");