diff --git a/drees.py b/drees.py index ca57d72..49879a6 100644 --- a/drees.py +++ b/drees.py @@ -499,13 +499,15 @@ def get_age_field_args() -> List[Tuple[AgeGroup, Field]]: return pool_args -def generate_html_page() -> None: +def generate_html_page(np_date: np.ndarray) -> None: logging.info("generating html page with plots...") os.makedirs(BUILD_REPOSITORY, exist_ok=True) env = Environment( loader=FileSystemLoader("templates"), autoescape=select_autoescape() ) 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) data = template.render( **{ "fields": Field, @@ -513,6 +515,7 @@ def generate_html_page() -> None: "status": VacStatus, "static": os.path.join(MAIN_URL, STATIC_REPOSITORY), "src": DATA_URL, + "period": f"{date_start} -> {date_end}" } ) with open(os.path.join(BUILD_REPOSITORY, "index.html"), "w") as f: @@ -583,4 +586,4 @@ if __name__ == "__main__": plot_bar_age_percent_by_field(np_data, np_date, field) if args.to_html: - generate_html_page() + generate_html_page(np_date) diff --git a/templates/index.template.html b/templates/index.template.html index 52a2069..9ff363c 100644 --- a/templates/index.template.html +++ b/templates/index.template.html @@ -11,6 +11,7 @@

Thegux covid-19

source : Data DRESS
+
période temporelle : {{ period }}

Hospitalisations/Soins critiques/Décés par status vaccinal groupés par tranches d'âges

{% for field in fields %}