Feat: Student report build
This commit is contained in:
parent
18696a805c
commit
d4a08f0142
26
recopytex.py
26
recopytex.py
@ -33,23 +33,41 @@ def report(csv_file):
|
||||
sys.exit(1)
|
||||
|
||||
csv_file = Path(csv_file)
|
||||
tribe_dir = csv_file.parent
|
||||
csv_filename = csv_file.name.split(".")[0]
|
||||
|
||||
assessment = str(csv_filename).split("_")[-1].capitalize()
|
||||
tribe = str(csv_file.parent).split("/")[-1]
|
||||
tribe = str(tribe_dir).split("/")[-1]
|
||||
|
||||
template = Path(config["templates"]) / "tpl_evaluation.ipynb"
|
||||
|
||||
dest = Path(config["output"]) / tribe / csv_filename / f"{assessment}.ipynb"
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
dest = Path(config["output"]) / tribe / csv_filename
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
click.echo(f"Building {assessment} report")
|
||||
pm.execute_notebook(
|
||||
str(template),
|
||||
str(dest),
|
||||
str(dest / f"{assessment}.ipynb"),
|
||||
parameters=dict(
|
||||
tribe=tribe, assessment=assessment, csv_file=str(csv_file.absolute())
|
||||
),
|
||||
)
|
||||
|
||||
with open(csv_file.parent / "description.yml") as f:
|
||||
tribe_desc = yaml.load(f, Loader=yaml.FullLoader)
|
||||
|
||||
template = Path(config["templates"]) / "tpl_student.ipynb"
|
||||
dest = Path(config["output"]) / tribe / csv_filename / "students"
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for st in tribe_desc["students"]:
|
||||
click.echo(f"Building {st} report on {assessment}")
|
||||
pm.execute_notebook(
|
||||
str(template),
|
||||
str(dest / f"{st}.ipynb"),
|
||||
parameters=dict(tribe=tribe, student=st, source=str(tribe_dir.absolute())),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
|
@ -13,7 +13,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"tags": [
|
||||
"parameters"
|
||||
@ -22,24 +22,25 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"tribe = 30\n",
|
||||
"student = \"ABDOU Asmahane\""
|
||||
"student = \"ABDOU Asmahane\"\n",
|
||||
"source = Path(f\"./sheets/{tribe}/\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/markdown": [
|
||||
"# ABDOU Asmahane en 308"
|
||||
"# ABDOU Asmahane en 30"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Markdown object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user