popmex documentation
¶
Part of the dengueverse
popmex is part of the dengueverse, a family of R and Python packages for the surveillance, analysis and prediction of dengue in Mexico: data, epidemiological surveillance, transmission hotspots, entomology and risk. popmex gives the denominators; rgeomex the boundaries and climex the climate. The R version is popmex.
Welcome¶
The popmex package provides population datasets of Mexico for epidemiological analysis and to calculate rates: the census population by municipality, sex and age group (INEGI 2000, 2010 and 2020), the municipal population reconstructions and projections 1990-2040 (CONAPO), and the population in 400 m H3 hexagons (Kontur 2021-2023), with a function to extract the hexagons of urban localities, and the LandScan Global population raster (1 km, one band per year 2000-2026) with a function to sum it by municipality or locality.
Philosophy¶
The authors' vision is to create data packages, functions, or a combination of both in Julia, R, and Python, contributing to the interoperability of algorithms and data to transform the information into decisions that help solve specific problems.
Population is the denominator of every rate and the exposure of every spatial model. popmex gathers in one place the population of Mexico at the two scales used in dengue surveillance: the municipality, to calculate incidence rates, and the 400 m hexagon, to know where people live inside the cities.
Getting Started¶
Installation¶
From GitHub¶
The package is installed as popmex-py and imported as popmex. For
extract_pop() install also rgeomex:
Quick Start Tutorial¶
1. Import the package¶
2. List the datasets¶
3. Population of the municipalities (denominators)¶
pop = popmex.load("pop2020", cve_edo="31") # the 106 municipalities of Yucatán
pop[["CVEGEO", "pobtot", "pobfem", "pobmas"]].head()
4. Population of a city in 400 m hexagons¶
merida = popmex.extract_pop(year=2023, cve_edo="31",
locality=["Merida", "Uman", "Kanasin"])
merida["population"].sum() # 1,055,960 inhabitants in 479 hexagons
5. Rates¶
popmex.rate(cases=25, population=50_000) # 50 per 100,000
pop["tasa"] = popmex.rate(pop["casos"], pop["pobtot"]) # columns of your table
See the Quick Start for the details and the Examples for CONAPO projections, maps and LandScan.