add logging + add metadata in html template
This commit is contained in:
parent
4c41b44d77
commit
37712f892d
10
drees.py
10
drees.py
@ -402,7 +402,11 @@ def plot_cumulative_field(
|
||||
plt.xlabel("date")
|
||||
plt.ylabel("nombre")
|
||||
save_and_close_fig(
|
||||
fig, os.path.join(OUTPUT_REPOSITORY, f"cumulative_{age_group.name.lower()}_{field.name.lower()}")
|
||||
fig,
|
||||
os.path.join(
|
||||
OUTPUT_REPOSITORY,
|
||||
f"cumulative_{age_group.name.lower()}_{field.name.lower()}",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@ -511,10 +515,12 @@ def move_tmp_plots() -> None:
|
||||
"""
|
||||
move .tmp.png plots into .png after generation
|
||||
"""
|
||||
logging.info(f"moving '{OUTPUT_SUFFIX}' file in {FORMAT_SUFFIX}...")
|
||||
for filename in os.listdir(OUTPUT_REPOSITORY):
|
||||
file_path = os.path.join(OUTPUT_REPOSITORY, filename)
|
||||
if re.match(TMP_FILE_REGEX, filename):
|
||||
os.rename(file_path, file_path.replace(OUTPUT_SUFFIX, FORMAT_SUFFIX))
|
||||
logging.info("files moved")
|
||||
|
||||
|
||||
def generate_html_page(np_date: np.ndarray) -> None:
|
||||
@ -533,7 +539,7 @@ def generate_html_page(np_date: np.ndarray) -> None:
|
||||
"status": VacStatus,
|
||||
"static": os.path.join(MAIN_URL, STATIC_REPOSITORY),
|
||||
"src": DATA_URL,
|
||||
"period": f"{date_start} -> {date_end}",
|
||||
"period": f"{date_start} - {date_end}",
|
||||
}
|
||||
)
|
||||
with open(os.path.join(BUILD_REPOSITORY, "index.html"), "w") as f:
|
||||
|
||||
@ -11,13 +11,14 @@
|
||||
<div class="main-container">
|
||||
<h1>Thegux covid-19</h1>
|
||||
<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>
|
||||
<div>période temporelle : <b>{{ period }}</b></div>
|
||||
<div>pas de temps : <b>journalier</b></div>
|
||||
<h3>Hospitalisations/Soins critiques/Décés par status vaccinal groupés et tranches d'âges</h3>
|
||||
{% for field in fields %}
|
||||
<img src="{{ static }}/plots/age_percent_vac_{{ field.name.lower() }}.png"/>
|
||||
<img src="{{ static }}/plots/age_percent_unvac_{{ field.name.lower() }}.png"/>
|
||||
{% endfor %}
|
||||
<h3>Hospitalisations/Soins critiques/Décés par tranches d'âges groupés par status vaccinal</h3>
|
||||
<h3>Hospitalisations/Soins critiques/Décés par tranches d'âges groupés et status vaccinal</h3>
|
||||
{% for age in ages %}
|
||||
{% for field in fields %}
|
||||
<img src="{{ static }}/plots/vac_percent_{{ age.name.lower() }}_{{ field.name.lower() }}.png"/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user