commit 54e40c470d6fa813a09a186f8c907f7440847292 Author: James Eagan Date: Tue Oct 8 10:33:56 2024 -0600 Initial import diff --git a/process.fish b/process.fish new file mode 100755 index 0000000..0d8c8a9 --- /dev/null +++ b/process.fish @@ -0,0 +1,33 @@ +#!/usr/bin/env fish + +# Script by James Eagan +# This is a quick-n-dirty hack. +# First time shared: 2024-10-08 +# Depends on fish shell, csv-util, and sqlite-csv +# Usage: ./process.fish in a directory with all the .csv files to process + +mkdir -p processed +rm -f summary.csv summary-short.csv + +for i in *.csv + echo "::: $i" 1>&2 + csv-util $i -., --insep \; -s , --split-ects --calc-avg --head -2 > processed/$i + sqlite-csv --md processed/$i 'select "Code","Note initiale","Note finale","Note finale transposée",ECTS from data' > processed/(basename $i .csv).md +end + + +for i in processed/*.md + echo -n "### "; echo (basename $i "-Tableau 1.md") + cat $i + echo +end + +echo 'Nom,"Note finale",ECTS,Mention' > summary.csv +for i in processed/*.csv; + set name (basename $i "-Tableau 1.csv"); + echo -n "$name," >> summary.csv; + #cat $i | sqlite-utils memory stdin 'select "Note finale" as Moyenne,ECTS,"Note finale transposée" as Mention from stdin' --csv | tail -1 >> summary.csv + cat $i | sqlite-csv --csv 'select "Note finale" as Moyenne,ECTS,"Note finale transposée" as Mention from data' | tail -1 >> summary.csv +end + +sqlite-csv --md summary.csv 'select Nom,"Note finale" as Moyenne,ECTS,Mention from data'