diff --git a/src/covid19/blueprints/owid/owid_model.py b/src/covid19/blueprints/owid/owid_model.py index 153de63ecfa0643ec4841a4efcddd7dcf72069fd..2ca85a9e5c47b64367bc26f3e859e2d921523f3c 100644 --- a/src/covid19/blueprints/owid/owid_model.py +++ b/src/covid19/blueprints/owid/owid_model.py @@ -94,6 +94,10 @@ class OwidCountry(db.Model): result += " " return result + @classmethod + def get_countries_for_continent(cls, owid_continent_one: OwidContinent, page: int): + return db.session.query(cls).filter(cls.continent == owid_continent_one).paginate(page, per_page=ITEMS_PER_PAGE) + @classmethod def find_by_iso_code_and_location(cls, iso_code, location): return db.session.query(cls).filter(and_((cls.iso_code == iso_code), (cls.location == location))).one_or_none() @@ -177,6 +181,17 @@ class OwidData(db.Model): new_vaccinations_smoothed_per_million = db.Column(db.String(255), nullable=False) stringency_index = db.Column(db.String(255), nullable=False) + @classmethod + def get_data_for_country(cls, owid_country_one, page): + return db.session.query(cls).filter( + cls.country == owid_country_one + ).populate_existing().options( + joinedload(cls.country), + joinedload(cls.date_reported), + ).order_by( + cls.country.location + ).paginate(page, per_page=ITEMS_PER_PAGE) + @classmethod def remove_all(cls): for one in cls.get_all(): @@ -201,7 +216,8 @@ class OwidData(db.Model): return db.session.query(cls).filter( cls.date_reported_id == date_reported.id ).populate_existing().options( - joinedload(cls.date_reported) + joinedload(cls.date_reported), + joinedload(cls.country), ).order_by( cls.new_deaths.desc(), cls.new_cases.desc(), diff --git a/src/covid19/blueprints/owid/owid_views.py b/src/covid19/blueprints/owid/owid_views.py index 56371fec72d167e23bbbdeaa7bbe5455e8ba64f0..fbbb37f0163baff6b08b59a1706e23772ed22a2a 100644 --- a/src/covid19/blueprints/owid/owid_views.py +++ b/src/covid19/blueprints/owid/owid_views.py @@ -7,7 +7,7 @@ from flask_admin.contrib.sqla import ModelView from database import app, admin, db from covid19.blueprints.application.application_services import owid_service from covid19.blueprints.application.application_workers import celery -from covid19.blueprints.owid.owid_model import OwidDateReported, OwidData +from covid19.blueprints.owid.owid_model import OwidDateReported, OwidData, OwidContinent, OwidCountry from covid19.blueprints.owid.owid_model_import import OwidImport from covid19.blueprints.application.application_model_transient import ApplicationPage @@ -262,8 +262,8 @@ def url_owid_date_reported(date_reported_id: int, page: int = 1): date_reported = OwidDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( "Date Reported: " + date_reported.date_reported, - 'WHO', - "data of all reported countries for WHO date reported " + date_reported.date_reported + " " + 'OWID', + "data of all reported countries for OWID date reported " + date_reported.date_reported + " " ) try: page_data = OwidData.get_data_for_day(date_reported, page) @@ -283,8 +283,8 @@ def url_owid_date_reported_cases_new(date_reported_id: int, page: int = 1): date_reported = OwidDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( "Date Reported: " + date_reported.date_reported, - 'WHO', - "data of all reported countries for WHO date reported " + date_reported.date_reported + " " + 'OWID', + "data of all reported countries for OWID date reported " + date_reported.date_reported + " " ) try: page_data = OwidData.get_data_for_day_order_by_cases_new(date_reported, page) @@ -304,8 +304,8 @@ def url_owid_date_reported_cases_cumulative(date_reported_id: int, page: int = 1 date_reported = OwidDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( "Date Reported: " + date_reported.date_reported, - 'WHO', - "data of all reported countries for WHO date reported " + date_reported.date_reported + " " + 'OWID', + "data of all reported countries for OWID date reported " + date_reported.date_reported + " " ) try: page_data = OwidData.get_data_for_day_order_by_cases_cumulative(date_reported, page) @@ -325,8 +325,8 @@ def url_owid_date_reported_deaths_new(date_reported_id: int, page: int = 1): date_reported = OwidDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( "Date Reported: " + date_reported.date_reported, - 'WHO', - "data of all reported countries for WHO date reported " + date_reported.date_reported + " " + 'OWID', + "data of all reported countries for OWID date reported " + date_reported.date_reported + " " ) try: page_data = OwidData.get_data_for_day_order_by_deaths_new(date_reported, page) @@ -346,8 +346,8 @@ def url_owid_date_reported_deaths_cumulative(date_reported_id: int, page: int = date_reported = OwidDateReported.get_by_id(date_reported_id) page_info = ApplicationPage( "Date Reported: " + date_reported.date_reported, - 'WHO', - "data of all reported countries for WHO date reported " + date_reported.date_reported + " " + 'OWID', + "data of all reported countries for OWID date reported " + date_reported.date_reported + " " ) try: page_data = OwidData.get_data_for_day_order_by_deaths_cumulative(date_reported, page) @@ -361,6 +361,84 @@ def url_owid_date_reported_deaths_cumulative(date_reported_id: int, page: int = page_info=page_info) +@app_owid.route('/continent/all/page/<int:page>') +@app_owid.route('/continent/all') +def url_owid_continent_all(page: int = 1): + page_info = ApplicationPage( + "Continents " + 'OWID' + ) + try: + page_data = OwidContinent.get_all(page) + except OperationalError: + flash("No data in the database.") + page_data = None + return render_template( + 'owid/continent/owid_continent_all.html', + page_data=page_data, + page_info=page_info) + + +@app_owid.route('/continent/<int:continent_id>/page/<int:page>') +@app_owid.route('/continent/<int:continent_id>') +def url_owid_continent_one(continent_id: int, page: int = 1): + owid_continent_one = OwidContinent.get_by_id(continent_id) + page_info = ApplicationPage( + "continent: " + owid_continent_one.region, + 'OWID', + "countries for OWID continent " + owid_continent_one.region + " " + ) + try: + page_data = OwidCountry.get_countries_for_continent(owid_continent_one, page) + except OperationalError: + flash("No data in the database.") + page_data = None + return render_template( + 'owid/continent/owid_continent_one.html', + owid_continent=owid_continent_one, + page_data=page_data, + page_info=page_info) + + +@app_owid.route('/country/all/page/<int:page>') +@app_owid.route('/country/all') +def url_owid_country_all(page: int = 1): + page_info = ApplicationPage( + "Continents " + 'OWID' + ) + try: + page_data = OwidContinent.get_all(page) + except OperationalError: + flash("No data in the database.") + page_data = None + return render_template( + 'owid/country/owid_country_all.html', + page_data=page_data, + page_info=page_info) + + +@app_owid.route('/country/<int:country_id>/page/<int:page>') +@app_owid.route('/country/<int:country_id>') +def url_owid_country_one(country_id: int, page: int = 1): + owid_country_one = OwidCountry.get_by_id(country_id) + page_info = ApplicationPage( + "continent: " + owid_country_one.location, + 'OWID', + "countries for OWID continent " + owid_country_one.region + " " + ) + try: + page_data = OwidData.get_data_for_country(owid_country_one, page) + except OperationalError: + flash("No data in the database.") + page_data = None + return render_template( + 'owid/country/owid_country_one.html', + owid_country=owid_country_one, + page_data=page_data, + page_info=page_info) + + # ---------------------------------------------------------------------------------------------------------------- # Celery TASKS # ---------------------------------------------------------------------------------------------------------------- diff --git a/src/covid19/blueprints/owid/templates/owid/continent/owid_continents.html b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all.html similarity index 74% rename from src/covid19/blueprints/owid/templates/owid/continent/owid_continents.html rename to src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all.html index 7a4964affd11aab8335fbab9f0918b3e4833306f..e23f77299ebe5f4713b37215c1d4a2c56e52e83e 100644 --- a/src/covid19/blueprints/owid/templates/owid/continent/owid_continents.html +++ b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all.html @@ -7,17 +7,17 @@ <div class="container"> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_test_pagination.html' %} + {% include 'owid/continent/owid_continent_all_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_test_table.html' %} + {% include 'owid/continent/owid_continent_all_table.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_test_pagination.html' %} + {% include 'owid/continent/owid_continent_all_pagination.html' %} </div> </div> </div> diff --git a/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all_pagination.html b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..3072fd4118583e87ca003333c79d4bb8a91870bd --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all_pagination.html @@ -0,0 +1,37 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('owid.url_owid_continent_all', page=page_data.prev_num) }}">Previous</a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('owid.url_owid_continent_all', page=page_num) }}">{{ page_num }}</a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('owid.url_owid_continent_all', page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} diff --git a/src/covid19/blueprints/owid/templates/owid/continent/owid_continents_table.html b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all_table.html similarity index 63% rename from src/covid19/blueprints/owid/templates/owid/continent/owid_continents_table.html rename to src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all_table.html index a47a3936b19a6db09bede3f6d70fe0920450b49b..1a52f2e1af0331e09bc8c9c9c96eb4a4aa852989 100644 --- a/src/covid19/blueprints/owid/templates/owid/continent/owid_continents_table.html +++ b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_all_table.html @@ -7,7 +7,11 @@ <tbody> {% for data_item in page_data.items %} <tr> - <td>{{ data_item.continent }}</td> + <td> + <a href="{{ url_for('owid.url_owid_continent_one', continent_id=data_item.id) }}"> + {{ data_item.continent }} + </a> + </td> </tr> {% endfor %} </tbody> diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_countries.html b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one.html similarity index 74% rename from src/covid19/blueprints/owid/templates/owid/country/owid_countries.html rename to src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one.html index 7a4964affd11aab8335fbab9f0918b3e4833306f..017f224b92d4a69f7c49c5a288c7f64c6a5cffb9 100644 --- a/src/covid19/blueprints/owid/templates/owid/country/owid_countries.html +++ b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one.html @@ -7,17 +7,17 @@ <div class="container"> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_test_pagination.html' %} + {% include 'owid/continent/owid_continent_one_pagination.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_test_table.html' %} + {% include 'owid/continent/owid_continent_one_table.html' %} </div> </div> <div class="row"> <div class="col"> - {% include 'owid/fragments/fragment_owid_test_pagination.html' %} + {% include 'owid/continent/owid_continent_one_pagination.html' %} </div> </div> </div> diff --git a/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one_pagination.html b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..ac5925b2ce262f044acbaa951412749200636568 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one_pagination.html @@ -0,0 +1,37 @@ + {% if page_data.pages > 1 %} + <!-- previous page --> + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('owid.url_owid_continent_one', continent_id=owid_continent.id, page=page_data.prev_num) }}">Previous</a> + </li> + {% endif %} + <!-- all page numbers --> + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('owid.url_owid_continent_one', continent_id=owid_continent.id, page=page_num) }}">{{ page_num }}</a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + <!-- next page --> + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for('owid.url_owid_continent_one', continent_id=owid_continent.id, page=page_data.next_num) }}">Next</a> + </li> + {% endif %} + </ul> + {% endif %} diff --git a/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one_table.html b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one_table.html new file mode 100644 index 0000000000000000000000000000000000000000..c6cdc530b65035b78678237854fd081274b15a83 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/continent/owid_continent_one_table.html @@ -0,0 +1,48 @@ + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + <tr> + <th scope="col">iso_code</th> + <th scope="col">continent</th> + <th scope="col">location</th> + <th scope="col">population</th> + <th scope="col">population_density</th> + <th scope="col">median_age</th> + <th scope="col">aged_65_older</th> + <th scope="col">aged_70_older</th> + <th scope="col">gdp_per_capita</th> + <th scope="col">extreme_poverty</th> + <th scope="col">cardiovasc_death_rate</th> + <th scope="col">diabetes_prevalence</th> + <th scope="col">female_smokers</th> + <th scope="col">male_smokers</th> + <th scope="col">handwashing_facilities</th> + <th scope="col">hospital_beds_per_thousand</th> + <th scope="col">life_expectancy</th> + <th scope="col">human_development_index</th> + </tr> + </thead> + <tbody> + {% for owid_country in page_data.items %} + <tr> + <td>{{ owid_country.iso_code }}</td> + <td>{{ owid_country.continent.region }}</td> + <td>{{ owid_country.location }}</td> + <td>{{ owid_country.population }}</td> + <td>{{ owid_country.population_density }}</td> + <td>{{ owid_country.median_age }}</td> + <td>{{ owid_country.aged_65_older }}</td> + <td>{{ owid_country.aged_70_older }}</td> + <td>{{ owid_country.gdp_per_capita }}</td> + <td>{{ owid_country.extreme_poverty }}</td> + <td>{{ owid_country.cardiovasc_death_rate }}</td> + <td>{{ owid_country.diabetes_prevalence }}</td> + <td>{{ owid_country.female_smokers }}</td> + <td>{{ owid_country.male_smokers }}</td> + <td>{{ owid_country.handwashing_facilities }}</td> + <td>{{ owid_country.hospital_beds_per_thousand }}</td> + <td>{{ owid_country.life_expectancy }}</td> + <td>{{ owid_country.human_development_index }}</td> + </tr> + {% endfor %} + </tbody> + </table> \ No newline at end of file diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_countries_table.html b/src/covid19/blueprints/owid/templates/owid/country/owid_countries_table.html deleted file mode 100644 index 50b155e2312e77b50f3c4cb203de57ce0a12ce4e..0000000000000000000000000000000000000000 --- a/src/covid19/blueprints/owid/templates/owid/country/owid_countries_table.html +++ /dev/null @@ -1,131 +0,0 @@ - <table class="table table-hover table-striped table-dark"> - <thead> - <tr> - <th scope="col">iso_code</th> - <th scope="col">continent</th> - <th scope="col">location</th> - <th scope="col">date</th> - <th scope="col">total_cases</th> - <th scope="col">new_cases</th> - <th scope="col">new_cases_smoothed</th> - <th scope="col">total_deaths</th> - <th scope="col">new_deaths</th> - <th scope="col">new_deaths_smoothed</th> - <th scope="col">total_cases_per_million</th> - <th scope="col">new_cases_per_million</th> - <th scope="col">new_cases_smoothed_per_million</th> - <th scope="col">total_deaths_per_million</th> - <th scope="col">new_deaths_per_million</th> - <th scope="col">new_deaths_smoothed_per_million</th> - <th scope="col">reproduction_rate</th> - <th scope="col">icu_patients</th> - <th scope="col">icu_patients_per_million</th> - <th scope="col">hosp_patients</th> - <th scope="col">hosp_patients_per_million</th> - <th scope="col">weekly_icu_admissions</th> - <th scope="col">weekly_icu_admissions_per_million</th> - <th scope="col">weekly_hosp_admissions</th> - <th scope="col">weekly_hosp_admissions_per_million</th> - <th scope="col">new_tests</th> - <th scope="col">total_tests</th> - <th scope="col">total_tests_per_thousand</th> - <th scope="col">new_tests_per_thousand</th> - <th scope="col">new_tests_smoothed</th> - <th scope="col">new_tests_smoothed_per_thousand</th> - <th scope="col">positive_rate</th> - <th scope="col">tests_per_case</th> - <th scope="col">tests_units</th> - <th scope="col">total_vaccinations</th> - <th scope="col">people_vaccinated</th> - <th scope="col">people_fully_vaccinated</th> - <th scope="col">new_vaccinations</th> - <th scope="col">new_vaccinations_smoothed</th> - <th scope="col">total_vaccinations_per_hundred</th> - <th scope="col">people_vaccinated_per_hundred</th> - <th scope="col">people_fully_vaccinated_per_hundred</th> - <th scope="col">new_vaccinations_smoothed_per_million</th> - <th scope="col">stringency_index</th> - <th scope="col">population</th> - <th scope="col">population_density</th> - <th scope="col">median_age</th> - <th scope="col">aged_65_older</th> - <th scope="col">aged_70_older</th> - <th scope="col">gdp_per_capita</th> - <th scope="col">extreme_poverty</th> - <th scope="col">cardiovasc_death_rate</th> - <th scope="col">diabetes_prevalence</th> - <th scope="col">female_smokers</th> - <th scope="col">male_smokers</th> - <th scope="col">handwashing_facilities</th> - <th scope="col">hospital_beds_per_thousand</th> - <th scope="col">life_expectancy</th> - <th scope="col">human_development_index</th> - </tr> - </thead> - <tbody> - {% for owid in page_data.items %} - <tr> - <td>{{ owid.country.iso_code }}</td> - <td>{{ owid.country.continent.region }}</td> - <td>{{ owid.country.location }}</td> - <td>{{ owid.date }}</td> - <td>{{ owid.total_cases }}</td> - <td>{{ owid.new_cases }}</td> - <td>{{ owid.new_cases_smoothed }}</td> - <td>{{ owid.total_deaths }}</td> - <td>{{ owid.new_deaths }}</td> - <td>{{ owid.new_deaths_smoothed }}</td> - <td>{{ owid.total_cases_per_million }}</td> - <td>{{ owid.new_cases_per_million }}</td> - <td>{{ owid.new_cases_smoothed_per_million }}</td> - <td>{{ owid.total_deaths_per_million }}</td> - <td>{{ owid.new_deaths_per_million }}</td> - <td>{{ owid.new_deaths_smoothed_per_million }}</td> - <td>{{ owid.reproduction_rate }}</td> - <td>{{ owid.icu_patients }}</td> - <td>{{ owid.icu_patients_per_million }}</td> - <td>{{ owid.hosp_patients }}</td> - <td>{{ owid.hosp_patients_per_million }}</td> - <td>{{ owid.weekly_icu_admissions }}</td> - <td>{{ owid.weekly_icu_admissions_per_million }}</td> - <td>{{ owid.weekly_hosp_admissions }}</td> - <td>{{ owid.weekly_hosp_admissions_per_million }}</td> - <td>{{ owid.new_tests }}</td> - <td>{{ owid.total_tests }}</td> - <td>{{ owid.total_tests_per_thousand }}</td> - <td>{{ owid.new_tests_per_thousand }}</td> - <td>{{ owid.new_tests_smoothed }}</td> - <td>{{ owid.new_tests_smoothed_per_thousand }}</td> - <td>{{ owid.positive_rate }}</td> - <td>{{ owid.tests_per_case }}</td> - <td>{{ owid.tests_units }}</td> - <td>{{ owid.total_vaccinations }}</td> - <td>{{ owid.people_vaccinated }}</td> - <td>{{ owid.people_fully_vaccinated }}</td> - <td>{{ owid.new_vaccinations }}</td> - <td>{{ owid.new_vaccinations_smoothed }}</td> - <td>{{ owid.total_vaccinations_per_hundred }}</td> - <td>{{ owid.people_vaccinated_per_hundred }}</td> - <td>{{ owid.people_fully_vaccinated_per_hundred }}</td> - <td>{{ owid.new_vaccinations_smoothed_per_million }}</td> - <td>{{ owid.stringency_index }}</td> - <td>{{ owid.population }}</td> - <td>{{ owid.population_density }}</td> - <td>{{ owid.median_age }}</td> - <td>{{ owid.aged_65_older }}</td> - <td>{{ owid.aged_70_older }}</td> - <td>{{ owid.gdp_per_capita }}</td> - <td>{{ owid.extreme_poverty }}</td> - <td>{{ owid.cardiovasc_death_rate }}</td> - <td>{{ owid.diabetes_prevalence }}</td> - <td>{{ owid.female_smokers }}</td> - <td>{{ owid.male_smokers }}</td> - <td>{{ owid.handwashing_facilities }}</td> - <td>{{ owid.hospital_beds_per_thousand }}</td> - <td>{{ owid.life_expectancy }}</td> - <td>{{ owid.human_development_index }}</td> - </tr> - {% endfor %} - </tbody> - </table> - diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_country_all.html b/src/covid19/blueprints/owid/templates/owid/country/owid_country_all.html new file mode 100644 index 0000000000000000000000000000000000000000..a345836eb40eb13fa8f1cd787146d1d3995a37b4 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/country/owid_country_all.html @@ -0,0 +1,29 @@ +{% extends 'application/page_layout.html' %} + +{% block content %} + {{super()}} + {% include 'owid/fragments/fragment_owid_navtabs.html' %} + + <div class="container"> + <div class="row"> + <div class="col"> + {% include 'owid/country/owid_country_all_pagination.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'owid/country/owid_country_all_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'owid/country/owid_country_all_pagination.html' %} + </div> + </div> + </div> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} diff --git a/src/covid19/blueprints/owid/templates/owid/continent/owid_continents_pagination.html b/src/covid19/blueprints/owid/templates/owid/country/owid_country_all_pagination.html similarity index 100% rename from src/covid19/blueprints/owid/templates/owid/continent/owid_continents_pagination.html rename to src/covid19/blueprints/owid/templates/owid/country/owid_country_all_pagination.html diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_country_all_table.html b/src/covid19/blueprints/owid/templates/owid/country/owid_country_all_table.html new file mode 100644 index 0000000000000000000000000000000000000000..764caf1c1a182293e0636e67839139d2debbe933 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/country/owid_country_all_table.html @@ -0,0 +1,130 @@ + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + <tr> + <th scope="col">iso_code</th> + <th scope="col">continent</th> + <th scope="col">location</th> + <th scope="col">date</th> + <th scope="col">total_cases</th> + <th scope="col">new_cases</th> + <th scope="col">new_cases_smoothed</th> + <th scope="col">total_deaths</th> + <th scope="col">new_deaths</th> + <th scope="col">new_deaths_smoothed</th> + <th scope="col">total_cases_per_million</th> + <th scope="col">new_cases_per_million</th> + <th scope="col">new_cases_smoothed_per_million</th> + <th scope="col">total_deaths_per_million</th> + <th scope="col">new_deaths_per_million</th> + <th scope="col">new_deaths_smoothed_per_million</th> + <th scope="col">reproduction_rate</th> + <th scope="col">icu_patients</th> + <th scope="col">icu_patients_per_million</th> + <th scope="col">hosp_patients</th> + <th scope="col">hosp_patients_per_million</th> + <th scope="col">weekly_icu_admissions</th> + <th scope="col">weekly_icu_admissions_per_million</th> + <th scope="col">weekly_hosp_admissions</th> + <th scope="col">weekly_hosp_admissions_per_million</th> + <th scope="col">new_tests</th> + <th scope="col">total_tests</th> + <th scope="col">total_tests_per_thousand</th> + <th scope="col">new_tests_per_thousand</th> + <th scope="col">new_tests_smoothed</th> + <th scope="col">new_tests_smoothed_per_thousand</th> + <th scope="col">positive_rate</th> + <th scope="col">tests_per_case</th> + <th scope="col">tests_units</th> + <th scope="col">total_vaccinations</th> + <th scope="col">people_vaccinated</th> + <th scope="col">people_fully_vaccinated</th> + <th scope="col">new_vaccinations</th> + <th scope="col">new_vaccinations_smoothed</th> + <th scope="col">total_vaccinations_per_hundred</th> + <th scope="col">people_vaccinated_per_hundred</th> + <th scope="col">people_fully_vaccinated_per_hundred</th> + <th scope="col">new_vaccinations_smoothed_per_million</th> + <th scope="col">stringency_index</th> + <th scope="col">population</th> + <th scope="col">population_density</th> + <th scope="col">median_age</th> + <th scope="col">aged_65_older</th> + <th scope="col">aged_70_older</th> + <th scope="col">gdp_per_capita</th> + <th scope="col">extreme_poverty</th> + <th scope="col">cardiovasc_death_rate</th> + <th scope="col">diabetes_prevalence</th> + <th scope="col">female_smokers</th> + <th scope="col">male_smokers</th> + <th scope="col">handwashing_facilities</th> + <th scope="col">hospital_beds_per_thousand</th> + <th scope="col">life_expectancy</th> + <th scope="col">human_development_index</th> + </tr> + </thead> + <tbody> + {% for owid in page_data.items %} + <tr> + <td>{{ owid.country.iso_code }}</td> + <td>{{ owid.country.continent.region }}</td> + <td>{{ owid.country.location }}</td> + <td>{{ owid.date_reported }}</td> + <td>{{ owid.total_cases }}</td> + <td>{{ owid.new_cases }}</td> + <td>{{ owid.new_cases_smoothed }}</td> + <td>{{ owid.total_deaths }}</td> + <td>{{ owid.new_deaths }}</td> + <td>{{ owid.new_deaths_smoothed }}</td> + <td>{{ owid.total_cases_per_million }}</td> + <td>{{ owid.new_cases_per_million }}</td> + <td>{{ owid.new_cases_smoothed_per_million }}</td> + <td>{{ owid.total_deaths_per_million }}</td> + <td>{{ owid.new_deaths_per_million }}</td> + <td>{{ owid.new_deaths_smoothed_per_million }}</td> + <td>{{ owid.reproduction_rate }}</td> + <td>{{ owid.icu_patients }}</td> + <td>{{ owid.icu_patients_per_million }}</td> + <td>{{ owid.hosp_patients }}</td> + <td>{{ owid.hosp_patients_per_million }}</td> + <td>{{ owid.weekly_icu_admissions }}</td> + <td>{{ owid.weekly_icu_admissions_per_million }}</td> + <td>{{ owid.weekly_hosp_admissions }}</td> + <td>{{ owid.weekly_hosp_admissions_per_million }}</td> + <td>{{ owid.new_tests }}</td> + <td>{{ owid.total_tests }}</td> + <td>{{ owid.total_tests_per_thousand }}</td> + <td>{{ owid.new_tests_per_thousand }}</td> + <td>{{ owid.new_tests_smoothed }}</td> + <td>{{ owid.new_tests_smoothed_per_thousand }}</td> + <td>{{ owid.positive_rate }}</td> + <td>{{ owid.tests_per_case }}</td> + <td>{{ owid.tests_units }}</td> + <td>{{ owid.total_vaccinations }}</td> + <td>{{ owid.people_vaccinated }}</td> + <td>{{ owid.people_fully_vaccinated }}</td> + <td>{{ owid.new_vaccinations }}</td> + <td>{{ owid.new_vaccinations_smoothed }}</td> + <td>{{ owid.total_vaccinations_per_hundred }}</td> + <td>{{ owid.people_vaccinated_per_hundred }}</td> + <td>{{ owid.people_fully_vaccinated_per_hundred }}</td> + <td>{{ owid.new_vaccinations_smoothed_per_million }}</td> + <td>{{ owid.stringency_index }}</td> + <td>{{ owid.country.population }}</td> + <td>{{ owid.country.population_density }}</td> + <td>{{ owid.country.median_age }}</td> + <td>{{ owid.country.aged_65_older }}</td> + <td>{{ owid.country.aged_70_older }}</td> + <td>{{ owid.country.gdp_per_capita }}</td> + <td>{{ owid.country.extreme_poverty }}</td> + <td>{{ owid.country.cardiovasc_death_rate }}</td> + <td>{{ owid.country.diabetes_prevalence }}</td> + <td>{{ owid.country.female_smokers }}</td> + <td>{{ owid.country.male_smokers }}</td> + <td>{{ owid.country.handwashing_facilities }}</td> + <td>{{ owid.country.hospital_beds_per_thousand }}</td> + <td>{{ owid.country.life_expectancy }}</td> + <td>{{ owid.country.human_development_index }}</td> + </tr> + {% endfor %} + </tbody> + </table> \ No newline at end of file diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_country_one.html b/src/covid19/blueprints/owid/templates/owid/country/owid_country_one.html new file mode 100644 index 0000000000000000000000000000000000000000..b74dee03696ef2d5bc7758726303ae74c2f88c42 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/country/owid_country_one.html @@ -0,0 +1,29 @@ +{% extends 'application/page_layout.html' %} + +{% block content %} + {{super()}} + {% include 'owid/fragments/fragment_owid_navtabs.html' %} + + <div class="container"> + <div class="row"> + <div class="col"> + {% include 'owid/country/owid_country_one_pagination.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'owid/country/owid_country_one_table.html' %} + </div> + </div> + <div class="row"> + <div class="col"> + {% include 'owid/country/owid_country_one_pagination.html' %} + </div> + </div> + </div> +{% endblock %} + + +{% block footer_container %} + +{% endblock %} diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_countries_pagination.html b/src/covid19/blueprints/owid/templates/owid/country/owid_country_one_pagination.html similarity index 100% rename from src/covid19/blueprints/owid/templates/owid/country/owid_countries_pagination.html rename to src/covid19/blueprints/owid/templates/owid/country/owid_country_one_pagination.html diff --git a/src/covid19/blueprints/owid/templates/owid/country/owid_country_one_table.html b/src/covid19/blueprints/owid/templates/owid/country/owid_country_one_table.html new file mode 100644 index 0000000000000000000000000000000000000000..764caf1c1a182293e0636e67839139d2debbe933 --- /dev/null +++ b/src/covid19/blueprints/owid/templates/owid/country/owid_country_one_table.html @@ -0,0 +1,130 @@ + <table class="table table-hover table-striped table-dark"> + <thead class="table-secondary"> + <tr> + <th scope="col">iso_code</th> + <th scope="col">continent</th> + <th scope="col">location</th> + <th scope="col">date</th> + <th scope="col">total_cases</th> + <th scope="col">new_cases</th> + <th scope="col">new_cases_smoothed</th> + <th scope="col">total_deaths</th> + <th scope="col">new_deaths</th> + <th scope="col">new_deaths_smoothed</th> + <th scope="col">total_cases_per_million</th> + <th scope="col">new_cases_per_million</th> + <th scope="col">new_cases_smoothed_per_million</th> + <th scope="col">total_deaths_per_million</th> + <th scope="col">new_deaths_per_million</th> + <th scope="col">new_deaths_smoothed_per_million</th> + <th scope="col">reproduction_rate</th> + <th scope="col">icu_patients</th> + <th scope="col">icu_patients_per_million</th> + <th scope="col">hosp_patients</th> + <th scope="col">hosp_patients_per_million</th> + <th scope="col">weekly_icu_admissions</th> + <th scope="col">weekly_icu_admissions_per_million</th> + <th scope="col">weekly_hosp_admissions</th> + <th scope="col">weekly_hosp_admissions_per_million</th> + <th scope="col">new_tests</th> + <th scope="col">total_tests</th> + <th scope="col">total_tests_per_thousand</th> + <th scope="col">new_tests_per_thousand</th> + <th scope="col">new_tests_smoothed</th> + <th scope="col">new_tests_smoothed_per_thousand</th> + <th scope="col">positive_rate</th> + <th scope="col">tests_per_case</th> + <th scope="col">tests_units</th> + <th scope="col">total_vaccinations</th> + <th scope="col">people_vaccinated</th> + <th scope="col">people_fully_vaccinated</th> + <th scope="col">new_vaccinations</th> + <th scope="col">new_vaccinations_smoothed</th> + <th scope="col">total_vaccinations_per_hundred</th> + <th scope="col">people_vaccinated_per_hundred</th> + <th scope="col">people_fully_vaccinated_per_hundred</th> + <th scope="col">new_vaccinations_smoothed_per_million</th> + <th scope="col">stringency_index</th> + <th scope="col">population</th> + <th scope="col">population_density</th> + <th scope="col">median_age</th> + <th scope="col">aged_65_older</th> + <th scope="col">aged_70_older</th> + <th scope="col">gdp_per_capita</th> + <th scope="col">extreme_poverty</th> + <th scope="col">cardiovasc_death_rate</th> + <th scope="col">diabetes_prevalence</th> + <th scope="col">female_smokers</th> + <th scope="col">male_smokers</th> + <th scope="col">handwashing_facilities</th> + <th scope="col">hospital_beds_per_thousand</th> + <th scope="col">life_expectancy</th> + <th scope="col">human_development_index</th> + </tr> + </thead> + <tbody> + {% for owid in page_data.items %} + <tr> + <td>{{ owid.country.iso_code }}</td> + <td>{{ owid.country.continent.region }}</td> + <td>{{ owid.country.location }}</td> + <td>{{ owid.date_reported }}</td> + <td>{{ owid.total_cases }}</td> + <td>{{ owid.new_cases }}</td> + <td>{{ owid.new_cases_smoothed }}</td> + <td>{{ owid.total_deaths }}</td> + <td>{{ owid.new_deaths }}</td> + <td>{{ owid.new_deaths_smoothed }}</td> + <td>{{ owid.total_cases_per_million }}</td> + <td>{{ owid.new_cases_per_million }}</td> + <td>{{ owid.new_cases_smoothed_per_million }}</td> + <td>{{ owid.total_deaths_per_million }}</td> + <td>{{ owid.new_deaths_per_million }}</td> + <td>{{ owid.new_deaths_smoothed_per_million }}</td> + <td>{{ owid.reproduction_rate }}</td> + <td>{{ owid.icu_patients }}</td> + <td>{{ owid.icu_patients_per_million }}</td> + <td>{{ owid.hosp_patients }}</td> + <td>{{ owid.hosp_patients_per_million }}</td> + <td>{{ owid.weekly_icu_admissions }}</td> + <td>{{ owid.weekly_icu_admissions_per_million }}</td> + <td>{{ owid.weekly_hosp_admissions }}</td> + <td>{{ owid.weekly_hosp_admissions_per_million }}</td> + <td>{{ owid.new_tests }}</td> + <td>{{ owid.total_tests }}</td> + <td>{{ owid.total_tests_per_thousand }}</td> + <td>{{ owid.new_tests_per_thousand }}</td> + <td>{{ owid.new_tests_smoothed }}</td> + <td>{{ owid.new_tests_smoothed_per_thousand }}</td> + <td>{{ owid.positive_rate }}</td> + <td>{{ owid.tests_per_case }}</td> + <td>{{ owid.tests_units }}</td> + <td>{{ owid.total_vaccinations }}</td> + <td>{{ owid.people_vaccinated }}</td> + <td>{{ owid.people_fully_vaccinated }}</td> + <td>{{ owid.new_vaccinations }}</td> + <td>{{ owid.new_vaccinations_smoothed }}</td> + <td>{{ owid.total_vaccinations_per_hundred }}</td> + <td>{{ owid.people_vaccinated_per_hundred }}</td> + <td>{{ owid.people_fully_vaccinated_per_hundred }}</td> + <td>{{ owid.new_vaccinations_smoothed_per_million }}</td> + <td>{{ owid.stringency_index }}</td> + <td>{{ owid.country.population }}</td> + <td>{{ owid.country.population_density }}</td> + <td>{{ owid.country.median_age }}</td> + <td>{{ owid.country.aged_65_older }}</td> + <td>{{ owid.country.aged_70_older }}</td> + <td>{{ owid.country.gdp_per_capita }}</td> + <td>{{ owid.country.extreme_poverty }}</td> + <td>{{ owid.country.cardiovasc_death_rate }}</td> + <td>{{ owid.country.diabetes_prevalence }}</td> + <td>{{ owid.country.female_smokers }}</td> + <td>{{ owid.country.male_smokers }}</td> + <td>{{ owid.country.handwashing_facilities }}</td> + <td>{{ owid.country.hospital_beds_per_thousand }}</td> + <td>{{ owid.country.life_expectancy }}</td> + <td>{{ owid.country.human_development_index }}</td> + </tr> + {% endfor %} + </tbody> + </table> \ No newline at end of file