Feat: tpl_evaluation parameters and absolute path

This commit is contained in:
Bertrand Benjamin 2019-08-04 16:43:06 +02:00
parent 595102ecca
commit 18696a805c
3 changed files with 30 additions and 33 deletions

View File

@ -32,17 +32,22 @@ def report(csv_file):
click.echo(f"{csv_file} has to be a csv file")
sys.exit(1)
*a, tribe, assessment_file = csv_file.split("/")
assessment_desc = assessment_file.split(".")[0]
assessment_name = assessment_desc.split("_")[-1].capitalize()
csv_file = Path(csv_file)
csv_filename = csv_file.name.split(".")[0]
assessment = str(csv_filename).split("_")[-1].capitalize()
tribe = str(csv_file.parent).split("/")[-1]
template = Path(config["templates"]) / "tpl_evaluation.ipynb"
dest = Path(config["output"]) / tribe / assessment_name / f"{assessment_name}.ipynb"
dest = Path(config["output"]) / tribe / csv_filename / f"{assessment}.ipynb"
dest.parent.mkdir(parents=True, exist_ok=True)
pm.execute_notebook(
str(template), str(dest), parameters=dict(tribe=tribe, assessment=assessment_name)
str(template),
str(dest),
parameters=dict(
tribe=tribe, assessment=assessment, csv_file=str(csv_file.absolute())
),
)

View File

@ -1,19 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"tribe = \"308\"\n",
"assessment = \"161114_dm2\""
]
},
{
"cell_type": "code",
"execution_count": 37,
@ -27,10 +13,16 @@
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"execution_count": 36,
"metadata": {
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"tribe = \"308\"\n",
"assessment = \"161114_dm2\"\n",
"csv_file = Path(f\"./sheets/{tribe}/{assessment}.csv\")"
]
},

View File

@ -1,5 +1,16 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Markdown as md\n",
"import pandas as pd\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 6,
@ -10,21 +21,10 @@
},
"outputs": [],
"source": [
"tribe = 308\n",
"tribe = 30\n",
"student = \"ABDOU Asmahane\""
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Markdown as md\n",
"import pandas as pd\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 9,