From 978d051e09f81f1cae1702610ec668a490f53ce2 Mon Sep 17 00:00:00 2001 From: landrigun Date: Sun, 16 Oct 2022 16:08:54 +0000 Subject: [PATCH] add owid plot if exist in the html template --- drees.py | 6 ++++++ templates/index.template.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drees.py b/drees.py index f704025..ba83307 100644 --- a/drees.py +++ b/drees.py @@ -606,6 +606,9 @@ def generate_html_page( template = env.get_template("index.template.html") date_start = np_date[0].astype(dt).strftime(DATE_FORMAT) date_end = np_date[-1].astype(dt).strftime(DATE_FORMAT) + + date_build = dt.strftime(dt.now(), "%Y%m%d") + owid_path = f"fra-{date_build}.png" data = template.render( **{ "fields": Field, @@ -616,6 +619,9 @@ def generate_html_page( "period": f"{date_start} - {date_end}", "vaccine_mean": [x for x in lst_analyse_data if type(x) == VaccineMean], "age_mean": [x for x in lst_analyse_data if type(x) == AgeMean], + "owid_path": owid_path + if os.path.isfile(os.path.join(OUTPUT_REPOSITORY, owid_path)) + else "", } ) with open(os.path.join(BUILD_REPOSITORY, "index.html"), "w") as f: diff --git a/templates/index.template.html b/templates/index.template.html index aaa2380..a14ce79 100644 --- a/templates/index.template.html +++ b/templates/index.template.html @@ -100,6 +100,12 @@ {% endfor %} {% endfor %} + {% if owid_path != "" %} +
+

OWID - Our World In Data

+

NOTE: ces données sont issues de OWID, un mélange et un traitement de plusieurs jeu de données

+ + {% endif %}