Updates the graph for modular import
This commit is contained in:
parent
bcc0c814c5
commit
bb6ab0fa6f
|
|
@ -14,7 +14,7 @@ pub struct GraphConfig {
|
|||
pub target: GraphTargetType,
|
||||
|
||||
/// Alternative origin
|
||||
#[arg(short, long, default_value = "Images/Radar/radar.csv")]
|
||||
#[arg(short, long, default_value = "Ecoles")]
|
||||
pub origin: String,
|
||||
|
||||
/// Alternative destination
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ fn del_graphs(args: &GraphConfig) -> Result<()> {
|
|||
fn load_graph(args: &GraphConfig) -> Result<()> {
|
||||
let _ = args;
|
||||
// load_categories_from_tsv("./test.csv")?;
|
||||
generate_csv()?;
|
||||
generate_csv(&args)?;
|
||||
Ok(())
|
||||
}
|
||||
///Generate the graph and save it
|
||||
|
|
@ -132,9 +132,11 @@ fn import_csv(args: &GraphConfig) -> Result<GraphValues> {
|
|||
}
|
||||
|
||||
/// Generate the csv from all the classes
|
||||
fn generate_csv() -> Result<()> {
|
||||
fn generate_csv(args: &GraphConfig) -> Result<()> {
|
||||
// Acquire the data from all classes
|
||||
let list_class = list_dir("Tables/??? - *.tsv");
|
||||
let list_class = list_dir(&format!("{}/??? - *.tsv", args.origin));
|
||||
|
||||
println!("{:?}", list_class);
|
||||
let mut final_class_list = Vec::with_capacity(list_class.len() + 1);
|
||||
// Very ugly space reservation for the last operation, need to check if no way of skipping an element is possible
|
||||
final_class_list.push(FinalClassRadar::default());
|
||||
|
|
@ -147,8 +149,8 @@ fn generate_csv() -> Result<()> {
|
|||
.context("Generating new name")?[12..]
|
||||
.strip_suffix(".tsv")
|
||||
.context("Stripping extention")?;
|
||||
let categories =
|
||||
load_categories_from_tsv(single_class.clone()).context("Loading from csv")?;
|
||||
let categories = load_categories_from_tsv(single_class.clone())
|
||||
.context(format!("Loading class {:?} from it's tsv", &single_class))?;
|
||||
final_class_list.push(FinalClassRadar::from_radar_with_name(
|
||||
class_name.to_string(),
|
||||
categories,
|
||||
|
|
|
|||
Loading…
Reference in New Issue