Feat: move dashboard to its own directory
This commit is contained in:
parent
894ebc4ec8
commit
21397272c9
0
recopytex/dashboard/__init__.py
Normal file
0
recopytex/dashboard/__init__.py
Normal file
@ -15,7 +15,7 @@ import numpy as np
|
|||||||
|
|
||||||
from .. import flat_df_students, pp_q_scores
|
from .. import flat_df_students, pp_q_scores
|
||||||
from ..config import NO_ST_COLUMNS
|
from ..config import NO_ST_COLUMNS
|
||||||
from .getconfig import config, CONFIGPATH
|
from ..scripts.getconfig import config, CONFIGPATH
|
||||||
|
|
||||||
COLORS = {
|
COLORS = {
|
||||||
".": "black",
|
".": "black",
|
||||||
@ -180,6 +180,7 @@ def update_final_scores_descr(data):
|
|||||||
)
|
)
|
||||||
def update_final_scores_hist(data):
|
def update_final_scores_hist(data):
|
||||||
assessment_scores = pd.DataFrame.from_records(data)
|
assessment_scores = pd.DataFrame.from_records(data)
|
||||||
|
|
||||||
ranges = np.linspace(
|
ranges = np.linspace(
|
||||||
0, assessment_scores.Bareme.max(), int(assessment_scores.Bareme.max() * 2 + 1)
|
0, assessment_scores.Bareme.max(), int(assessment_scores.Bareme.max() * 2 + 1)
|
||||||
)
|
)
|
||||||
@ -200,8 +201,15 @@ def update_final_scores_hist(data):
|
|||||||
hovertemplate="",
|
hovertemplate="",
|
||||||
marker_color="#4E89DE",
|
marker_color="#4E89DE",
|
||||||
)
|
)
|
||||||
|
# fig = go.Figure(
|
||||||
|
# data=go.Histogram(
|
||||||
|
# x=assessment_scores["Note"],
|
||||||
|
# xbins={"start": 0, "end": assessment_scores["Bareme"].max(), "size": 0.25},
|
||||||
|
# ),
|
||||||
|
# )
|
||||||
return [fig]
|
return [fig]
|
||||||
|
|
||||||
|
|
||||||
@app.callback(
|
@app.callback(
|
||||||
[
|
[
|
||||||
dash.dependencies.Output("fig_competences", "figure"),
|
dash.dependencies.Output("fig_competences", "figure"),
|
||||||
@ -232,20 +240,23 @@ def update_competence_fig(data):
|
|||||||
|
|
||||||
fig = go.Figure()
|
fig = go.Figure()
|
||||||
bars = [
|
bars = [
|
||||||
{"score": -1, "name":"Pas de réponse", "color": COLORS["."]},
|
{"score": -1, "name": "Pas de réponse", "color": COLORS["."]},
|
||||||
{"score": 0, "name":"Faut", "color": COLORS[0]},
|
{"score": 0, "name": "Faut", "color": COLORS[0]},
|
||||||
{"score": 1, "name":"Peu juste", "color": COLORS[1]},
|
{"score": 1, "name": "Peu juste", "color": COLORS[1]},
|
||||||
{"score": 2, "name":"Presque juste", "color": COLORS[2]},
|
{"score": 2, "name": "Presque juste", "color": COLORS[2]},
|
||||||
{"score": 3, "name":"Juste", "color": COLORS[3]},
|
{"score": 3, "name": "Juste", "color": COLORS[3]},
|
||||||
]
|
]
|
||||||
for b in bars:
|
for b in bars:
|
||||||
try:
|
try:
|
||||||
fig.add_bar(x=index, y=pt[b["score"]], name=b["name"], marker_color=b["color"])
|
fig.add_bar(
|
||||||
|
x=index, y=pt[b["score"]], name=b["name"], marker_color=b["color"]
|
||||||
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
fig.update_layout(barmode="relative")
|
fig.update_layout(barmode="relative")
|
||||||
return [fig]
|
return [fig]
|
||||||
|
|
||||||
|
|
||||||
@app.callback(
|
@app.callback(
|
||||||
[dash.dependencies.Output("lastsave", "children")],
|
[dash.dependencies.Output("lastsave", "children")],
|
||||||
[
|
[
|
@ -13,7 +13,7 @@ from .getconfig import config, CONFIGPATH
|
|||||||
from .prompts import prompt_exam, prompt_exercise, prompt_validate
|
from .prompts import prompt_exam, prompt_exercise, prompt_validate
|
||||||
from ..config import NO_ST_COLUMNS
|
from ..config import NO_ST_COLUMNS
|
||||||
from .exam import Exam
|
from .exam import Exam
|
||||||
from .exam_dash import app as exam_app
|
from ..dashboard.exam import app as exam_app
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
@ -85,10 +85,12 @@ def new_exam():
|
|||||||
base_df.to_csv(exam.path(".csv"), index=False)
|
base_df.to_csv(exam.path(".csv"), index=False)
|
||||||
print(f"Le fichier note a été enregistré à {exam.path('.csv')}")
|
print(f"Le fichier note a été enregistré à {exam.path('.csv')}")
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
def exam_analysis():
|
def exam_analysis():
|
||||||
exam_app.run_server(debug=True)
|
exam_app.run_server(debug=True)
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.argument("csv_file")
|
@click.argument("csv_file")
|
||||||
def report(csv_file):
|
def report(csv_file):
|
||||||
|
Loading…
Reference in New Issue
Block a user