Compare commits
No commits in common. "c84f9845b201081e18f4c34c32f03881f459513d" and "581b0f4f2fef13671305b3f96eac272b81fe680f" have entirely different histories.
c84f9845b2
...
581b0f4f2f
@ -240,7 +240,7 @@ def update_final_scores_hist(data):
|
||||
assessment_scores = pd.DataFrame.from_records(data)
|
||||
|
||||
if assessment_scores.empty:
|
||||
return [go.Figure(data=[go.Scatter(x=[], y=[])])]
|
||||
return [{"data": [], "layout": []}]
|
||||
|
||||
ranges = np.linspace(
|
||||
-0.5,
|
||||
@ -287,7 +287,7 @@ def update_competence_fig(data):
|
||||
scores = flat_df_students(scores).dropna(subset=["Score"])
|
||||
|
||||
if scores.empty:
|
||||
return [go.Figure(data=[go.Scatter(x=[], y=[])])]
|
||||
return [{"data": [], "layout": []}]
|
||||
|
||||
scores = pp_q_scores(scores)
|
||||
pt = pd.pivot_table(
|
||||
|
@ -18,19 +18,10 @@ from ...config import NO_ST_COLUMNS
|
||||
from ..app import app
|
||||
from ...scripts.exam import Exam
|
||||
|
||||
|
||||
def get_students(csv):
|
||||
return list(pd.read_csv(csv).T.to_dict().values())
|
||||
|
||||
|
||||
COLORS = {
|
||||
".": "black",
|
||||
0: "#E7472B",
|
||||
1: "#FF712B",
|
||||
2: "#F2EC4C",
|
||||
3: "#68D42F",
|
||||
}
|
||||
|
||||
QUESTION_COLUMNS = [
|
||||
{"id": "id", "name": "Question"},
|
||||
{
|
||||
@ -128,6 +119,9 @@ layout = html.Div(
|
||||
),
|
||||
id="eval-table",
|
||||
),
|
||||
html.Div(
|
||||
id="describe",
|
||||
),
|
||||
],
|
||||
id="Évaluations",
|
||||
),
|
||||
@ -137,7 +131,7 @@ layout = html.Div(
|
||||
id="competences-viz",
|
||||
),
|
||||
html.Div(
|
||||
id="themes-vizz",
|
||||
id="themes-viz",
|
||||
),
|
||||
],
|
||||
id="visualisation",
|
||||
@ -219,85 +213,5 @@ def update_exam_scores(data):
|
||||
scores = pp_q_scores(scores)
|
||||
assessment_scores = scores.groupby(["Nom"]).agg({"Note": "sum", "Bareme": "sum"})
|
||||
return [assessment_scores.reset_index().to_dict("records")]
|
||||
|
||||
|
||||
@app.callback(
|
||||
[
|
||||
dash.dependencies.Output("competences-viz", "children"),
|
||||
],
|
||||
[
|
||||
dash.dependencies.Input("student-scores", "data"),
|
||||
],
|
||||
)
|
||||
def update_competences_viz(data):
|
||||
scores = pd.DataFrame.from_records(data)
|
||||
scores = pp_q_scores(scores)
|
||||
pt = pd.pivot_table(
|
||||
scores,
|
||||
index=["Competence"],
|
||||
columns="Score",
|
||||
aggfunc="size",
|
||||
fill_value=0,
|
||||
)
|
||||
fig = go.Figure()
|
||||
bars = [
|
||||
{"score": -1, "name": "Pas de réponse", "color": COLORS["."]},
|
||||
{"score": 0, "name": "Faux", "color": COLORS[0]},
|
||||
{"score": 1, "name": "Peu juste", "color": COLORS[1]},
|
||||
{"score": 2, "name": "Presque juste", "color": COLORS[2]},
|
||||
{"score": 3, "name": "Juste", "color": COLORS[3]},
|
||||
]
|
||||
for b in bars:
|
||||
try:
|
||||
fig.add_bar(
|
||||
x=list(config["competences"].keys()), y=pt[b["score"]], name=b["name"], marker_color=b["color"]
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
fig.update_layout(barmode="relative")
|
||||
fig.update_layout(
|
||||
height=500,
|
||||
margin=dict(l=5, r=5, b=5, t=5),
|
||||
)
|
||||
return [dcc.Graph(figure=fig)]
|
||||
|
||||
@app.callback(
|
||||
[
|
||||
dash.dependencies.Output("themes-vizz", "children"),
|
||||
],
|
||||
[
|
||||
dash.dependencies.Input("student-scores", "data"),
|
||||
],
|
||||
)
|
||||
def update_themes_viz(data):
|
||||
scores = pd.DataFrame.from_records(data)
|
||||
scores = pp_q_scores(scores)
|
||||
pt = pd.pivot_table(
|
||||
scores,
|
||||
index=["Domaine"],
|
||||
columns="Score",
|
||||
aggfunc="size",
|
||||
fill_value=0,
|
||||
)
|
||||
fig = go.Figure()
|
||||
bars = [
|
||||
{"score": -1, "name": "Pas de réponse", "color": COLORS["."]},
|
||||
{"score": 0, "name": "Faux", "color": COLORS[0]},
|
||||
{"score": 1, "name": "Peu juste", "color": COLORS[1]},
|
||||
{"score": 2, "name": "Presque juste", "color": COLORS[2]},
|
||||
{"score": 3, "name": "Juste", "color": COLORS[3]},
|
||||
]
|
||||
for b in bars:
|
||||
try:
|
||||
fig.add_bar(
|
||||
x=list(pt.index), y=pt[b["score"]], name=b["name"], marker_color=b["color"]
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
fig.update_layout(barmode="relative")
|
||||
fig.update_layout(
|
||||
height=500,
|
||||
margin=dict(l=5, r=5, b=5, t=5),
|
||||
)
|
||||
return [dcc.Graph(figure=fig)]
|
||||
return [{}]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user