Feat: Module can be pip now
This commit is contained in:
0
recopytex/scripts/__init__.py
Normal file
0
recopytex/scripts/__init__.py
Normal file
@@ -6,6 +6,7 @@ from pathlib import Path
|
||||
import yaml
|
||||
import sys
|
||||
import papermill as pm
|
||||
from datetime import datetime
|
||||
|
||||
CONFIGPATH = "recoconfig.yml"
|
||||
|
||||
@@ -41,6 +42,12 @@ def report(csv_file):
|
||||
csv_filename = csv_file.name.split(".")[0]
|
||||
|
||||
assessment = str(csv_filename).split("_")[-1].capitalize()
|
||||
date = str(csv_filename).split("_")[0]
|
||||
try:
|
||||
date = datetime.strptime(date, "%y%m%d")
|
||||
except ValueError:
|
||||
date = None
|
||||
|
||||
tribe = str(tribe_dir).split("/")[-1]
|
||||
|
||||
template = Path(config["templates"]) / "tpl_evaluation.ipynb"
|
||||
@@ -48,12 +55,12 @@ def report(csv_file):
|
||||
dest = Path(config["output"]) / tribe / csv_filename
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
click.echo(f"Building {assessment} report")
|
||||
click.echo(f"Building {assessment} ({date:%d/%m/%y}) report")
|
||||
pm.execute_notebook(
|
||||
str(template),
|
||||
str(dest / f"{assessment}.ipynb"),
|
||||
parameters=dict(
|
||||
tribe=tribe, assessment=assessment, csv_file=str(csv_file.absolute())
|
||||
tribe=tribe, assessment=assessment, date=f"{date:%d/%m/%y}", csv_file=str(csv_file.absolute())
|
||||
),
|
||||
)
|
||||
|
||||
@@ -72,7 +79,3 @@ def report(csv_file):
|
||||
parameters=dict(tribe=tribe, student=st, source=str(tribe_dir.absolute())),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
|
||||
Reference in New Issue
Block a user