Compare commits
3 Commits
94218b4477
...
1edb92af50
| Author | SHA1 | Date | |
|---|---|---|---|
| 1edb92af50 | |||
| cd44d58f69 | |||
| 3af0eab693 |
1752
Cargo.lock
generated
1752
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
12
Cargo.toml
12
Cargo.toml
@@ -3,6 +3,14 @@ name = "piperun-bot"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[[bin]]
|
||||
name = "groupped_repport"
|
||||
path = "src/groupped_repport.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "piperun-bot"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
http = {version = "1.3.1"}
|
||||
dotenv = {version = "0.15.0"}
|
||||
@@ -14,4 +22,6 @@ ipaddress = {version = "0.1.3"}
|
||||
zip = { version = "5.1.1"}
|
||||
walkdir = { version = "2.5.0"}
|
||||
lettre = {version = "0.11.18", features = ["builder"]}
|
||||
anyhow = { version = "1.0.100"}
|
||||
anyhow = { version = "1.0.100"}
|
||||
polars = { version = "0.51.0" }
|
||||
regex = { version = "1.12.2" }
|
||||
8
PROMPT_DATA_SANITIZATION.txt
Normal file
8
PROMPT_DATA_SANITIZATION.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Abaixo está a avaliação de um atendimento que foi realizado. Eu preciso que a formatação fique consistente e padronizada.
|
||||
Padronize o arquivo CSV da seguinte forma, deixando apenas as colunas listadas.
|
||||
Título: CATEGORIA;PONTOS
|
||||
A sua resposta deve ser apenas o CSV com a formatação corrigida, nada mais deve ser incluído na sua resposta.
|
||||
Se não for possível padronizar o arquivo de entrada de acordo com as instruções fornecidas a resposta deve ser vazia.
|
||||
As categorias são: APRESENTAÇÃO, CONFIRMAÇÃO DE E-MAIL, CONFIRMAÇÃO DE TELEFONE, PROTOCOLO, USO DO PORTUGUÊS, PACIÊNCIA E EDUCAÇÃO, DISPONIBILIDADE, CONHECIMENTO TÉCNICO, DIDATISMO, ESCLARECIMENTO, TEMPO DE ESPERA
|
||||
A coluna pontos deve ter apenas os valores 0 ou 1, se no arquivo de entrada estiver incorreto a resposta deve ser vazia.
|
||||
--------------------------------
|
||||
78
src/groupped_repport.rs
Normal file
78
src/groupped_repport.rs
Normal file
@@ -0,0 +1,78 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use chrono::Datelike;
|
||||
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();
|
||||
|
||||
let previous_week_folder_names = 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) => {
|
||||
let date = chrono::NaiveDate::parse_from_str(found.as_str(), "%Y-%m-%d");
|
||||
return Some((date.unwrap().week(chrono::Weekday::Sun), entry_string_name));
|
||||
},
|
||||
None => {return None;}
|
||||
};
|
||||
})
|
||||
.filter_map_ok(|(week, directory_string)| {
|
||||
let current_date = chrono::Local::now();
|
||||
let first_day_of_current_week = current_date.date_naive().week(chrono::Weekday::Sun).first_day();
|
||||
let current_date_minus_one_week = first_day_of_current_week.checked_sub_days(chrono::Days::new(1)).expect("Failed to subtract one day");
|
||||
let first_day_of_last_week = current_date_minus_one_week.week(chrono::Weekday::Sun).first_day();
|
||||
let first_day_of_week_in_folder_name = week.first_day();
|
||||
|
||||
if first_day_of_last_week == first_day_of_week_in_folder_name {
|
||||
return Some(directory_string);
|
||||
}
|
||||
return None;
|
||||
})
|
||||
.filter_map(|value| {
|
||||
if value.is_ok() {return Some(value.unwrap());}
|
||||
else {return None;}
|
||||
})
|
||||
.sorted()
|
||||
.collect_vec();
|
||||
|
||||
println!("{:?}", previous_week_folder_names);
|
||||
|
||||
// Read CSV files inside folder
|
||||
|
||||
// Use AI to sanitize the data
|
||||
|
||||
// Save into a hashmap, with the user name as key, the date, evaluation
|
||||
|
||||
// Final file should look like
|
||||
/*
|
||||
Header: Att1, att2, att3, ...
|
||||
categoria1
|
||||
categoria2
|
||||
categoria3
|
||||
...
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user