forked from jelson.rodrigues/piperun-bot
chore: started report grouping
This commit is contained in:
49
src/groupped_repport.rs
Normal file
49
src/groupped_repport.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use itertools::Itertools;
|
||||
use polars::prelude::*;
|
||||
use reqwest;
|
||||
use walkdir;
|
||||
|
||||
fn main() {
|
||||
let PROMPT = std::fs::read_to_string("./PROMPT_DATA_SANITIZATION.txt").expect("Failed to read the promp for data sanitization");
|
||||
|
||||
|
||||
// Get the current day in the format YYYY-MM-DD
|
||||
let current_date = chrono::Local::now();
|
||||
let formatted_date = current_date.format("%Y-%m-%d").to_string();
|
||||
|
||||
std::fs::read_dir(std::path::Path::new("./evaluations")).expect("Failed to read directory ./evaluations")
|
||||
.filter_map_ok(|entry| {
|
||||
if entry.metadata().unwrap().is_dir(){
|
||||
Some(entry.file_name())
|
||||
}
|
||||
else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.filter_map_ok(|entry_string_name| {
|
||||
let regex_match_date = regex::Regex::new(r"(\d{4}-\d{2}-\d{2})").expect("Failed to build regex");
|
||||
|
||||
let filename = entry_string_name.to_str().unwrap();
|
||||
let matches_find = regex_match_date.find(filename);
|
||||
|
||||
match matches_find {
|
||||
Some(found) => {
|
||||
chrono::NaiveDateTime::parse_from_str()
|
||||
return Some(String::from(found))
|
||||
},
|
||||
None => {return None;}
|
||||
};
|
||||
})
|
||||
.for_each(|entry| println!("{:?}", entry));
|
||||
// std::fs::ReadDir("./evaluations").for_each(|entry| println!("{:?}", entry));
|
||||
|
||||
// get folder name for last week evaluations
|
||||
/*
|
||||
let evaluations_dir_walk = walkdir::WalkDir::new("./evaluations");
|
||||
evaluations_dir_walk.into_iter().for_each(
|
||||
|entry| {
|
||||
println!("{:?}", entry.unwrap());
|
||||
}
|
||||
)
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user