forked from jelson.rodrigues/piperun-bot
chore: started report grouping
This commit is contained in:
10
Cargo.toml
10
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"}
|
||||
@@ -15,3 +23,5 @@ zip = { version = "5.1.1"}
|
||||
walkdir = { version = "2.5.0"}
|
||||
lettre = {version = "0.11.18", features = ["builder"]}
|
||||
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.
|
||||
--------------------------------
|
||||
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