diff --git a/recoconfig.yml b/recoconfig.yml new file mode 100644 index 0000000..8c2b81a --- /dev/null +++ b/recoconfig.yml @@ -0,0 +1,35 @@ +--- +source: ./ +output: ./ +templates: ./templates/ + +competences: + Chercher: + name: Chercher + abrv: Che + Représenter: + name: Représenter + abrv: Rep + Modéliser: + name: Modéliser + abrv: Mod + Raisonner: + name: Raisonner + abrv: Rai + Calculer: + name: Calculer + abrv: Cal + Communiquer: + name: Communiquer + abrv: Com + +tribes: + - name: 2GT1 + type: 2nd + students: 2gt1.csv + - name: 1ST + type: Première + students: 1ST1.csv + - name: 1NSI + type: Première + students: 1NSI.csv diff --git a/templates/.ipynb_checkpoints/tpl_evaluation-checkpoint.ipynb b/templates/.ipynb_checkpoints/tpl_evaluation-checkpoint.ipynb new file mode 100644 index 0000000..3588654 --- /dev/null +++ b/templates/.ipynb_checkpoints/tpl_evaluation-checkpoint.ipynb @@ -0,0 +1,805 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "execution": { + "iopub.execute_input": "2020-10-04T07:26:57.870820Z", + "iopub.status.busy": "2020-10-04T07:26:57.869670Z", + "iopub.status.idle": "2020-10-04T07:26:58.499789Z", + "shell.execute_reply": "2020-10-04T07:26:58.500257Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.66457, + "end_time": "2020-10-04T07:26:58.500489", + "exception": false, + "start_time": "2020-10-04T07:26:57.835919", + "status": "completed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from IPython.display import Markdown as md\n", + "from IPython.display import display, HTML\n", + "import pandas as pd\n", + "import numpy as np\n", + "import ipywidgets as widgets\n", + "from pathlib import Path\n", + "from datetime import datetime\n", + "from recopytex import flat_df_students, pp_q_scores\n", + "from datetime import datetime\n", + "\n", + "\n", + "import chart_studio.plotly as py\n", + "import plotly.graph_objects as go\n", + "import plotly.figure_factory as ff\n", + "\n", + "from plotly.offline import iplot, init_notebook_mode\n", + "init_notebook_mode()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "execution": { + "iopub.execute_input": "2020-10-04T07:26:58.701039Z", + "iopub.status.busy": "2020-10-04T07:26:58.700150Z", + "iopub.status.idle": "2020-10-04T07:26:58.703382Z", + "shell.execute_reply": "2020-10-04T07:26:58.702696Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.105904, + "end_time": "2020-10-04T07:26:58.703518", + "exception": false, + "start_time": "2020-10-04T07:26:58.597614", + "status": "completed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "tribe = \"ES\"\n", + "assessment = \"ds2\"\n", + "date = \"14/10/19\"\n", + "csv_file = Path(f\"../{tribe}/191014_{assessment}.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "execution": { + "iopub.execute_input": "2020-10-04T07:26:58.908180Z", + "iopub.status.busy": "2020-10-04T07:26:58.907084Z", + "iopub.status.idle": "2020-10-04T07:26:58.911239Z", + "shell.execute_reply": "2020-10-04T07:26:58.910123Z" + }, + "papermill": { + "duration": 0.110363, + "end_time": "2020-10-04T07:26:58.911455", + "exception": false, + "start_time": "2020-10-04T07:26:58.801092", + "status": "completed" + }, + "tags": [ + "injected-parameters" + ] + }, + "outputs": [], + "source": [ + "# Parameters\n", + "tribe = \"TST1\"\n", + "assessment = \"Ds3\"\n", + "date = \"13/11/20\"\n", + "csv_file = \"/home/lafrite/Cours/2020-2021/Notes/TST1/201113_DS3.csv\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "execution": { + "iopub.execute_input": "2020-10-04T07:26:59.130362Z", + "iopub.status.busy": "2020-10-04T07:26:59.129790Z", + "iopub.status.idle": "2020-10-04T07:26:59.131451Z", + "shell.execute_reply": "2020-10-04T07:26:59.130977Z" + }, + "papermill": { + "duration": 0.109746, + "end_time": "2020-10-04T07:26:59.131570", + "exception": false, + "start_time": "2020-10-04T07:26:59.021824", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/lafrite/Cours/2020-2021/Notes/TST1/201113_DS3\n" + ] + } + ], + "source": [ + "date = datetime.strptime(date, \"%d/%m/%y\")\n", + "output_path = Path(csv_file[:-4])\n", + "print(output_path)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "execution": { + "iopub.execute_input": "2020-10-04T07:26:59.353722Z", + "iopub.status.busy": "2020-10-04T07:26:59.353175Z", + "iopub.status.idle": "2020-10-04T07:26:59.356913Z", + "shell.execute_reply": "2020-10-04T07:26:59.356386Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": false + } + } + } + }, + "papermill": { + "duration": 0.122626, + "end_time": "2020-10-04T07:26:59.357021", + "exception": false, + "start_time": "2020-10-04T07:26:59.234395", + "status": "completed" + }, + "slideshow": { + "slide_type": "slide" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/markdown": [ + "# Ds3 (20/11/13) pour TST1" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "if date is None:\n", + " display(md(f\"# {assessment} pour {tribe}\"))\n", + "else:\n", + " display(md(f\"# {assessment} ({date:%y/%m/%d}) pour {tribe}\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "execution": { + "iopub.execute_input": "2020-10-04T07:26:59.584153Z", + "iopub.status.busy": "2020-10-04T07:26:59.583420Z", + "iopub.status.idle": "2020-10-04T07:26:59.842267Z", + "shell.execute_reply": "2020-10-04T07:26:59.840480Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.385376, + "end_time": "2020-10-04T07:26:59.842589", + "exception": true, + "start_time": "2020-10-04T07:26:59.457213", + "status": "failed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "stack_scores = pd.read_csv(csv_file, encoding=\"UTF8\")\n", + "comments = stack_scores.iloc[0]\n", + "stack_scores.drop([0], inplace=True)\n", + "scores = flat_df_students(stack_scores).dropna(subset=[\"Score\"])\n", + "scores = pp_q_scores(scores)\n", + "#scores.head()\n", + "#comments.drop()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "exercises_scores = scores.groupby([\"Exercice\", \"Eleve\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "assessment_scores = scores.groupby([\"Eleve\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "### Bilans personnalisés" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "import pytex\n", + "#scores.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "datas = {\n", + " \"assessment\": {\n", + " \"name\": assessment,\n", + " \"date\": date\n", + " },\n", + " #\"exercises\": scores[\"Exercice\"].unique(),\n", + " #\"questions\": scores[[\"Exercice\", 'Question', 'Competence', 'Domaine', 'Commentaire', 'Bareme', 'Est_nivele']],\n", + " \"eleves\": {}\n", + "}\n", + "for e in scores[\"Eleve\"].unique():\n", + " edatas = {\n", + " \"assessment\": assessment_scores.loc[e],\n", + " \"exercices\": exercises_scores.xs(e, level=\"Eleve\"),\n", + " \"exscores\": {}\n", + " }\n", + " for i, ex in edatas[\"exercices\"].iterrows():\n", + " edatas[\"exscores\"][i] = scores.loc[(scores.Exercice==i) & (scores.Eleve==e)]\n", + " datas[\"eleves\"][e] = edatas" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "score_template = r\"\"\"\n", + "\\documentclass[a5paper,10pt]{article}\n", + "\\usepackage{fullpage}\n", + "\\usepackage{booktabs}\n", + "\\usepackage{longtable}\n", + "\n", + "\\usepackage{geometry}\n", + "\\geometry{left=10mm,right=10mm, top=10mm}\n", + "\n", + "\\renewcommand{\\arraystretch}{1}\n", + "\\setlength{\\columnseprule}{0pt}\n", + "\n", + "\n", + "\\begin{document}\n", + "\n", + "\n", + " \\section*{\\Var{assessment.name} \\hfill \\Var{e} \\hfill \\Var{sc.assessment.Note}/\\Var{sc.assessment.Bareme}}\n", + " %- for i,ex in sc.exercices.iterrows() \n", + " \\subsection*{Exercice \\Var{i}: \\Var{ex.Note} / \\Var{ex.Bareme}}\n", + " \\Var{sc.exscores[i].to_latex(index=False, columns=[\"Question\", \"Domaine\", \"Commentaire\", \"Note\", \"Bareme\"])}\n", + " %#\\Var{sc.exscores}\n", + " %- endfor\n", + "\n", + "\\end{document}\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wrote 201113_Ds3_AIOUAZ Ahmed.tex\n", + "Wrote 201113_Ds3_BAHBAH Zakaria.tex\n", + "Wrote 201113_Ds3_BENHATTAL Chakir.tex\n", + "Wrote 201113_Ds3_CLAIN Avinash.tex\n", + "Wrote 201113_Ds3_COLASSI Alexis.tex\n", + "Wrote 201113_Ds3_COUBAT Alexis.tex\n", + "Wrote 201113_Ds3_COULLON Anis.tex\n", + "Wrote 201113_Ds3_DINGER Sölen.tex\n", + "Wrote 201113_Ds3_EYRAUD Cynthia.tex\n", + "Wrote 201113_Ds3_FERREIRA Léo.tex\n", + "Wrote 201113_Ds3_FILALI Zakaria.tex\n", + "Wrote 201113_Ds3_FOIGNY Romain.tex\n", + "Wrote 201113_Ds3_HIPOLITO DA SILVA Andréa.tex\n", + "Wrote 201113_Ds3_HUMBERT Rayan.tex\n", + "Wrote 201113_Ds3_MASSON Grace.tex\n", + "Wrote 201113_Ds3_MOKHTARI Nissrine.tex\n", + "Wrote 201113_Ds3_MOUFAQ Amine.tex\n", + "Wrote 201113_Ds3_ONAL Yakub.tex\n", + "Wrote 201113_Ds3_SORIANO Laura.tex\n", + "Wrote 201113_Ds3_VECCHIO Léa.tex\n" + ] + } + ], + "source": [ + "tpl = pytex.texenv.from_string(score_template)\n", + "\n", + "for e,sc in datas['eleves'].items():\n", + " reportfilename = f\"{date:%y%m%d}_{assessment}_{e}.tex\"\n", + " with open(output_path / reportfilename, \"w\") as f:\n", + " f.write(tpl.render(sc=sc, **datas))\n", + " print(f\"Wrote {reportfilename}\")\n", + " pytex.pdflatex(reportfilename)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "## Envoie des bilans par mail" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bian du devoir Ds3\n", + "Bonsoir,\n", + "En pièce jointe, vous trouverez un document détaillant la note du devoir.\n", + "B.Bertrand\n", + "\n" + ] + } + ], + "source": [ + "mailfrom = \"benjamin.bertrand@ac-lyon.fr\"\n", + "subject = f\"Bian du devoir {assessment}\"\n", + "message = \"\"\"Bonsoir,\n", + "En pièce jointe, vous trouverez un document détaillant la note du devoir.\n", + "B.Bertrand\n", + "\"\"\"\n", + "print(subject)\n", + "print(message)" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "import smtplib\n", + "import os\n", + "import sys\n", + "from email.message import EmailMessage\n", + "import mimetypes\n", + "import time\n", + "import random" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "def build_msg(subj, to_addr, from_addr, body, att):\n", + " msg = EmailMessage()\n", + " msg[\"Subject\"] = subj\n", + " msg[\"To\"] = to_addr\n", + " #msg[\"To\"] = \"lafrite26@gmail.com\"\n", + " msg[\"From\"] = from_addr\n", + " msg.set_content(body)\n", + "\n", + " if att != []:\n", + " ctype, encoding = mimetypes.guess_type(att)\n", + " if ctype is None or encoding is not None:\n", + " ctype = 'application/octet-stream'\n", + " maintype, subtype = ctype.split('/', 1)\n", + " with open(att, \"rb\") as f:\n", + " msg.add_attachment(f.read(),\n", + " maintype=maintype,\n", + " subtype=subtype,\n", + " filename=att.name)\n", + " return msg\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "send = 0\n", + "fake = 1" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [], + "source": [ + "if send:\n", + " if fake:\n", + " server = smtplib.SMTP(\"localhost\", 8025)\n", + " server.ehlo()\n", + " else:\n", + " server = smtplib.SMTP(\"smtps.ac-lyon.fr\", 587)\n", + " server.ehlo()\n", + " server.starttls()\n", + " server.ehlo()\n", + " server.login(\"bbertrand\", os.popen(\"pass Prof/Lyon/bbertrand\").read()[:-1]) " + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [], + "source": [ + "try:\n", + " eleves_data = pd.read_csv(f\"../../{tribe}.csv\")\n", + "except FileNotFoundError:\n", + " try:\n", + " eleves_data = pd.read_csv(f\"../{tribe}.csv\")\n", + " except FileNotFoundError:\n", + " eleves_data = pd.read_csv(f\"{tribe}.csv\")\n", + "eleves_data.fillna(\"\", inplace=True)\n", + "#eleves_data" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pas de rapport pour BALLOFFET Kenza\n", + "Pas de mail pour FOIGNY Romain\n", + "Pas de mail pour HUMBERT Rayan\n" + ] + } + ], + "source": [ + "for e in eleves_data.iterrows():\n", + " reportfilename = Path(f\"{date:%y%m%d}_{assessment}_{e[1]['Nom']}.pdf\")\n", + " try:\n", + " assert reportfilename.exists()\n", + " except:\n", + " print(f\"Pas de rapport pour {e[1]['Nom']}\")\n", + " else:\n", + " if e[1][\"mail\"] != \"\":\n", + " if send:\n", + " msg = build_msg(subject, e[1][\"mail\"], mailfrom, message, reportfilename)\n", + " server.send_message(msg)\n", + " print(f\"\\tBilan envoyé à {e[1]['Nom']}\")\n", + " else:\n", + " print(f\"Pas de mail pour {e[1]['Nom']}\")\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "celltoolbar": "Diaporama", + "extensions": { + "jupyter_dashboards": { + "activeView": "grid_default", + "version": 1, + "views": { + "grid_default": { + "cellMargin": 10, + "defaultCellHeight": 20, + "maxColumns": 12, + "name": "grid", + "type": "grid" + }, + "report_default": { + "name": "report", + "type": "report" + } + } + } + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + }, + "papermill": { + "duration": 4.26524, + "end_time": "2020-10-04T07:27:01.280572", + "environment_variables": {}, + "exception": true, + "input_path": "templates/tpl_evaluation.ipynb", + "output_path": "TST1/200930_DS1/Ds1.ipynb", + "parameters": { + "assessment": "Ds1", + "csv_file": "/home/lafrite/Cours/2020-2021/Notes/TST1/200930_DS1.csv", + "date": "30/09/20", + "tribe": "TST1" + }, + "start_time": "2020-10-04T07:26:57.015332", + "version": "1.2.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/templates/tpl_evaluation.ipynb b/templates/tpl_evaluation.ipynb new file mode 100644 index 0000000..3919112 --- /dev/null +++ b/templates/tpl_evaluation.ipynb @@ -0,0 +1,1277 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "25b1d95f", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:46.935577Z", + "iopub.status.busy": "2021-11-26T20:53:46.935147Z", + "iopub.status.idle": "2021-11-26T20:53:47.485029Z", + "shell.execute_reply": "2021-11-26T20:53:47.485365Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.595111, + "end_time": "2021-11-26T20:53:47.485528", + "exception": false, + "start_time": "2021-11-26T20:53:46.890417", + "status": "completed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from IPython.display import Markdown as md\n", + "from IPython.display import display, HTML\n", + "import pandas as pd\n", + "import numpy as np\n", + "import ipywidgets as widgets\n", + "from pathlib import Path\n", + "from datetime import datetime\n", + "from recopytex import flat_df_students, pp_q_scores\n", + "from datetime import datetime\n", + "\n", + "\n", + "import chart_studio.plotly as py\n", + "import plotly.graph_objects as go\n", + "import plotly.figure_factory as ff\n", + "\n", + "from plotly.offline import iplot, init_notebook_mode\n", + "init_notebook_mode()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "3a865047", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:47.639073Z", + "iopub.status.busy": "2021-11-26T20:53:47.638715Z", + "iopub.status.idle": "2021-11-26T20:53:47.640278Z", + "shell.execute_reply": "2021-11-26T20:53:47.639963Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.07866, + "end_time": "2021-11-26T20:53:47.640357", + "exception": false, + "start_time": "2021-11-26T20:53:47.561697", + "status": "completed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "tribe = \"ES\"\n", + "assessment = \"ds2\"\n", + "date = \"14/10/19\"\n", + "csv_file = Path(f\"../{tribe}/191014_{assessment}.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "d9e07464", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:47.788728Z", + "iopub.status.busy": "2021-11-26T20:53:47.788342Z", + "iopub.status.idle": "2021-11-26T20:53:47.789985Z", + "shell.execute_reply": "2021-11-26T20:53:47.789664Z" + }, + "papermill": { + "duration": 0.075297, + "end_time": "2021-11-26T20:53:47.790056", + "exception": false, + "start_time": "2021-11-26T20:53:47.714759", + "status": "completed" + }, + "tags": [ + "injected-parameters" + ] + }, + "outputs": [], + "source": [ + "# Parameters\n", + "tribe = \"2GT6\"\n", + "assessment = \"Ds3\"\n", + "date = \"22/11/21\"\n", + "csv_file = \"/media/documents/Cours/2021-2022/Notes/2GT6/211122_DS3.csv\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "63832c37", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:47.937696Z", + "iopub.status.busy": "2021-11-26T20:53:47.937321Z", + "iopub.status.idle": "2021-11-26T20:53:47.939041Z", + "shell.execute_reply": "2021-11-26T20:53:47.938682Z" + }, + "papermill": { + "duration": 0.07775, + "end_time": "2021-11-26T20:53:47.939111", + "exception": false, + "start_time": "2021-11-26T20:53:47.861361", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/media/documents/Cours/2021-2022/Notes/2GT6/211122_DS3\n" + ] + } + ], + "source": [ + "date = datetime.strptime(date, \"%d/%m/%y\")\n", + "output_path = Path(csv_file[:-4])\n", + "print(output_path)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "2a41f502", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:48.089060Z", + "iopub.status.busy": "2021-11-26T20:53:48.088682Z", + "iopub.status.idle": "2021-11-26T20:53:48.090748Z", + "shell.execute_reply": "2021-11-26T20:53:48.090390Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": false + } + } + } + }, + "papermill": { + "duration": 0.080125, + "end_time": "2021-11-26T20:53:48.090819", + "exception": false, + "start_time": "2021-11-26T20:53:48.010694", + "status": "completed" + }, + "slideshow": { + "slide_type": "slide" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/markdown": [ + "# Ds3 (21/11/22) pour 2GT6" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "if date is None:\n", + " display(md(f\"# {assessment} pour {tribe}\"))\n", + "else:\n", + " display(md(f\"# {assessment} ({date:%y/%m/%d}) pour {tribe}\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "3149dc30", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:48.242342Z", + "iopub.status.busy": "2021-11-26T20:53:48.239786Z", + "iopub.status.idle": "2021-11-26T20:53:48.388408Z", + "shell.execute_reply": "2021-11-26T20:53:48.388704Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.226291, + "end_time": "2021-11-26T20:53:48.388810", + "exception": false, + "start_time": "2021-11-26T20:53:48.162519", + "status": "completed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "stack_scores = pd.read_csv(csv_file, encoding=\"UTF8\")\n", + "#comments = stack_scores.iloc[0]\n", + "#stack_scores.drop([0], inplace=True)\n", + "scores = flat_df_students(stack_scores).dropna(subset=[\"Score\"])\n", + "scores = pp_q_scores(scores)\n", + "#scores.head()\n", + "#comments.drop()" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "48cb4a36", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:48.536329Z", + "iopub.status.busy": "2021-11-26T20:53:48.535961Z", + "iopub.status.idle": "2021-11-26T20:53:48.538619Z", + "shell.execute_reply": "2021-11-26T20:53:48.538263Z" + }, + "extensions": { + "jupyter_dashboards": { + "version": 1, + "views": { + "grid_default": {}, + "report_default": { + "hidden": true + } + } + } + }, + "papermill": { + "duration": 0.078109, + "end_time": "2021-11-26T20:53:48.538692", + "exception": false, + "start_time": "2021-11-26T20:53:48.460583", + "status": "completed" + }, + "slideshow": { + "slide_type": "skip" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "exercises_scores = scores.groupby([\"Exercice\", \"Eleve\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "id": "15025186", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NoteBareme
ExerciceEleve
Exercice 1ABOUHAFS Yasmine2.002.0
AKEAZI Hafsa2.002.0
AZIZ Nihal2.002.0
BARDOUSSE Yanis1.332.0
BILLET Simon2.002.0
\n", + "
" + ], + "text/plain": [ + " Note Bareme\n", + "Exercice Eleve \n", + "Exercice 1 ABOUHAFS Yasmine 2.00 2.0\n", + " AKEAZI Hafsa 2.00 2.0\n", + " AZIZ Nihal 2.00 2.0\n", + " BARDOUSSE Yanis 1.33 2.0\n", + " BILLET Simon 2.00 2.0" + ] + }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "exercises_scores.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "71c672c0", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:48.686783Z", + "iopub.status.busy": "2021-11-26T20:53:48.686418Z", + "iopub.status.idle": "2021-11-26T20:53:48.687627Z", + "shell.execute_reply": "2021-11-26T20:53:48.687922Z" + }, + "papermill": { + "duration": 0.077338, + "end_time": "2021-11-26T20:53:48.688009", + "exception": false, + "start_time": "2021-11-26T20:53:48.610671", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "assessment_scores = scores.groupby([\"Eleve\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "d8a02878", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Nom', 'Trimestre', 'Date', 'Exercice', 'Question', 'Competence',\n", + " 'Domaine', 'Commentaire', 'Est_nivele', 'Bareme', 'Eleve', 'Score',\n", + " 'Note', 'Niveau', 'Normalise'],\n", + " dtype='object')" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scores.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "id": "b6717594", + "metadata": {}, + "outputs": [], + "source": [ + "domain_scores = scores.groupby([\"Eleve\", \"Domaine\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})\n", + "domain_scores[\"Normalized\"] = domain_scores[\"Note\"] / domain_scores[\"Bareme\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "d87553e1", + "metadata": {}, + "outputs": [], + "source": [ + "#domain_scores" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "id": "61a49219", + "metadata": {}, + "outputs": [], + "source": [ + "competence_scores = scores.groupby([\"Eleve\", \"Competence\"]).agg({\"Note\": \"sum\", \"Bareme\": \"sum\"})\n", + "competence_scores[\"Normalized\"] = competence_scores[\"Note\"] / competence_scores[\"Bareme\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "id": "7c8ad2c9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NoteBaremeNormalized
EleveCompetence
ZERDOUNI AdamChercher0.671.00.67
Communiquer0.671.00.67
Modéliser1.001.01.00
Raisonner2.675.00.53
Représenter4.668.00.58
\n", + "
" + ], + "text/plain": [ + " Note Bareme Normalized\n", + "Eleve Competence \n", + "ZERDOUNI Adam Chercher 0.67 1.0 0.67\n", + " Communiquer 0.67 1.0 0.67\n", + " Modéliser 1.00 1.0 1.00\n", + " Raisonner 2.67 5.0 0.53\n", + " Représenter 4.66 8.0 0.58" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "competence_scores.tail()" + ] + }, + { + "cell_type": "markdown", + "id": "3437315d", + "metadata": { + "papermill": { + "duration": 0.071946, + "end_time": "2021-11-26T20:53:48.831774", + "exception": false, + "start_time": "2021-11-26T20:53:48.759828", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "### Bilans personnalisés" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "id": "dd4fa512", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:48.980091Z", + "iopub.status.busy": "2021-11-26T20:53:48.979725Z", + "iopub.status.idle": "2021-11-26T20:53:48.997193Z", + "shell.execute_reply": "2021-11-26T20:53:48.997507Z" + }, + "papermill": { + "duration": 0.09319, + "end_time": "2021-11-26T20:53:48.997612", + "exception": false, + "start_time": "2021-11-26T20:53:48.904422", + "status": "completed" + }, + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "import pytex\n", + "#scores.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "id": "6a667215", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:49.203563Z", + "iopub.status.busy": "2021-11-26T20:53:49.203169Z", + "iopub.status.idle": "2021-11-26T20:53:49.204750Z", + "shell.execute_reply": "2021-11-26T20:53:49.204378Z" + }, + "papermill": { + "duration": 0.130274, + "end_time": "2021-11-26T20:53:49.204830", + "exception": false, + "start_time": "2021-11-26T20:53:49.074556", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "datas = {\n", + " \"assessment\": {\n", + " \"name\": assessment,\n", + " \"date\": date\n", + " },\n", + " #\"exercises\": scores[\"Exercice\"].unique(),\n", + " #\"questions\": scores[[\"Exercice\", 'Question', 'Competence', 'Domaine', 'Commentaire', 'Bareme', 'Est_nivele']],\n", + " \"eleves\": {}\n", + "}\n", + "for e in scores[\"Eleve\"].unique():\n", + " edatas = {\n", + " \"e\": e,\n", + " \"assessment\": assessment_scores.loc[e],\n", + " \"exercices\": exercises_scores.xs(e, level=\"Eleve\"), \"exercices\": exercises_scores.xs(e, level=\"Eleve\"),\n", + " \"domains\": domain_scores.xs(e, level=\"Eleve\"),\n", + " \"competences\": competence_scores.xs(e, level=\"Eleve\"),\n", + " \"exscores\": {}\n", + " }\n", + " for i, ex in edatas[\"exercices\"].iterrows():\n", + " edatas[\"exscores\"][i] = scores.loc[(scores.Exercice==i) & (scores.Eleve==e)]\n", + " datas[\"eleves\"][e] = edatas" + ] + }, + { + "cell_type": "code", + "execution_count": 125, + "id": "16b39fd6", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:49.353384Z", + "iopub.status.busy": "2021-11-26T20:53:49.352979Z", + "iopub.status.idle": "2021-11-26T20:53:49.354713Z", + "shell.execute_reply": "2021-11-26T20:53:49.354304Z" + }, + "papermill": { + "duration": 0.077658, + "end_time": "2021-11-26T20:53:49.354792", + "exception": false, + "start_time": "2021-11-26T20:53:49.277134", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "score_template = r\"\"\"\n", + "\\documentclass[a5paper,10pt]{article}\n", + "\\usepackage{fullpage}\n", + "\\usepackage{booktabs}\n", + "\\usepackage{longtable}\n", + "\\usepackage{tikz}\n", + "\\usepackage{multicol}\n", + "\n", + "\\usepackage{geometry}\n", + "\\geometry{left=10mm,right=10mm, top=10mm}\n", + "\n", + "\\renewcommand{\\arraystretch}{1}\n", + "\\setlength{\\columnseprule}{0pt}\n", + "\n", + "\\pagestyle{empty}\n", + "\n", + "\n", + "\\begin{document}\n", + "\n", + "\n", + " \\section*{\\Var{assessment.name} \\hfill \\Var{e} \\hfill \\Var{sc.assessment.Note}/\\Var{sc.assessment.Bareme}}\n", + " %- for i,ex in sc.exercices.iterrows() \n", + " \\subsection*{\\Var{i}: \\hfill \\Var{ex.Note} / \\Var{ex.Bareme}}\n", + " \\begin{center}\n", + " \\Var{sc.exscores[i].to_latex(index=False, columns=[\"Question\", \"Domaine\", \"Commentaire\", \"Note\", \"Bareme\"])}\n", + " \\end{center}\n", + " %- endfor\n", + " \n", + " \\subsection*{Compétences}\n", + " \\begin{multicols}{2}\n", + " %- for i,dom in sc.competences.iterrows()\n", + " \\noindent\n", + " \\Var{i} \\hfill\n", + " \\begin{tikzpicture}[scale=0.7]\n", + " \\draw [](0,0) rectangle (3, 1);\n", + " \\draw [fill=black!20] (0, 0) rectangle (\\Var{dom.Normalized*3}, 1);\n", + " \\end{tikzpicture}\n", + " \\hfill\n", + " %\\Var{dom.Normalized}\n", + " \n", + " %- endfor\n", + " \\end{multicols}\n", + "\n", + "\\end{document}\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 126, + "id": "e7d7716e", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:49.513034Z", + "iopub.status.busy": "2021-11-26T20:53:49.512659Z", + "iopub.status.idle": "2021-11-26T20:53:53.445616Z", + "shell.execute_reply": "2021-11-26T20:53:53.445912Z" + }, + "papermill": { + "duration": 4.016494, + "end_time": "2021-11-26T20:53:53.446004", + "exception": false, + "start_time": "2021-11-26T20:53:49.429510", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wrote 211122_Ds3_ABOUHAFS Yasmine.tex\n", + "Wrote 211122_Ds3_AKEAZI Hafsa.tex\n", + "Wrote 211122_Ds3_AZIZ Nihal.tex\n", + "Wrote 211122_Ds3_BARDOUSSE Yanis.tex\n", + "Wrote 211122_Ds3_BILLET Simon.tex\n", + "Wrote 211122_Ds3_BOUAFIA Lina.tex\n", + "Wrote 211122_Ds3_DESGLENE Anthony.tex\n", + "Wrote 211122_Ds3_DROUOT Marine.tex\n", + "Wrote 211122_Ds3_FLACHERON Maylie.tex\n", + "Wrote 211122_Ds3_GARCIA MORENO Alberto.tex\n", + "Wrote 211122_Ds3_GNUI Kadia.tex\n", + "Wrote 211122_Ds3_GOSSET Jules.tex\n", + "Wrote 211122_Ds3_GOUGEAUD William.tex\n", + "Wrote 211122_Ds3_GRISON Jade.tex\n", + "Wrote 211122_Ds3_HAMIOT Anaïs.tex\n", + "Wrote 211122_Ds3_HAMMOUDI Lyna.tex\n", + "Wrote 211122_Ds3_JOUNEAU Cassandra.tex\n", + "Wrote 211122_Ds3_LAFUMAS Flora.tex\n", + "Wrote 211122_Ds3_MERLE Yannis.tex\n", + "Wrote 211122_Ds3_MONET--BRIFFOD Antonin.tex\n", + "Wrote 211122_Ds3_MONOD Mélissa.tex\n", + "Wrote 211122_Ds3_MULTIN Théo.tex\n", + "Wrote 211122_Ds3_NEIVA Diego.tex\n", + "Wrote 211122_Ds3_PETIT Aidan.tex\n", + "Wrote 211122_Ds3_PRAT Lilou.tex\n", + "Wrote 211122_Ds3_RINALDI Gianni.tex\n", + "Wrote 211122_Ds3_RIVERA--DRENEUC Kerly.tex\n", + "Wrote 211122_Ds3_ROSA DOS SANTOS Andréa.tex\n", + "Wrote 211122_Ds3_TAIBI Shaima.tex\n", + "Wrote 211122_Ds3_TELEGONE Angie.tex\n", + "Wrote 211122_Ds3_ZERDOUNI Adam.tex\n" + ] + } + ], + "source": [ + "tpl = pytex.texenv.from_string(score_template)\n", + "\n", + "for e,sc in datas['eleves'].items():\n", + " reportfilename = f\"{date:%y%m%d}_{assessment}_{e}.tex\"\n", + " with open(output_path / reportfilename, \"w\") as f:\n", + " f.write(tpl.render(sc=sc, e=e,**datas))\n", + " print(f\"Wrote {reportfilename}\")\n", + " pytex.pdflatex(reportfilename)" + ] + }, + { + "cell_type": "markdown", + "id": "dfaf5d3d", + "metadata": { + "papermill": { + "duration": 0.116257, + "end_time": "2021-11-26T20:53:53.678831", + "exception": false, + "start_time": "2021-11-26T20:53:53.562574", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "## Envoie des bilans par mail" + ] + }, + { + "cell_type": "code", + "execution_count": 127, + "id": "76384db8", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:53.922093Z", + "iopub.status.busy": "2021-11-26T20:53:53.921720Z", + "iopub.status.idle": "2021-11-26T20:53:53.923382Z", + "shell.execute_reply": "2021-11-26T20:53:53.923063Z" + }, + "papermill": { + "duration": 0.127584, + "end_time": "2021-11-26T20:53:53.923456", + "exception": false, + "start_time": "2021-11-26T20:53:53.795872", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bian du devoir Ds3\n", + "Bonsoir,\n", + "En pièce jointe, vous trouverez un document détaillant la note du devoir.\n", + "B.Bertrand\n", + "\n" + ] + } + ], + "source": [ + "mailfrom = \"benjamin.bertrand@ac-lyon.fr\"\n", + "subject = f\"Bian du devoir {assessment}\"\n", + "message = \"\"\"Bonsoir,\n", + "En pièce jointe, vous trouverez un document détaillant la note du devoir.\n", + "B.Bertrand\n", + "\"\"\"\n", + "print(subject)\n", + "print(message)" + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "id": "71eb9a2b", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:54.164176Z", + "iopub.status.busy": "2021-11-26T20:53:54.163810Z", + "iopub.status.idle": "2021-11-26T20:53:54.190175Z", + "shell.execute_reply": "2021-11-26T20:53:54.188791Z" + }, + "papermill": { + "duration": 0.149652, + "end_time": "2021-11-26T20:53:54.190456", + "exception": false, + "start_time": "2021-11-26T20:53:54.040804", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import smtplib\n", + "import os\n", + "import sys\n", + "from email.message import EmailMessage\n", + "import mimetypes\n", + "import time\n", + "import random" + ] + }, + { + "cell_type": "code", + "execution_count": 129, + "id": "f2834e6b", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:54.452725Z", + "iopub.status.busy": "2021-11-26T20:53:54.452362Z", + "iopub.status.idle": "2021-11-26T20:53:54.453602Z", + "shell.execute_reply": "2021-11-26T20:53:54.453904Z" + }, + "papermill": { + "duration": 0.126792, + "end_time": "2021-11-26T20:53:54.453991", + "exception": false, + "start_time": "2021-11-26T20:53:54.327199", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "def build_msg(subj, to_addr, from_addr, body, att):\n", + " msg = EmailMessage()\n", + " msg[\"Subject\"] = subj\n", + " msg[\"To\"] = to_addr\n", + " #msg[\"To\"] = \"lafrite26@gmail.com\"\n", + " msg[\"From\"] = from_addr\n", + " msg.set_content(body)\n", + "\n", + " if att != []:\n", + " ctype, encoding = mimetypes.guess_type(att)\n", + " if ctype is None or encoding is not None:\n", + " ctype = 'application/octet-stream'\n", + " maintype, subtype = ctype.split('/', 1)\n", + " with open(att, \"rb\") as f:\n", + " msg.add_attachment(f.read(),\n", + " maintype=maintype,\n", + " subtype=subtype,\n", + " filename=att.name)\n", + " return msg\n" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "id": "30311066", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:54.696622Z", + "iopub.status.busy": "2021-11-26T20:53:54.696227Z", + "iopub.status.idle": "2021-11-26T20:53:54.697474Z", + "shell.execute_reply": "2021-11-26T20:53:54.697794Z" + }, + "papermill": { + "duration": 0.124423, + "end_time": "2021-11-26T20:53:54.697885", + "exception": false, + "start_time": "2021-11-26T20:53:54.573462", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "send = 0\n", + "fake = 1" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "id": "d31598c3", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:54.965435Z", + "iopub.status.busy": "2021-11-26T20:53:54.965061Z", + "iopub.status.idle": "2021-11-26T20:53:54.966675Z", + "shell.execute_reply": "2021-11-26T20:53:54.966354Z" + }, + "papermill": { + "duration": 0.122545, + "end_time": "2021-11-26T20:53:54.966749", + "exception": false, + "start_time": "2021-11-26T20:53:54.844204", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "if send:\n", + " if fake:\n", + " server = smtplib.SMTP(\"localhost\", 8025)\n", + " server.ehlo()\n", + " else:\n", + " server = smtplib.SMTP(\"smtps.ac-lyon.fr\", 587)\n", + " server.ehlo()\n", + " server.starttls()\n", + " server.ehlo()\n", + " server.login(\"bbertrand\", os.popen(\"pass Prof/Lyon/bbertrand\").read()[:-1]) " + ] + }, + { + "cell_type": "code", + "execution_count": 132, + "id": "ca5690d7", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:55.207832Z", + "iopub.status.busy": "2021-11-26T20:53:55.207467Z", + "iopub.status.idle": "2021-11-26T20:53:55.210915Z", + "shell.execute_reply": "2021-11-26T20:53:55.210549Z" + }, + "papermill": { + "duration": 0.126236, + "end_time": "2021-11-26T20:53:55.210987", + "exception": false, + "start_time": "2021-11-26T20:53:55.084751", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "try:\n", + " eleves_data = pd.read_csv(f\"../../{tribe}.csv\")\n", + "except FileNotFoundError:\n", + " try:\n", + " eleves_data = pd.read_csv(f\"../{tribe}.csv\")\n", + " except FileNotFoundError:\n", + " eleves_data = pd.read_csv(f\"{tribe}.csv\")\n", + "eleves_data.fillna(\"\", inplace=True)\n", + "#eleves_data" + ] + }, + { + "cell_type": "code", + "execution_count": 133, + "id": "b676f878", + "metadata": { + "execution": { + "iopub.execute_input": "2021-11-26T20:53:55.451633Z", + "iopub.status.busy": "2021-11-26T20:53:55.451264Z", + "iopub.status.idle": "2021-11-26T20:53:55.456994Z", + "shell.execute_reply": "2021-11-26T20:53:55.457277Z" + }, + "papermill": { + "duration": 0.128366, + "end_time": "2021-11-26T20:53:55.457365", + "exception": false, + "start_time": "2021-11-26T20:53:55.328999", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\tBilan envoyé à ABOUHAFS Yasmine\n", + "Pas de mail pour AKEAZI Hafsa\n", + "Pas de mail pour AZIZ Nihal\n", + "\tBilan envoyé à BARDOUSSE Yanis\n", + "\tBilan envoyé à BILLET Simon\n", + "Pas de mail pour BOUAFIA Lina\n", + "\tBilan envoyé à DESGLENE Anthony\n", + "\tBilan envoyé à DROUOT Marine\n", + "\tBilan envoyé à FLACHERON Maylie\n", + "\tBilan envoyé à GARCIA MORENO Alberto\n", + "\tBilan envoyé à GNUI Kadia\n", + "\tBilan envoyé à GOSSET Jules\n", + "\tBilan envoyé à GOUGEAUD William\n", + "Pas de mail pour GRISON Jade\n", + "\tBilan envoyé à HAMIOT Anaïs\n", + "\tBilan envoyé à HAMMOUDI Lyna\n", + "\tBilan envoyé à JOUNEAU Cassandra\n", + "\tBilan envoyé à LAFUMAS Flora\n", + "Pas de mail pour MERLE Yannis\n", + "\tBilan envoyé à MONET--BRIFFOD Antonin\n", + "\tBilan envoyé à MONOD Mélissa\n", + "\tBilan envoyé à MULTIN Théo\n", + "\tBilan envoyé à NEIVA Diego\n", + "Pas de rapport pour PERROTIN Léonie\n", + "Pas de mail pour PETIT Aidan\n", + "\tBilan envoyé à PRAT Lilou\n", + "\tBilan envoyé à RINALDI Gianni\n", + "Pas de mail pour RIVERA--DRENEUC Kerly\n", + "\tBilan envoyé à ROSA DOS SANTOS Andréa\n", + "\tBilan envoyé à TAIBI Shaima\n", + "\tBilan envoyé à TELEGONE Angie\n", + "Pas de mail pour ZERDOUNI Adam\n" + ] + } + ], + "source": [ + "for e in eleves_data.iterrows():\n", + " reportfilename = Path(f\"{date:%y%m%d}_{assessment}_{e[1]['Nom']}.pdf\")\n", + " try:\n", + " assert reportfilename.exists()\n", + " except:\n", + " print(f\"Pas de rapport pour {e[1]['Nom']}\")\n", + " else:\n", + " if e[1][\"mail\"] != \"\":\n", + " if send:\n", + " msg = build_msg(subject, e[1][\"mail\"], mailfrom, message, reportfilename)\n", + " server.send_message(msg)\n", + " print(f\"\\tBilan envoyé à {e[1]['Nom']}\")\n", + " else:\n", + " print(f\"Pas de mail pour {e[1]['Nom']}\")\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "78e914c1", + "metadata": { + "papermill": { + "duration": 0.117162, + "end_time": "2021-11-26T20:53:55.691667", + "exception": false, + "start_time": "2021-11-26T20:53:55.574505", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "24ff9733", + "metadata": { + "papermill": { + "duration": 0.118807, + "end_time": "2021-11-26T20:53:55.931687", + "exception": false, + "start_time": "2021-11-26T20:53:55.812880", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "celltoolbar": "Diaporama", + "extensions": { + "jupyter_dashboards": { + "activeView": "grid_default", + "version": 1, + "views": { + "grid_default": { + "cellMargin": 10, + "defaultCellHeight": 20, + "maxColumns": 12, + "name": "grid", + "type": "grid" + }, + "report_default": { + "name": "report", + "type": "report" + } + } + } + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + }, + "papermill": { + "duration": 10.304573, + "end_time": "2021-11-26T20:53:56.367583", + "environment_variables": {}, + "exception": null, + "input_path": "templates/tpl_evaluation.ipynb", + "output_path": "2GT6/211122_DS3/Ds3.ipynb", + "parameters": { + "assessment": "Ds3", + "csv_file": "/media/documents/Cours/2021-2022/Notes/2GT6/211122_DS3.csv", + "date": "22/11/21", + "tribe": "2GT6" + }, + "start_time": "2021-11-26T20:53:46.063010", + "version": "1.2.1" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}