Skip to content

Commit

Permalink
Merge pull request #2280 from IFRCGo/fix/fdrs-latest-year-data
Browse files Browse the repository at this point in the history
FDRS: Fetch only the latest year related data
  • Loading branch information
szabozoltan69 authored Nov 5, 2024
2 parents 4f27124 + cc53652 commit 8117b57
Show file tree
Hide file tree
Showing 5 changed files with 1,081 additions and 221 deletions.
58 changes: 39 additions & 19 deletions databank/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")}),
Expand All @@ -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",
)
},
),
Expand Down
22 changes: 11 additions & 11 deletions databank/management/commands/ingest_worldbank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
}

Expand Down
Loading

0 comments on commit 8117b57

Please sign in to comment.