crate::ix!();
#[derive(Getters,StructOpt, Debug)]
#[structopt(name = "act")]
pub struct CrateActivityCli {
#[structopt(long, short = "i", help = "Ignores crate activity cache, scrapes activity data again")]
#[getset(get = "pub")]
ignore_cache: bool,
#[structopt(long, help = "Enable all analyses at once")]
#[getset(get = "pub")]
all: bool,
#[structopt(long, short = "c", help = "Display correlation analysis")]
#[getset(get = "pub")]
show_correlations: bool,
#[structopt(long, short = "p", help = "Perform PCA analysis")]
#[getset(get = "pub")]
perform_pca: bool,
#[structopt(long, short = "h", help = "Perform hierarchical clustering")]
#[getset(get = "pub")]
perform_hierarchical_clustering: bool,
#[structopt(long, short = "n", help = "Perform correlation network analysis")]
#[getset(get = "pub")]
correlation_network: bool,
#[structopt(long, default_value = "0.7", help = "Correlation threshold for network edges")]
#[getset(get = "pub")]
network_threshold: f64,
#[structopt(long, short = "g", help = "Target number of communities for Girvan–Newman")]
#[getset(get = "pub")]
girvan_newman: Option<usize>,
#[structopt(long, short = "b", help = "Compute betweenness centrality and display top nodes")]
#[getset(get = "pub")]
compute_betweenness: bool,
#[structopt(long, short = "s", help = "Print a summary of the network graph")]
#[getset(get = "pub")]
print_summary: bool,
#[structopt(long, short = "t", help = "Compute time-lagged correlations")]
#[getset(get = "pub")]
time_lag_correlations: bool,
#[structopt(long, default_value = "7", help = "Maximum lag (in days) to consider for time-lag correlations")]
#[getset(get = "pub")]
max_lag: i32,
#[structopt(long, default_value = "24.0", help = "Z-score threshold for outlier detection")]
#[getset(get = "pub")]
outlier_z_threshold: f64,
#[structopt(long, help = "Downweight outliers instead of removing them")]
#[getset(get = "pub")]
downweight_outliers: bool,
#[structopt(long, default_value = "0.1", help = "Downweight factor for outliers")]
#[getset(get = "pub")]
outlier_weight: f64,
#[structopt(long, help = "Disable outlier detection and handling")]
disable_outlier_handling: bool,
#[structopt(long, help = "If true, we will print each individual crate per group")]
#[getset(get="pub")]
expand_groups: bool,
#[structopt(long, default_value = "2", help = "Minimum group size required to treat them as a group")]
#[getset(get="pub")]
min_group_size: usize,
#[structopt(long, short = "v", help = "Enable tracing")]
#[getset(get="pub")]
verbose: bool,
}
impl CrateActivityCli {
pub fn read_command_line() -> Self {
let mut cli = CrateActivityCli::from_args();
cli.apply_all_flag();
cli
}
pub fn disable_outlier_handling(&self) -> bool {
#[cfg(test)]
let disable_outliers_override = true;
#[cfg(not(test))]
let disable_outliers_override = false;
let disable_outliers = self.disable_outlier_handling || disable_outliers_override;
disable_outliers
}
pub fn apply_all_flag(&mut self) {
if self.all {
self.show_correlations = true;
self.perform_pca = true;
self.perform_hierarchical_clustering = true;
self.correlation_network = true;
self.compute_betweenness = true;
self.print_summary = true;
self.time_lag_correlations = true;
}
}
}