health_data.py
The health_data object stores and manipulates built-in health data (population and incidence rates) from BenMAP. It inputs a dictionary of filepaths and two Boolean run options (verbose and race_stratified) to return dataframes of population, incidence, and combined population-incidence information (pop_inc).
Inputs
pop_alloc: a geodataframe of population allocated to the ISRM grid geometryincidence_fp: a string containing the file path to the background incidence datasetverbose: a Boolean indicating whether or not detailed logging statements should be printedrace_stratified: a Boolean indicating whether race-stratified incidence rates should be useddebug_mode: a Boolean indicating whether or not to output debug statements
Calculated Attributes
population: a geodataframe containing the population allocated to the ISRM grid geometryincidence: a geodataframe containing the raw incidence data from BenMAPpop_inc: a geodataframe containing the combined population and incidence data based on the requested geographies
Internal Functions
load_data: reads in the population and incidence data from feather filesupdate_pop: updates the population dataset by melting (unpivot) and renaming columnsupdate_inc: updates the incidence dataset by pivoting columns around endpoints and renaming columnsget_incidence_lookup: creates a small incidence lookup table based on the name and age rangesget_incidence_pop: helper function that returns the incidence for a given name, race, age range, and endpointmake_incidence_lookup: creates a lookup dictionary using theget_incidence_popfunction for each endpointincidence_by_age: creates a smaller incidence table for merging by callingget_incidence_lookupfor each endpointcombine_pop_inc: creates thepop_incdataframe by doing a spatial merge on the population and incidence data and then using lookup tables to determine the appropriate values