diff --git a/databank/admin.py b/databank/admin.py index 4b6f23132..c3c2dc340 100644 --- a/databank/admin.py +++ b/databank/admin.py @@ -77,20 +77,40 @@ class CountryOverviewAdmin(admin.ModelAdmin): _("COUNTRY KEY INDICATORS (SOURCE: FDRS)"), { "fields": ( - "population", - "urban_population", - "gdp", - "gnipc", - "poverty", - "life_expectancy", - "literacy", + "fdrs_population", + "fdrs_population_data_year", + "fdrs_urban_population", + "fdrs_urban_population_data_year", + "fdrs_gdp", + "fdrs_gdp_data_year", + "fdrs_gnipc", + "fdrs_gnipc_data_year", + "fdrs_poverty", + "fdrs_poverty_data_year", + "fdrs_life_expectancy", + "fdrs_life_expectancy_data_year", + "fdrs_literacy", + "fdrs_literacy_data_year", ) }, ), ( _("NATIONAL SOCIETY INDICATORS (SOURCE: FDRS)"), { - "fields": ("income", "expenditures", "volunteers", "trained_in_first_aid", "branches"), + "fields": ( + "fdrs_income", + "fdrs_income_data_year", + "fdrs_expenditures", + "fdrs_expenditures_data_year", + "fdrs_volunteer_total", + "fdrs_volunteer_data_year", + "fdrs_staff_total", + "fdrs_staff_data_year", + "fdrs_trained_in_first_aid", + "fdrs_trained_in_first_aid_data_year", + "fdrs_branches", + "fdrs_branches_data_year", + ), }, ), (_("KEY CLIMATE EVENT"), {"fields": ("avg_temperature", "avg_rainfall_precipitation", "rainy_season")}), @@ -99,27 +119,27 @@ class CountryOverviewAdmin(admin.ModelAdmin): { "fields": ( "world_bank_population", - "calculated_world_bank_population_year", + "world_bank_population_year", "world_bank_population_above_age_65", - "calculated_world_bank_population_above_age_65_year", + "world_bank_population_above_age_65_year", "world_bank_population_age_14", - "calculated_world_bank_population_age_14_year", + "world_bank_population_age_14_year", "world_bank_urban_population_percentage", - "calculated_world_bank_urban_population_percentage_year", + "world_bank_urban_population_percentage_year", "world_bank_gdp", - "calculated_world_bank_gdp_year", + "world_bank_gdp_year", "world_bank_gni", - "calculated_world_bank_gni_year", + "world_bank_gni_year", "world_bank_gender_equality_index", - "calculated_world_bank_gender_equality_index_year", + "world_bank_gender_equality_index_year", "world_bank_life_expectancy", - "calculated_world_bank_life_expectancy_year", + "world_bank_life_expectancy_year", "world_bank_literacy_rate", - "calculated_world_bank_literacy_rate_year", + "world_bank_literacy_rate_year", "world_bank_poverty_rate", - "calculated_world_bank_poverty_rate_year", + "world_bank_poverty_rate_year", "world_bank_gni_capita", - "calculated_world_bank_gni_capita_year", + "world_bank_gni_capita_year", ) }, ), diff --git a/databank/management/commands/ingest_worldbank.py b/databank/management/commands/ingest_worldbank.py index beed26010..06b969ad8 100644 --- a/databank/management/commands/ingest_worldbank.py +++ b/databank/management/commands/ingest_worldbank.py @@ -25,47 +25,47 @@ class CountryIndicatorData(typing.TypedDict): WORLD_BANK_INDICATOR_MAP = { "SP.POP.TOTL": ( CountryOverview.world_bank_population, - CountryOverview.calculated_world_bank_population_year, + CountryOverview.world_bank_population_year, ), "SP.POP.65UP.TO": ( CountryOverview.world_bank_population_above_age_65, - CountryOverview.calculated_world_bank_population_above_age_65_year, + CountryOverview.world_bank_population_above_age_65_year, ), "SP.POP.0014.TO": ( CountryOverview.world_bank_population_age_14, - CountryOverview.calculated_world_bank_population_age_14_year, + CountryOverview.world_bank_population_age_14_year, ), "SP.URB.TOTL.IN.ZS": ( CountryOverview.world_bank_urban_population_percentage, - CountryOverview.calculated_world_bank_urban_population_percentage_year, + CountryOverview.world_bank_urban_population_percentage_year, ), "NY.GDP.MKTP.CD": ( CountryOverview.world_bank_gdp, - CountryOverview.calculated_world_bank_gdp_year, + CountryOverview.world_bank_gdp_year, ), "NY.GNP.MKTP.CD": ( CountryOverview.world_bank_gni, - CountryOverview.calculated_world_bank_gni_year, + CountryOverview.world_bank_gni_year, ), "IQ.CPA.GNDR.XQ": ( CountryOverview.world_bank_gender_equality_index, - CountryOverview.calculated_world_bank_gender_equality_index_year, + CountryOverview.world_bank_gender_equality_index_year, ), "SP.DYN.LE00.IN": ( CountryOverview.world_bank_life_expectancy, - CountryOverview.calculated_world_bank_life_expectancy_year, + CountryOverview.world_bank_life_expectancy_year, ), "SE.ADT.LITR.ZS": ( CountryOverview.world_bank_literacy_rate, - CountryOverview.calculated_world_bank_literacy_rate_year, + CountryOverview.world_bank_literacy_rate_year, ), "SI.POV.NAHC": ( CountryOverview.world_bank_poverty_rate, - CountryOverview.calculated_world_bank_poverty_rate_year, + CountryOverview.world_bank_poverty_rate_year, ), "NY.GNP.PCAP.CD": ( CountryOverview.world_bank_gni_capita, - CountryOverview.calculated_world_bank_gni_capita_year, + CountryOverview.world_bank_gni_capita_year, ), } diff --git a/databank/management/commands/sources/FDRS.py b/databank/management/commands/sources/FDRS.py index 9e7512603..fb6bad3bf 100644 --- a/databank/management/commands/sources/FDRS.py +++ b/databank/management/commands/sources/FDRS.py @@ -1,4 +1,5 @@ import logging +from typing import List, Optional, Tuple import requests from django.conf import settings @@ -10,76 +11,86 @@ logger = logging.getLogger(__name__) -FDRS_INDICATORS_FIELD_MAP = ( +FDRS_INDICATORS_FIELD_MAP = { # INFORM API Indicator, Databank Field # Country Key Indicators - ("Population", CO.population), - ("UrbPop", CO.urban_population), - ("GDP", CO.gdp), - ("GNIPC", CO.gnipc), - ("Poverty", CO.poverty), - ("LifeExp", CO.life_expectancy), - ("Literacy", CO.literacy), + "Population": (CO.fdrs_population, CO.fdrs_population_data_year), + "UrbPop": (CO.fdrs_urban_population, CO.fdrs_urban_population_data_year), + "GDP": (CO.fdrs_gdp, CO.fdrs_gdp_data_year), + "GNIPC": (CO.fdrs_gnipc, CO.fdrs_gnipc_data_year), + "Poverty": (CO.fdrs_poverty, CO.fdrs_poverty_data_year), + "LifeExp": (CO.fdrs_life_expectancy, CO.fdrs_life_expectancy_data_year), + "Literacy": (CO.fdrs_literacy, CO.fdrs_literacy_data_year), # National Society Indicators (Using Script: FDRS API) - ("KPI_IncomeLC_CHF", CO.income), - ("KPI_expenditureLC_CHF", CO.expenditures), - ("KPI_PeopleVol_Tot", CO.volunteers), - ("KPI_TrainFA_Tot", CO.trained_in_first_aid), - ("KPI_noLocalUnits", CO.branches), + "KPI_IncomeLC_CHF": (CO.fdrs_income, CO.fdrs_income_data_year), + "KPI_expenditureLC_CHF": (CO.fdrs_expenditures, CO.fdrs_expenditures_data_year), + "KPI_TrainFA_Tot": (CO.fdrs_trained_in_first_aid, CO.fdrs_trained_in_first_aid_data_year), + "KPI_noBranches": (CO.fdrs_branches, CO.fdrs_branches_data_year), +} + +FDRS_VOLUNTEERS_DISAGGREGATION_INDICATORS_FIELD_MAP = ( # volunteers - ("KPI_PeopleVol_M_age_13_17", CO.male_volunteer_age_13_17), - ("KPI_PeopleVol_M_age_18_29", CO.male_volunteer_age_18_29), - ("KPI_PeopleVol_M_age_18_49", CO.male_volunteer_age_18_49), - ("KPI_PeopleVol_M_age_30_39", CO.male_volunteer_age_30_39), - ("KPI_PeopleVol_M_age_40_49", CO.male_volunteer_age_40_49), - ("KPI_PeopleVol_M_age_50_59", CO.male_volunteer_age_50_59), - ("KPI_PeopleVol_M_age_6_12", CO.male_volunteer_age_6_12), - ("KPI_PeopleVol_M_age_60_69", CO.male_volunteer_age_60_69), - ("KPI_PeopleVol_M_age_70_79", CO.male_volunteer_age_70_79), - ("KPI_PeopleVol_M_age_80", CO.male_volunteer_age_80), - ("KPI_PeopleVol_M_age_Other", CO.male_volunteer_age_other), - ("KPI_PeopleVol_Tot_M", CO.male_volunteer_total), - ("KPI_PeopleVol_F_age_13_17", CO.female_volunteer_age_13_17), - ("KPI_PeopleVol_F_age_18_29", CO.female_volunteer_age_18_29), - ("KPI_PeopleVol_F_age_18_49", CO.female_volunteer_age_18_49), - ("KPI_PeopleVol_F_age_30_39", CO.female_volunteer_age_30_39), - ("KPI_PeopleVol_F_age_40_49", CO.female_volunteer_age_40_49), - ("KPI_PeopleVol_F_age_50_59", CO.female_volunteer_age_50_59), - ("KPI_PeopleVol_F_age_6_12", CO.female_volunteer_age_6_12), - ("KPI_PeopleVol_F_age_60_69", CO.female_volunteer_age_60_69), - ("KPI_PeopleVol_F_age_70_79", CO.female_volunteer_age_70_79), - ("KPI_PeopleVol_F_age_80", CO.female_volunteer_age_80), - ("KPI_PeopleVol_F_age_Other", CO.female_volunteer_age_other), - ("KPI_PeopleVol_Tot_F", CO.female_volunteer_total), - ("KPI_PeopleVol_Tot", CO.volunteer_total), - ("KPI_PeopleVol_Tot_age_6_12", CO.volunteer_age_6_12), - ("KPI_PeopleVol_Tot_age_13_17", CO.volunteer_age_13_17), - ("KPI_PeopleVol_Tot_age_18_29", CO.volunteer_age_18_29), + ("KPI_PeopleVol_M_age_13_17", CO.fdrs_male_volunteer_age_13_17), + ("KPI_PeopleVol_M_age_18_29", CO.fdrs_male_volunteer_age_18_29), + ("KPI_PeopleVol_M_age_18_49", CO.fdrs_male_volunteer_age_18_49), + ("KPI_PeopleVol_M_age_30_39", CO.fdrs_male_volunteer_age_30_39), + ("KPI_PeopleVol_M_age_40_49", CO.fdrs_male_volunteer_age_40_49), + ("KPI_PeopleVol_M_age_50_59", CO.fdrs_male_volunteer_age_50_59), + ("KPI_PeopleVol_M_age_6_12", CO.fdrs_male_volunteer_age_6_12), + ("KPI_PeopleVol_M_age_60_69", CO.fdrs_male_volunteer_age_60_69), + ("KPI_PeopleVol_M_age_70_79", CO.fdrs_male_volunteer_age_70_79), + ("KPI_PeopleVol_M_age_80", CO.fdrs_male_volunteer_age_80), + ("KPI_PeopleVol_M_age_Other", CO.fdrs_male_volunteer_age_other), + ("KPI_PeopleVol_Tot_M", CO.fdrs_male_volunteer_total), + ("KPI_PeopleVol_F_age_13_17", CO.fdrs_female_volunteer_age_13_17), + ("KPI_PeopleVol_F_age_18_29", CO.fdrs_female_volunteer_age_18_29), + ("KPI_PeopleVol_F_age_18_49", CO.fdrs_female_volunteer_age_18_49), + ("KPI_PeopleVol_F_age_30_39", CO.fdrs_female_volunteer_age_30_39), + ("KPI_PeopleVol_F_age_40_49", CO.fdrs_female_volunteer_age_40_49), + ("KPI_PeopleVol_F_age_50_59", CO.fdrs_female_volunteer_age_50_59), + ("KPI_PeopleVol_F_age_6_12", CO.fdrs_female_volunteer_age_6_12), + ("KPI_PeopleVol_F_age_60_69", CO.fdrs_female_volunteer_age_60_69), + ("KPI_PeopleVol_F_age_70_79", CO.fdrs_female_volunteer_age_70_79), + ("KPI_PeopleVol_F_age_80", CO.fdrs_female_volunteer_age_80), + ("KPI_PeopleVol_F_age_Other", CO.fdrs_female_volunteer_age_other), + ("KPI_PeopleVol_Tot_F", CO.fdrs_female_volunteer_total), + ("KPI_PeopleVol_Tot", CO.fdrs_volunteer_total), + ("KPI_PeopleVol_Tot_age_6_12", CO.fdrs_volunteer_age_6_12), + ("KPI_PeopleVol_Tot_age_13_17", CO.fdrs_volunteer_age_13_17), + ("KPI_PeopleVol_Tot_age_18_29", CO.fdrs_volunteer_age_18_29), +) + +FDRS_STAFF_DISAGGREGATION_INDICATORS_FIELD_MAP = ( # Staff - ("KPI_PStaff_M_age_18_29", CO.male_staff_age_18_29), - ("KPI_PStaff_M_age_18_49", CO.male_staff_age_18_49), - ("KPI_PStaff_M_age_30_39", CO.male_staff_age_30_39), - ("KPI_PStaff_M_age_40_49", CO.male_staff_age_40_49), - ("KPI_PStaff_M_age_50_59", CO.male_staff_age_50_59), - ("KPI_PStaff_M_age_60_69", CO.male_staff_age_60_69), - ("KPI_PStaff_M_age_70_79", CO.male_staff_age_70_79), - ("KPI_PStaff_M_age_80", CO.male_staff_age_80), - ("KPI_PStaff_M_age_Other", CO.male_staff_age_other), - ("KPI_PStaff_Tot_M", CO.male_staff_total), - ("KPI_PStaff_F_age_18_29", CO.female_staff_age_18_29), - ("KPI_PStaff_F_age_18_49", CO.female_staff_age_18_49), - ("KPI_PStaff_F_age_30_39", CO.female_staff_age_30_39), - ("KPI_PStaff_F_age_40_49", CO.female_staff_age_40_49), - ("KPI_PStaff_F_age_50_59", CO.female_staff_age_50_59), - ("KPI_PStaff_F_age_60_69", CO.female_staff_age_60_69), - ("KPI_PStaff_F_age_70_79", CO.female_staff_age_70_79), - ("KPI_PStaff_F_age_80", CO.female_staff_age_80), - ("KPI_PStaff_F_age_Other", CO.female_staff_age_other), - ("KPI_PStaff_Tot_F", CO.female_staff_total), - ("KPI_PStaff_Tot", CO.staff_total), - ("KPI_PStaff_Tot_age_18_29", CO.staff_age_18_29), + ("KPI_PStaff_M_age_18_29", CO.fdrs_male_staff_age_18_29), + ("KPI_PStaff_M_age_18_49", CO.fdrs_male_staff_age_18_49), + ("KPI_PStaff_M_age_30_39", CO.fdrs_male_staff_age_30_39), + ("KPI_PStaff_M_age_40_49", CO.fdrs_male_staff_age_40_49), + ("KPI_PStaff_M_age_50_59", CO.fdrs_male_staff_age_50_59), + ("KPI_PStaff_M_age_60_69", CO.fdrs_male_staff_age_60_69), + ("KPI_PStaff_M_age_70_79", CO.fdrs_male_staff_age_70_79), + ("KPI_PStaff_M_age_80", CO.fdrs_male_staff_age_80), + ("KPI_PStaff_M_age_Other", CO.fdrs_male_staff_age_other), + ("KPI_PStaff_Tot_M", CO.fdrs_male_staff_total), + ("KPI_PStaff_F_age_18_29", CO.fdrs_female_staff_age_18_29), + ("KPI_PStaff_F_age_18_49", CO.fdrs_female_staff_age_18_49), + ("KPI_PStaff_F_age_30_39", CO.fdrs_female_staff_age_30_39), + ("KPI_PStaff_F_age_40_49", CO.fdrs_female_staff_age_40_49), + ("KPI_PStaff_F_age_50_59", CO.fdrs_female_staff_age_50_59), + ("KPI_PStaff_F_age_60_69", CO.fdrs_female_staff_age_60_69), + ("KPI_PStaff_F_age_70_79", CO.fdrs_female_staff_age_70_79), + ("KPI_PStaff_F_age_80", CO.fdrs_female_staff_age_80), + ("KPI_PStaff_F_age_Other", CO.fdrs_female_staff_age_other), + ("KPI_PStaff_Tot_F", CO.fdrs_female_staff_total), + ("KPI_PStaff_Tot", CO.fdrs_staff_total), + ("KPI_PStaff_Tot_age_18_29", CO.fdrs_staff_age_18_29), ) -FDRS_INDICATORS = [indicator for indicator, _ in FDRS_INDICATORS_FIELD_MAP] +FDRS_INDICATORS = ( + list(FDRS_INDICATORS_FIELD_MAP.keys()) + + [indicator for indicator, _ in FDRS_VOLUNTEERS_DISAGGREGATION_INDICATORS_FIELD_MAP] + + [indicator for indicator, _ in FDRS_STAFF_DISAGGREGATION_INDICATORS_FIELD_MAP] +) + # To fetch NS ID FDRS_NS_API_ENDPOINT = f"https://data-api.ifrc.org/api/entities/ns?apiKey={settings.FDRS_APIKEY}" @@ -90,49 +101,117 @@ ) -@catch_error("Error occured while fetching from FDRS API.") +@catch_error("Error occurred while fetching from FDRS API.") def prefetch(): - fdrs_entities = requests.get(FDRS_NS_API_ENDPOINT) - if fdrs_entities.status_code != 200: - return - fdrs_entities.raise_for_status() - fdrs_entities = fdrs_entities.json() - - ns_iso_map = { - # ISO3 are missing for some in FDRS & IFRC-GO only have ISO2 for countries - ns["KPI_DON_code"]: ns["iso_2"] - for ns in fdrs_entities - } - - return ( - { - # KEY -: {year: '', value: ''} - f"{ns_iso_map[ns_data['id']].upper()}-{indicator_data['id']}": ( - ns_data["data"][-1] if (ns_data["data"] and len(ns_data["data"]) > 0) else None - ) - for indicator_data in requests.get(FDRS_DATA_API_ENDPOINT).json()["data"] - for ns_data in indicator_data["data"] - }, - len(ns_iso_map), - FDRS_DATA_API_ENDPOINT, + response = requests.get(FDRS_NS_API_ENDPOINT) + response.raise_for_status() + fdrs_entities = response.json() + + ns_iso_map = {ns["KPI_DON_code"]: ns["iso_2"] for ns in fdrs_entities} + + fdrs_data_response = requests.get(FDRS_DATA_API_ENDPOINT) + fdrs_data_response.raise_for_status() + fdrs_data = fdrs_data_response.json()["data"] + + # Getting the latest available data for the indicators + processed_fdrs_data = {} + + for indictor_data in fdrs_data: + indicator_id = indictor_data["id"] + + for ns_data in indictor_data["data"]: + ns_id = ns_data["id"] + iso_code = ns_iso_map.get(ns_id) + + if not iso_code: + continue + + latest_data_with_value = None + for data in ns_data["data"]: + if data.get("value"): + if latest_data_with_value is None or int(data["year"]) > int(latest_data_with_value["year"]): + latest_data_with_value = data + + if latest_data_with_value: + processed_fdrs_data[f"{iso_code}-{indicator_id}"] = latest_data_with_value + + return (processed_fdrs_data, len(ns_iso_map), FDRS_DATA_API_ENDPOINT) + + +def set_latest_year_data( + disaggregation_map: List[Tuple[str, CO]], + data_year_field: CO, + latest_year: int, + fdrs_data: dict, + country_iso: str, + overview: CO, +) -> None: + """ + Set only the latest year data for volunteers or staff for the provided year + """ + for indicator, field in disaggregation_map: + data = fdrs_data.get(f"{country_iso}-{indicator}") + if data and int(data.get("year")) == latest_year: + setattr(overview, field.field.name, data.get("value")) + + # Set the year field for the data + setattr(overview, data_year_field.field.name, latest_year) + + +def get_latest_year_from_indicators(disaggregation_map: List[Tuple[str, CO]], fdrs_data: dict, country_iso: str) -> Optional[int]: + """ + Get the latest year across all indicators where the value field exists + """ + return max( + ( + int(data["year"]) + for indicator, _ in disaggregation_map + if (data := fdrs_data.get(f"{country_iso}-{indicator}")) and data.get("value") + ), + default=None, ) -@catch_error() +@catch_error("Error occurred while loading FDRS data.") def load(country, overview, fdrs_data): - if country.iso is None or fdrs_data is None: + if not country.iso or not fdrs_data: return - fdrs_data_fetched_year = max( - int(item["year"]) for item in fdrs_data.values() if item is not None and item.get("year") is not None + country_iso = country.iso.upper() + + # Country Key Indicators + for indicator, (field, year_field) in FDRS_INDICATORS_FIELD_MAP.items(): + data = fdrs_data.get(f"{country_iso}-{indicator}") + if data: + setattr(overview, field.field.name, data.get("value")) + setattr(overview, year_field.field.name, data.get("year")) + + # Volunteer disaggregation data + latest_year = get_latest_year_from_indicators( + disaggregation_map=FDRS_VOLUNTEERS_DISAGGREGATION_INDICATORS_FIELD_MAP, fdrs_data=fdrs_data, country_iso=country_iso ) + if latest_year: + set_latest_year_data( + disaggregation_map=FDRS_VOLUNTEERS_DISAGGREGATION_INDICATORS_FIELD_MAP, + data_year_field=CO.fdrs_volunteer_data_year, + latest_year=latest_year, + fdrs_data=fdrs_data, + country_iso=country_iso, + overview=overview, + ) - for fdrs_indicator, field in FDRS_INDICATORS_FIELD_MAP: - value = fdrs_data.get(f"{country.iso.upper()}-{fdrs_indicator}") - setattr( - overview, - field.field.name, - value and value.get("value"), + # Staff disaggregation data + latest_year = get_latest_year_from_indicators( + disaggregation_map=FDRS_STAFF_DISAGGREGATION_INDICATORS_FIELD_MAP, fdrs_data=fdrs_data, country_iso=country_iso + ) + if latest_year: + set_latest_year_data( + disaggregation_map=FDRS_STAFF_DISAGGREGATION_INDICATORS_FIELD_MAP, + data_year_field=CO.fdrs_staff_data_year, + latest_year=latest_year, + fdrs_data=fdrs_data, + country_iso=country_iso, + overview=overview, ) - overview.fdrs_data_fetched_year = str(fdrs_data_fetched_year) + overview.save() diff --git a/databank/migrations/0027_remove_countryoverview_branches_and_more.py b/databank/migrations/0027_remove_countryoverview_branches_and_more.py new file mode 100644 index 000000000..46cff92b4 --- /dev/null +++ b/databank/migrations/0027_remove_countryoverview_branches_and_more.py @@ -0,0 +1,750 @@ +# Generated by Django 4.2.16 on 2024-10-23 07:51 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("databank", "0026_countryoverview_calculated_world_bank_gdp_year_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="countryoverview", + name="branches", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_gdp_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_gender_equality_index_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_gni_capita_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_gni_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_life_expectancy_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_literacy_rate_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_population_above_age_65_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_population_age_14_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_population_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_poverty_rate_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="calculated_world_bank_urban_population_percentage_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="expenditures", + ), + migrations.RemoveField( + model_name="countryoverview", + name="fdrs_data_fetched_year", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_18_29", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_18_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_30_39", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_40_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_50_59", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_60_69", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_70_79", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_80", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_age_other", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_staff_total", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_13_17", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_18_29", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_18_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_30_39", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_40_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_50_59", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_60_69", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_6_12", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_70_79", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_80", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_age_other", + ), + migrations.RemoveField( + model_name="countryoverview", + name="female_volunteer_total", + ), + migrations.RemoveField( + model_name="countryoverview", + name="gdp", + ), + migrations.RemoveField( + model_name="countryoverview", + name="gnipc", + ), + migrations.RemoveField( + model_name="countryoverview", + name="income", + ), + migrations.RemoveField( + model_name="countryoverview", + name="life_expectancy", + ), + migrations.RemoveField( + model_name="countryoverview", + name="literacy", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_18_29", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_18_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_30_39", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_40_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_50_59", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_60_69", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_70_79", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_80", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_age_other", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_staff_total", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_13_17", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_18_29", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_18_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_30_39", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_40_49", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_50_59", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_60_69", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_6_12", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_70_79", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_80", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_age_other", + ), + migrations.RemoveField( + model_name="countryoverview", + name="male_volunteer_total", + ), + migrations.RemoveField( + model_name="countryoverview", + name="population", + ), + migrations.RemoveField( + model_name="countryoverview", + name="poverty", + ), + migrations.RemoveField( + model_name="countryoverview", + name="staff_age_18_29", + ), + migrations.RemoveField( + model_name="countryoverview", + name="staff_total", + ), + migrations.RemoveField( + model_name="countryoverview", + name="trained_in_first_aid", + ), + migrations.RemoveField( + model_name="countryoverview", + name="urban_population", + ), + migrations.RemoveField( + model_name="countryoverview", + name="volunteer_age_13_17", + ), + migrations.RemoveField( + model_name="countryoverview", + name="volunteer_age_18_29", + ), + migrations.RemoveField( + model_name="countryoverview", + name="volunteer_age_6_12", + ), + migrations.RemoveField( + model_name="countryoverview", + name="volunteer_total", + ), + migrations.RemoveField( + model_name="countryoverview", + name="volunteers", + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_branches", + field=models.IntegerField(blank=True, null=True, verbose_name="Branches"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_branches_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="branches data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_expenditures", + field=models.FloatField(blank=True, null=True, verbose_name="expenditures (CHF)"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_expenditures_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="expenditures data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_18_29", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 18 to 29"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_18_49", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 18 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_30_39", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 30 to 39"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_40_49", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 40 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_50_59", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 50 to 59"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_60_69", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 60 to 69"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_70_79", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 70 to 79"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_80", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff age 80"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_age_other", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff other"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_staff_total", + field=models.IntegerField(blank=True, null=True, verbose_name="female staff total"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_13_17", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 13 to 17"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_18_29", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 18 to 29"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_18_49", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 18 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_30_39", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 30 to 39"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_40_49", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 40 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_50_59", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 50 to 59"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_60_69", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 60 to 69"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_6_12", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 6 to 12"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_70_79", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 70 to 79"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_80", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer age 80"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_age_other", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer other"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_female_volunteer_total", + field=models.IntegerField(blank=True, null=True, verbose_name="female volunteer total"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_gdp", + field=models.FloatField(blank=True, null=True, verbose_name="GDP"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_gdp_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="GDP data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_gnipc", + field=models.IntegerField(blank=True, null=True, verbose_name="GNI/CAPITA"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_gnipc_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="GNI/CAPITA data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_income", + field=models.FloatField(blank=True, null=True, verbose_name="income (CHF)"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_income_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="income data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_life_expectancy", + field=models.IntegerField(blank=True, null=True, verbose_name="life expectancy"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_life_expectancy_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="life expectancy data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_literacy", + field=models.FloatField( + blank=True, + null=True, + validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(0)], + verbose_name="literacy (%)", + ), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_literacy_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="literacy data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_18_29", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 18 to 29"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_18_49", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 18 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_30_39", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 30 to 39"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_40_49", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 40 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_50_59", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 50 to 59"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_60_69", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 60 to 69"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_70_79", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 70 to 79"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_80", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff age 80"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_age_other", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff other"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_staff_total", + field=models.IntegerField(blank=True, null=True, verbose_name="male staff total"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_13_17", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 13 to 17"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_18_29", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 18 to 29"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_18_49", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 18 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_30_39", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 30 to 39"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_40_49", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 40 to 49"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_50_59", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 50 to 59"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_60_69", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 60 to 69"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_6_12", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 6 to 12"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_70_79", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 70 to 79"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_80", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer age 80"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_age_other", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer other"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_male_volunteer_total", + field=models.IntegerField(blank=True, null=True, verbose_name="male volunteer total"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_population", + field=models.IntegerField(blank=True, null=True, verbose_name="population"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_population_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="population data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_poverty", + field=models.FloatField( + blank=True, + null=True, + validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(0)], + verbose_name="poverty (%)", + ), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_poverty_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="poverty data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_staff_age_18_29", + field=models.IntegerField(blank=True, null=True, verbose_name="staff age 18 to 29"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_staff_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="staff data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_staff_total", + field=models.IntegerField(blank=True, null=True, verbose_name="staff total"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_trained_in_first_aid", + field=models.IntegerField(blank=True, null=True, verbose_name="trained in first aid"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_trained_in_first_aid_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="trained in first aid data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_urban_population", + field=models.FloatField( + blank=True, + null=True, + validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(0)], + verbose_name="urban POP (%)", + ), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_urban_population_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="urban population data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_volunteer_age_13_17", + field=models.IntegerField(blank=True, null=True, verbose_name="volunteer age 13 to 17"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_volunteer_age_18_29", + field=models.IntegerField(blank=True, null=True, verbose_name="volunteer age 18 to 29"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_volunteer_age_6_12", + field=models.IntegerField(blank=True, null=True, verbose_name="volunteer age 6 to 12"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_volunteer_data_year", + field=models.IntegerField(blank=True, null=True, verbose_name="volunteer data fetched year"), + ), + migrations.AddField( + model_name="countryoverview", + name="fdrs_volunteer_total", + field=models.IntegerField(blank=True, null=True, verbose_name="volunteer total"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_gdp_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank gdp year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_gender_equality_index_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank gender equality index year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_gni_capita_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank gni capita year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_gni_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank gni year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_life_expectancy_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank life expectancy year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_literacy_rate_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank literacy rate year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_population_above_age_65_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank population above age 65 date in year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_population_age_14_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank population age 14 date in year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_population_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank population year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_poverty_rate_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank poverty rate year"), + ), + migrations.AddField( + model_name="countryoverview", + name="world_bank_urban_population_percentage_year", + field=models.IntegerField(blank=True, null=True, verbose_name="world bank urban population percentage year"), + ), + ] diff --git a/databank/models.py b/databank/models.py index 31bfd6ba1..66567d71c 100644 --- a/databank/models.py +++ b/databank/models.py @@ -174,90 +174,114 @@ class CountryOverview(models.Model): script_modified_at = models.DateTimeField(null=True, blank=True) # Country Key Indicators (Using Script: FDRS API) - population = models.IntegerField(null=True, blank=True, verbose_name=_("population")) - gdp = models.FloatField(verbose_name=_("GDP"), null=True, blank=True) - gnipc = models.IntegerField(verbose_name=_("GNI/CAPITA"), null=True, blank=True) - life_expectancy = models.IntegerField(null=True, blank=True, verbose_name=_("life expectancy")) - urban_population = models.FloatField( + fdrs_population = models.IntegerField(null=True, blank=True, verbose_name=_("population")) + fdrs_population_data_year = models.IntegerField(verbose_name=_("population data fetched year"), null=True, blank=True) + fdrs_gdp = models.FloatField(verbose_name=_("GDP"), null=True, blank=True) + fdrs_gdp_data_year = models.IntegerField(verbose_name=_("GDP data fetched year"), null=True, blank=True) + fdrs_gnipc = models.IntegerField(verbose_name=_("GNI/CAPITA"), null=True, blank=True) + fdrs_gnipc_data_year = models.IntegerField(verbose_name=_("GNI/CAPITA data fetched year"), null=True, blank=True) + fdrs_life_expectancy = models.IntegerField(null=True, blank=True, verbose_name=_("life expectancy")) + fdrs_life_expectancy_data_year = models.IntegerField( + verbose_name=_("life expectancy data fetched year"), null=True, blank=True + ) + fdrs_urban_population = models.FloatField( validators=[MaxValueValidator(100), MinValueValidator(0)], verbose_name=_("urban POP (%)"), null=True, blank=True, ) - poverty = models.FloatField( + fdrs_urban_population_data_year = models.IntegerField( + verbose_name=_("urban population data fetched year"), null=True, blank=True + ) + fdrs_poverty = models.FloatField( validators=[MaxValueValidator(100), MinValueValidator(0)], verbose_name=_("poverty (%)"), null=True, blank=True, ) - literacy = models.FloatField( + fdrs_poverty_data_year = models.IntegerField(verbose_name=_("poverty data fetched year"), null=True, blank=True) + fdrs_literacy = models.FloatField( validators=[MaxValueValidator(100), MinValueValidator(0)], verbose_name=_("literacy (%)"), null=True, blank=True, ) + fdrs_literacy_data_year = models.IntegerField(verbose_name=_("literacy data fetched year"), null=True, blank=True) # National Society Indicators (Using Script: FDRS API) - income = models.FloatField(verbose_name=_("income (CHF)"), null=True, blank=True) - expenditures = models.FloatField(verbose_name=_("expenditures (CHF)"), null=True, blank=True) - volunteers = models.IntegerField(verbose_name=_("volunteers"), null=True, blank=True) - trained_in_first_aid = models.IntegerField(verbose_name=_("trained in first aid"), null=True, blank=True) - branches = models.IntegerField(verbose_name=_("Branches"), null=True, blank=True) + fdrs_income = models.FloatField(verbose_name=_("income (CHF)"), null=True, blank=True) + fdrs_income_data_year = models.IntegerField(verbose_name=_("income data fetched year"), null=True, blank=True) + fdrs_expenditures = models.FloatField(verbose_name=_("expenditures (CHF)"), null=True, blank=True) + fdrs_expenditures_data_year = models.IntegerField(verbose_name=_("expenditures data fetched year"), null=True, blank=True) + fdrs_trained_in_first_aid = models.IntegerField(verbose_name=_("trained in first aid"), null=True, blank=True) + fdrs_trained_in_first_aid_data_year = models.IntegerField( + verbose_name=_("trained in first aid data fetched year"), null=True, blank=True + ) + fdrs_branches = models.IntegerField(verbose_name=_("Branches"), null=True, blank=True) + fdrs_branches_data_year = models.IntegerField(verbose_name=_("branches data fetched year"), null=True, blank=True) # Population data # Voluntering - male_volunteer_age_6_12 = models.IntegerField(verbose_name=_("male volunteer age 6 to 12"), null=True, blank=True) - male_volunteer_age_13_17 = models.IntegerField(verbose_name=_("male volunteer age 13 to 17"), null=True, blank=True) - male_volunteer_age_18_29 = models.IntegerField(verbose_name=_("male volunteer age 18 to 29"), null=True, blank=True) - male_volunteer_age_18_49 = models.IntegerField(verbose_name=_("male volunteer age 18 to 49"), null=True, blank=True) - male_volunteer_age_30_39 = models.IntegerField(verbose_name=_("male volunteer age 30 to 39"), null=True, blank=True) - male_volunteer_age_40_49 = models.IntegerField(verbose_name=_("male volunteer age 40 to 49"), null=True, blank=True) - male_volunteer_age_50_59 = models.IntegerField(verbose_name=_("male volunteer age 50 to 59"), null=True, blank=True) - male_volunteer_age_60_69 = models.IntegerField(verbose_name=_("male volunteer age 60 to 69"), null=True, blank=True) - male_volunteer_age_70_79 = models.IntegerField(verbose_name=_("male volunteer age 70 to 79"), null=True, blank=True) - male_volunteer_age_80 = models.IntegerField(verbose_name=_("male volunteer age 80"), null=True, blank=True) - male_volunteer_age_other = models.IntegerField(verbose_name=_("male volunteer other"), null=True, blank=True) - male_volunteer_total = models.IntegerField(verbose_name=_("male volunteer total"), null=True, blank=True) - female_volunteer_age_6_12 = models.IntegerField(verbose_name=_("female volunteer age 6 to 12"), null=True, blank=True) - female_volunteer_age_13_17 = models.IntegerField(verbose_name=_("female volunteer age 13 to 17"), null=True, blank=True) - female_volunteer_age_18_29 = models.IntegerField(verbose_name=_("female volunteer age 18 to 29"), null=True, blank=True) - female_volunteer_age_18_49 = models.IntegerField(verbose_name=_("female volunteer age 18 to 49"), null=True, blank=True) - female_volunteer_age_30_39 = models.IntegerField(verbose_name=_("female volunteer age 30 to 39"), null=True, blank=True) - female_volunteer_age_40_49 = models.IntegerField(verbose_name=_("female volunteer age 40 to 49"), null=True, blank=True) - female_volunteer_age_50_59 = models.IntegerField(verbose_name=_("female volunteer age 50 to 59"), null=True, blank=True) - female_volunteer_age_60_69 = models.IntegerField(verbose_name=_("female volunteer age 60 to 69"), null=True, blank=True) - female_volunteer_age_70_79 = models.IntegerField(verbose_name=_("female volunteer age 70 to 79"), null=True, blank=True) - female_volunteer_age_80 = models.IntegerField(verbose_name=_("female volunteer age 80"), null=True, blank=True) - - female_volunteer_age_other = models.IntegerField(verbose_name=_("female volunteer other"), null=True, blank=True) - female_volunteer_total = models.IntegerField(verbose_name=_("female volunteer total"), null=True, blank=True) - volunteer_total = models.IntegerField(verbose_name=_("volunteer total"), null=True, blank=True) - volunteer_age_6_12 = models.IntegerField(verbose_name=_("volunteer age 6 to 12"), null=True, blank=True) - volunteer_age_13_17 = models.IntegerField(verbose_name=_("volunteer age 13 to 17"), null=True, blank=True) - volunteer_age_18_29 = models.IntegerField(verbose_name=_("volunteer age 18 to 29"), null=True, blank=True) + fdrs_male_volunteer_age_6_12 = models.IntegerField(verbose_name=_("male volunteer age 6 to 12"), null=True, blank=True) + fdrs_male_volunteer_age_13_17 = models.IntegerField(verbose_name=_("male volunteer age 13 to 17"), null=True, blank=True) + fdrs_male_volunteer_age_18_29 = models.IntegerField(verbose_name=_("male volunteer age 18 to 29"), null=True, blank=True) + fdrs_male_volunteer_age_18_49 = models.IntegerField(verbose_name=_("male volunteer age 18 to 49"), null=True, blank=True) + fdrs_male_volunteer_age_30_39 = models.IntegerField(verbose_name=_("male volunteer age 30 to 39"), null=True, blank=True) + fdrs_male_volunteer_age_40_49 = models.IntegerField(verbose_name=_("male volunteer age 40 to 49"), null=True, blank=True) + fdrs_male_volunteer_age_50_59 = models.IntegerField(verbose_name=_("male volunteer age 50 to 59"), null=True, blank=True) + fdrs_male_volunteer_age_60_69 = models.IntegerField(verbose_name=_("male volunteer age 60 to 69"), null=True, blank=True) + fdrs_male_volunteer_age_70_79 = models.IntegerField(verbose_name=_("male volunteer age 70 to 79"), null=True, blank=True) + fdrs_male_volunteer_age_80 = models.IntegerField(verbose_name=_("male volunteer age 80"), null=True, blank=True) + fdrs_male_volunteer_age_other = models.IntegerField(verbose_name=_("male volunteer other"), null=True, blank=True) + fdrs_male_volunteer_total = models.IntegerField(verbose_name=_("male volunteer total"), null=True, blank=True) + fdrs_female_volunteer_age_6_12 = models.IntegerField(verbose_name=_("female volunteer age 6 to 12"), null=True, blank=True) + fdrs_female_volunteer_age_13_17 = models.IntegerField(verbose_name=_("female volunteer age 13 to 17"), null=True, blank=True) + fdrs_female_volunteer_age_18_29 = models.IntegerField(verbose_name=_("female volunteer age 18 to 29"), null=True, blank=True) + fdrs_female_volunteer_age_18_49 = models.IntegerField(verbose_name=_("female volunteer age 18 to 49"), null=True, blank=True) + fdrs_female_volunteer_age_30_39 = models.IntegerField(verbose_name=_("female volunteer age 30 to 39"), null=True, blank=True) + fdrs_female_volunteer_age_40_49 = models.IntegerField(verbose_name=_("female volunteer age 40 to 49"), null=True, blank=True) + fdrs_female_volunteer_age_50_59 = models.IntegerField(verbose_name=_("female volunteer age 50 to 59"), null=True, blank=True) + fdrs_female_volunteer_age_60_69 = models.IntegerField(verbose_name=_("female volunteer age 60 to 69"), null=True, blank=True) + fdrs_female_volunteer_age_70_79 = models.IntegerField(verbose_name=_("female volunteer age 70 to 79"), null=True, blank=True) + fdrs_female_volunteer_age_80 = models.IntegerField(verbose_name=_("female volunteer age 80"), null=True, blank=True) + + fdrs_female_volunteer_age_other = models.IntegerField(verbose_name=_("female volunteer other"), null=True, blank=True) + fdrs_female_volunteer_total = models.IntegerField(verbose_name=_("female volunteer total"), null=True, blank=True) + fdrs_volunteer_total = models.IntegerField(verbose_name=_("volunteer total"), null=True, blank=True) + fdrs_volunteer_age_6_12 = models.IntegerField(verbose_name=_("volunteer age 6 to 12"), null=True, blank=True) + fdrs_volunteer_age_13_17 = models.IntegerField(verbose_name=_("volunteer age 13 to 17"), null=True, blank=True) + fdrs_volunteer_age_18_29 = models.IntegerField(verbose_name=_("volunteer age 18 to 29"), null=True, blank=True) + + # FDRS fetched year for the volunteer data + fdrs_volunteer_data_year = models.IntegerField(verbose_name=_("volunteer data fetched year"), null=True, blank=True) + # Staff - female_staff_age_18_29 = models.IntegerField(verbose_name=_("female staff age 18 to 29"), null=True, blank=True) - female_staff_age_18_49 = models.IntegerField(verbose_name=_("female staff age 18 to 49"), null=True, blank=True) - female_staff_age_30_39 = models.IntegerField(verbose_name=_("female staff age 30 to 39"), null=True, blank=True) - female_staff_age_40_49 = models.IntegerField(verbose_name=_("female staff age 40 to 49"), null=True, blank=True) - female_staff_age_50_59 = models.IntegerField(verbose_name=_("female staff age 50 to 59"), null=True, blank=True) - female_staff_age_60_69 = models.IntegerField(verbose_name=_("female staff age 60 to 69"), null=True, blank=True) - female_staff_age_70_79 = models.IntegerField(verbose_name=_("female staff age 70 to 79"), null=True, blank=True) - female_staff_age_80 = models.IntegerField(verbose_name=_("female staff age 80"), null=True, blank=True) - female_staff_age_other = models.IntegerField(verbose_name=_("female staff other"), null=True, blank=True) - female_staff_total = models.IntegerField(verbose_name=_("female staff total"), null=True, blank=True) - male_staff_age_18_29 = models.IntegerField(verbose_name=_("male staff age 18 to 29"), null=True, blank=True) - male_staff_age_18_49 = models.IntegerField(verbose_name=_("male staff age 18 to 49"), null=True, blank=True) - male_staff_age_30_39 = models.IntegerField(verbose_name=_("male staff age 30 to 39"), null=True, blank=True) - male_staff_age_40_49 = models.IntegerField(verbose_name=_("male staff age 40 to 49"), null=True, blank=True) - male_staff_age_50_59 = models.IntegerField(verbose_name=_("male staff age 50 to 59"), null=True, blank=True) - male_staff_age_60_69 = models.IntegerField(verbose_name=_("male staff age 60 to 69"), null=True, blank=True) - male_staff_age_70_79 = models.IntegerField(verbose_name=_("male staff age 70 to 79"), null=True, blank=True) - male_staff_age_80 = models.IntegerField(verbose_name=_("male staff age 80"), null=True, blank=True) - male_staff_age_other = models.IntegerField(verbose_name=_("male staff other"), null=True, blank=True) - male_staff_total = models.IntegerField(verbose_name=_("male staff total"), null=True, blank=True) - staff_total = models.IntegerField(verbose_name=_("staff total"), null=True, blank=True) - staff_age_18_29 = models.IntegerField(verbose_name=_("staff age 18 to 29"), null=True, blank=True) + fdrs_female_staff_age_18_29 = models.IntegerField(verbose_name=_("female staff age 18 to 29"), null=True, blank=True) + fdrs_female_staff_age_18_49 = models.IntegerField(verbose_name=_("female staff age 18 to 49"), null=True, blank=True) + fdrs_female_staff_age_30_39 = models.IntegerField(verbose_name=_("female staff age 30 to 39"), null=True, blank=True) + fdrs_female_staff_age_40_49 = models.IntegerField(verbose_name=_("female staff age 40 to 49"), null=True, blank=True) + fdrs_female_staff_age_50_59 = models.IntegerField(verbose_name=_("female staff age 50 to 59"), null=True, blank=True) + fdrs_female_staff_age_60_69 = models.IntegerField(verbose_name=_("female staff age 60 to 69"), null=True, blank=True) + fdrs_female_staff_age_70_79 = models.IntegerField(verbose_name=_("female staff age 70 to 79"), null=True, blank=True) + fdrs_female_staff_age_80 = models.IntegerField(verbose_name=_("female staff age 80"), null=True, blank=True) + fdrs_female_staff_age_other = models.IntegerField(verbose_name=_("female staff other"), null=True, blank=True) + fdrs_female_staff_total = models.IntegerField(verbose_name=_("female staff total"), null=True, blank=True) + fdrs_male_staff_age_18_29 = models.IntegerField(verbose_name=_("male staff age 18 to 29"), null=True, blank=True) + fdrs_male_staff_age_18_49 = models.IntegerField(verbose_name=_("male staff age 18 to 49"), null=True, blank=True) + fdrs_male_staff_age_30_39 = models.IntegerField(verbose_name=_("male staff age 30 to 39"), null=True, blank=True) + fdrs_male_staff_age_40_49 = models.IntegerField(verbose_name=_("male staff age 40 to 49"), null=True, blank=True) + fdrs_male_staff_age_50_59 = models.IntegerField(verbose_name=_("male staff age 50 to 59"), null=True, blank=True) + fdrs_male_staff_age_60_69 = models.IntegerField(verbose_name=_("male staff age 60 to 69"), null=True, blank=True) + fdrs_male_staff_age_70_79 = models.IntegerField(verbose_name=_("male staff age 70 to 79"), null=True, blank=True) + fdrs_male_staff_age_80 = models.IntegerField(verbose_name=_("male staff age 80"), null=True, blank=True) + fdrs_male_staff_age_other = models.IntegerField(verbose_name=_("male staff other"), null=True, blank=True) + fdrs_male_staff_total = models.IntegerField(verbose_name=_("male staff total"), null=True, blank=True) + fdrs_staff_total = models.IntegerField(verbose_name=_("staff total"), null=True, blank=True) + fdrs_staff_age_18_29 = models.IntegerField(verbose_name=_("staff age 18 to 29"), null=True, blank=True) + + # FDRS fetched year for the staff data + fdrs_staff_data_year = models.IntegerField(verbose_name=_("staff data fetched year"), null=True, blank=True) + # Key Climate Event (Manual Entry) avg_temperature = models.FloatField(verbose_name=_("average temperature"), null=True, blank=True) avg_rainfall_precipitation = models.FloatField(verbose_name=_("average rainfall precipitation"), null=True, blank=True) @@ -274,62 +298,49 @@ class CountryOverview(models.Model): # World bank data world_bank_population = models.IntegerField(verbose_name=_("world bank population"), null=True, blank=True) # NOTE: Using char to store integer values, Need to refactor the column type. - calculated_world_bank_population_year = models.CharField( - verbose_name=_("calculated world bank population year"), null=True, blank=True, max_length=50 - ) + world_bank_population_year = models.IntegerField(verbose_name=_("world bank population year"), null=True, blank=True) world_bank_population_above_age_65 = models.IntegerField( verbose_name=_("world bank population above age 65"), null=True, blank=True ) - calculated_world_bank_population_above_age_65_year = models.CharField( - verbose_name=_("calculated world bank population above age 65 date in year"), null=True, blank=True, max_length=50 + world_bank_population_above_age_65_year = models.IntegerField( + verbose_name=_("world bank population above age 65 date in year"), null=True, blank=True ) world_bank_population_age_14 = models.IntegerField(verbose_name=_("world bank population age 14"), null=True, blank=True) - calculated_world_bank_population_age_14_year = models.CharField( - verbose_name=_("calculated world bank population age 14 date in year"), null=True, blank=True, max_length=50 + world_bank_population_age_14_year = models.IntegerField( + verbose_name=_("world bank population age 14 date in year"), null=True, blank=True ) world_bank_urban_population_percentage = models.FloatField( verbose_name=_("world bank urban population percentage"), null=True, blank=True ) - calculated_world_bank_urban_population_percentage_year = models.CharField( - verbose_name=_("calculated world bank urban population percentage year"), null=True, blank=True, max_length=50 + world_bank_urban_population_percentage_year = models.IntegerField( + verbose_name=_("world bank urban population percentage year"), null=True, blank=True ) world_bank_gdp = models.FloatField(verbose_name=_("world bank gdp"), null=True, blank=True) - calculated_world_bank_gdp_year = models.CharField( - verbose_name=_("calculated world bank gdp year"), null=True, blank=True, max_length=50 - ) + world_bank_gdp_year = models.IntegerField(verbose_name=_("world bank gdp year"), null=True, blank=True) world_bank_gni = models.FloatField(verbose_name=_("world bank gni"), null=True, blank=True) - calculated_world_bank_gni_year = models.CharField( - verbose_name=_("calculated world bank gni year"), null=True, blank=True, max_length=50 - ) + world_bank_gni_year = models.IntegerField(verbose_name=_("world bank gni year"), null=True, blank=True) world_bank_gender_equality_index = models.FloatField( verbose_name=_("world bank gender equality index"), null=True, blank=True ) - calculated_world_bank_gender_equality_index_year = models.CharField( - verbose_name=_("calculated world bank gender equality index year"), null=True, blank=True, max_length=50 + world_bank_gender_equality_index_year = models.IntegerField( + verbose_name=_("world bank gender equality index year"), null=True, blank=True ) world_bank_life_expectancy = models.IntegerField(verbose_name=_("world bank life expectancy"), null=True, blank=True) - calculated_world_bank_life_expectancy_year = models.CharField( - verbose_name=_("calculated world bank life expectancy year"), null=True, blank=True, max_length=50 + world_bank_life_expectancy_year = models.IntegerField( + verbose_name=_("world bank life expectancy year"), null=True, blank=True ) world_bank_literacy_rate = models.FloatField(verbose_name=_("world bank life expectancy"), null=True, blank=True) - calculated_world_bank_literacy_rate_year = models.CharField( - verbose_name=_("calculated world bank literacy rate year"), null=True, blank=True, max_length=50 - ) + world_bank_literacy_rate_year = models.IntegerField(verbose_name=_("world bank literacy rate year"), null=True, blank=True) world_bank_poverty_rate = models.FloatField(verbose_name=_("world bank poverty rate"), null=True, blank=True) - calculated_world_bank_poverty_rate_year = models.CharField( - verbose_name=_("calculated world bank poverty rate year"), null=True, blank=True, max_length=50 - ) + world_bank_poverty_rate_year = models.IntegerField(verbose_name=_("world bank poverty rate year"), null=True, blank=True) world_bank_gni_capita = models.IntegerField(verbose_name=_("world bank GNI Per Capita"), null=True, blank=True) - calculated_world_bank_gni_capita_year = models.CharField( - verbose_name=_("calculated world bank gni capita year"), null=True, blank=True, max_length=50 - ) + world_bank_gni_capita_year = models.IntegerField(verbose_name=_("world bank gni capita year"), null=True, blank=True) # fetched from unicef unicef_population_under_18 = models.IntegerField(verbose_name=_("Unicef population under 18"), null=True, blank=True) # hdr hdr_gii = models.FloatField(verbose_name=_("HDR GII"), null=True, blank=True) - fdrs_data_fetched_year = models.CharField(verbose_name=_("FDRS Data Fetched Year"), null=True, blank=True, max_length=50) class Meta: verbose_name = _("country overview")