add temporal period
This commit is contained in:
parent
4898c3e037
commit
1b581603c7
7
drees.py
7
drees.py
@ -499,13 +499,15 @@ def get_age_field_args() -> List[Tuple[AgeGroup, Field]]:
|
|||||||
return pool_args
|
return pool_args
|
||||||
|
|
||||||
|
|
||||||
def generate_html_page() -> None:
|
def generate_html_page(np_date: np.ndarray) -> None:
|
||||||
logging.info("generating html page with plots...")
|
logging.info("generating html page with plots...")
|
||||||
os.makedirs(BUILD_REPOSITORY, exist_ok=True)
|
os.makedirs(BUILD_REPOSITORY, exist_ok=True)
|
||||||
env = Environment(
|
env = Environment(
|
||||||
loader=FileSystemLoader("templates"), autoescape=select_autoescape()
|
loader=FileSystemLoader("templates"), autoescape=select_autoescape()
|
||||||
)
|
)
|
||||||
template = env.get_template("index.template.html")
|
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(
|
data = template.render(
|
||||||
**{
|
**{
|
||||||
"fields": Field,
|
"fields": Field,
|
||||||
@ -513,6 +515,7 @@ def generate_html_page() -> None:
|
|||||||
"status": VacStatus,
|
"status": VacStatus,
|
||||||
"static": os.path.join(MAIN_URL, STATIC_REPOSITORY),
|
"static": os.path.join(MAIN_URL, STATIC_REPOSITORY),
|
||||||
"src": DATA_URL,
|
"src": DATA_URL,
|
||||||
|
"period": f"{date_start} -> {date_end}"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
with open(os.path.join(BUILD_REPOSITORY, "index.html"), "w") as f:
|
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)
|
plot_bar_age_percent_by_field(np_data, np_date, field)
|
||||||
|
|
||||||
if args.to_html:
|
if args.to_html:
|
||||||
generate_html_page()
|
generate_html_page(np_date)
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<h1>Thegux covid-19</h1>
|
<h1>Thegux covid-19</h1>
|
||||||
<div>source : <a href="{{ src }}">Data DRESS</a></div>
|
<div>source : <a href="{{ src }}">Data DRESS</a></div>
|
||||||
|
<div>période temporelle : {{ period }}</div>
|
||||||
<h3>Hospitalisations/Soins critiques/Décés par status vaccinal groupés par tranches d'âges</h3>
|
<h3>Hospitalisations/Soins critiques/Décés par status vaccinal groupés par tranches d'âges</h3>
|
||||||
{% for field in fields %}
|
{% for field in fields %}
|
||||||
<img src="{{ static }}/plots/age_percent_vac_{{ field.name.lower() }}.png"/>
|
<img src="{{ static }}/plots/age_percent_vac_{{ field.name.lower() }}.png"/>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user