add owid plot if exist in the html template
This commit is contained in:
		
							parent
							
								
									160215950c
								
							
						
					
					
						commit
						978d051e09
					
				
							
								
								
									
										6
									
								
								drees.py
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								drees.py
									
									
									
									
									
								
							| @ -606,6 +606,9 @@ def generate_html_page( | |||||||
|     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_start = np_date[0].astype(dt).strftime(DATE_FORMAT) | ||||||
|     date_end = np_date[-1].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( |     data = template.render( | ||||||
|         **{ |         **{ | ||||||
|             "fields": Field, |             "fields": Field, | ||||||
| @ -616,6 +619,9 @@ def generate_html_page( | |||||||
|             "period": f"{date_start} - {date_end}", |             "period": f"{date_start} - {date_end}", | ||||||
|             "vaccine_mean": [x for x in lst_analyse_data if type(x) == VaccineMean], |             "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], |             "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: |     with open(os.path.join(BUILD_REPOSITORY, "index.html"), "w") as f: | ||||||
|  | |||||||
| @ -100,6 +100,12 @@ | |||||||
|                     {% endfor %} |                     {% endfor %} | ||||||
|                 {% endfor %} |                 {% endfor %} | ||||||
|             </div> |             </div> | ||||||
|  | 	    {% if owid_path != "" %} | ||||||
|  | 	    <hr/> | ||||||
|  | 	    <h3>OWID - Our World In Data</h3> | ||||||
|  | 	    <h4>NOTE: ces données sont issues de <a href="https://github.com/owid/covid-19-data/tree/master/public/data">OWID</a>, un mélange et un traitement de plusieurs jeu de données</h4> | ||||||
|  | 	    <img src="{{ static }}/plots/{{ owid_path }}"/> | ||||||
|  | 	    {% endif %} | ||||||
|         </div> |         </div> | ||||||
|     </body> |     </body> | ||||||
| </html> | </html> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user