make a report for D1 for 302
This commit is contained in:
parent
957b784ba1
commit
9d0e671671
482
Notes/302.ipynb
482
Notes/302.ipynb
File diff suppressed because one or more lines are too long
BIN
Notes/302/302_DS1.pdf
Normal file
BIN
Notes/302/302_DS1.pdf
Normal file
Binary file not shown.
1346
Notes/302/302_DS1.tex
Normal file
1346
Notes/302/302_DS1.tex
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
128
Notes/reports.py
Normal file
128
Notes/reports.py
Normal file
@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import sqlite3
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from math import ceil
|
||||
|
||||
NOANSWER = "."
|
||||
NOTRATED = ""
|
||||
COMPETENCES = {
|
||||
"Cher": {"fullname": "Chercher", "latex": "\\Cher"},
|
||||
"Mod": {"fullname": "Modéliser", "latex": "\\Mod"},
|
||||
"Rep": {"fullname": "Représenter", "latex": "\\Rep"},
|
||||
"Rai": {"fullname": "Raisonner", "latex": "\\Rai"},
|
||||
"Cal": {"fullname": "Calculer", "latex": "\\Cal"},
|
||||
"Com": {"fullname": "Communiquer", "latex": "\\Com"},
|
||||
"Con": {"fullname": "Connaître", "latex": "\\Con"},
|
||||
}
|
||||
|
||||
# Pick from db
|
||||
|
||||
def df_from_db(eval_id):
|
||||
db = "recopytex.db"
|
||||
conn = sqlite3.connect(db)
|
||||
df = pd.read_sql_query("SELECT \
|
||||
student.name as name,\
|
||||
student.surname as surname,\
|
||||
score.value as value, \
|
||||
question.competence as competence,\
|
||||
question.name as question,\
|
||||
question.comment as comment,\
|
||||
exercise.name as exercise, \
|
||||
eval.name as eval\
|
||||
FROM score\
|
||||
JOIN question ON score.question_id==question.id \
|
||||
JOIN exercise ON question.exercise_id==exercise.id \
|
||||
JOIN eval ON exercise.eval_id==eval.id \
|
||||
JOIN student ON score.student_id==student.id\
|
||||
WHERE eval.id == (?)",
|
||||
conn,
|
||||
params = (eval_id,))
|
||||
return df
|
||||
|
||||
def prepare_df(df):
|
||||
df = df[df["value"]!=NOTRATED]
|
||||
df["score"] = df.apply(col2score, axis=1)
|
||||
df["fullname"] = df["name"] + " " + df["surname"]
|
||||
df['competence'] = df["competence"].astype("category",
|
||||
categories = list(COMPETENCES.keys()), ordered=True,)
|
||||
#df["abv_competence"] = df["competence"]
|
||||
#df["competence"] = df.apply(competence_fullname, axis=1)
|
||||
df["latex"] = df.apply(col2latex, axis=1)
|
||||
#df["latex_competence"] = df.apply(competence_latex, axis=1)
|
||||
return df
|
||||
|
||||
# Value transformations
|
||||
|
||||
def val2score(x):
|
||||
if x == '.':
|
||||
return 0
|
||||
if x not in [0, 1, 2, 3]:
|
||||
raise ValueError(f"The evaluation is out of range. Got {x}")
|
||||
return x
|
||||
|
||||
def val2latex(x):
|
||||
latex_caract = ["\\NoRep", "\\RepZ", "\\RepU", "\\RepD", "\\RepT"]
|
||||
if x == NOANSWER:
|
||||
return latex_caract[0]
|
||||
elif x in range(4):
|
||||
return latex_caract[int(x)+1]
|
||||
return x
|
||||
val2latex.__name__ = "Aquisition"
|
||||
|
||||
def rounded_mean(x, rounded=0):
|
||||
""" Rounded x mean """
|
||||
mean = np.mean(x)
|
||||
return round(mean, rounded)
|
||||
rounded_mean.__name__ = "Moyenne discrète"
|
||||
|
||||
# Columns transformations
|
||||
|
||||
def col2score(x):
|
||||
return val2score(x["value"])
|
||||
|
||||
def col2latex(x):
|
||||
return val2latex(x["value"])
|
||||
|
||||
def competence_fullname(x):
|
||||
try:
|
||||
return COMPETENCES[x['competence']]["fullname"]
|
||||
except KeyError:
|
||||
return ""
|
||||
|
||||
def competence_latex(x):
|
||||
try:
|
||||
return COMPETENCES[x['competence']]["latex"]
|
||||
except KeyError:
|
||||
return ""
|
||||
|
||||
|
||||
# Df transforms
|
||||
|
||||
def competence_report(df):
|
||||
report_comp = pd.pivot_table(df,
|
||||
index=["competence"],
|
||||
columns = ['fullname'],
|
||||
values = ["score"],
|
||||
aggfunc = [rounded_mean])
|
||||
return report_comp.dropna()
|
||||
|
||||
def exercise_gpby(df):
|
||||
""" Group the dataframe in exercise POV """
|
||||
pass
|
||||
|
||||
def eval_gpby(df):
|
||||
""" Group the dataframe in eval POV """
|
||||
pass
|
||||
|
||||
def term_gpby(df):
|
||||
""" Group the dataframe in term POV """
|
||||
pass
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||||
# cursor: 16 del
|
4136
Notes/tests reports.ipynb
Normal file
4136
Notes/tests reports.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
61
Notes/tpl_report.tex
Normal file
61
Notes/tpl_report.tex
Normal file
@ -0,0 +1,61 @@
|
||||
\documentclass[a5paper,12pt]{article}
|
||||
\usepackage{myXsim}
|
||||
|
||||
|
||||
% Title Page
|
||||
%\title{\Var{eval.name}}
|
||||
%\tribe{\Var{eval.tribe}}
|
||||
%\date{eval.date}
|
||||
|
||||
\title{DS1 mise en jambe}
|
||||
\tribe{302}
|
||||
\date{}
|
||||
|
||||
\begin{document}
|
||||
|
||||
%- for student in students
|
||||
|
||||
\maketitle
|
||||
|
||||
{\Large \Var{student['name']}}
|
||||
|
||||
\vfill
|
||||
|
||||
Réussite aux exercices
|
||||
|
||||
\begin{center}
|
||||
%- for exercise in student['exercises']
|
||||
\begin{tabular}{|c|c|}
|
||||
\hline
|
||||
\multicolumn{2}{|c|}{Exercice \Var{exercise['name']}}\\
|
||||
\hline
|
||||
|
||||
%- for question in exercise['questions']
|
||||
\Var{question['question']} \Var{question['comment']}& \Var{question['latex']} \\
|
||||
\hline
|
||||
%- endfor
|
||||
\end{tabular}
|
||||
\vfill
|
||||
%- endfor
|
||||
\end{center}
|
||||
|
||||
Bilan par compétences
|
||||
|
||||
\begin{itemize}
|
||||
%- for k,v in student['competences'].iterrows()
|
||||
\item \Var{competences[k]['latex']} \Var{competences[k]['fullname']} : \Var{v[0]}
|
||||
%- endfor
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
%- endfor
|
||||
|
||||
\end{document}
|
||||
|
||||
%%% Local Variables:
|
||||
%%% mode: latex
|
||||
%%% TeX-master: "master"
|
||||
%%% End:
|
||||
|
@ -11,7 +11,7 @@
|
||||
\RequirePackage{amsfonts}
|
||||
%\RequirePackage{subfig}
|
||||
\RequirePackage{graphicx}
|
||||
\RequirePackage{color}
|
||||
\RequirePackage[table]{xcolor}
|
||||
\RequirePackage{gensymb}
|
||||
\RequirePackage{ifthen, calc}
|
||||
\RequirePackage{tabularx}
|
||||
|
@ -91,6 +91,15 @@
|
||||
\icon[#1]{book-cover}
|
||||
}
|
||||
|
||||
% Pour l'évaluation par compétence
|
||||
\usepackage{tikzsymbols}
|
||||
|
||||
%\newcommand{\RepT}{\color{black!10}\Changey[2][black!70]{0.8}\color{text}}
|
||||
\newcommand{\RepT}{\Smiley[2][black!70]}
|
||||
\newcommand{\RepD}{\Sey[2][black!40]}
|
||||
\newcommand{\RepU}{\Neutrey[2][black!10]}
|
||||
\newcommand{\RepZ}{\Sadey[2]}
|
||||
\newcommand{\NoRep}{(??)}
|
||||
|
||||
% ##########################
|
||||
% Tikz shortcuts
|
||||
|
Loading…
Reference in New Issue
Block a user