emod_api.demographics.DemographicsTemplates module

emod_api.demographics.DemographicsTemplates.NoRisk()

NoRisk puts everyone at 0 risk.

emod_api.demographics.DemographicsTemplates.FullRisk(demog)

FullRisk puts everyone at 100% risk.

emod_api.demographics.DemographicsTemplates.InitRiskUniform(demog, min=0, max=1)

InitRiskUniform puts everyone at somewhere between 0% risk and 100% risk, drawn uniformly.

Parameters
  • min (float) – Low end of uniform distribution. Must be >=0, <1.

  • max (float) – High end of uniform distribution. Must be >=min, <=1.

Returns

json object aka python dict that can be directly passed to Demographics::SetDefaultFromTemplate

Raises

None

emod_api.demographics.DemographicsTemplates.NoInitialPrevalence(demog)

NoInitialPrevalence disables initial prevalence; outbreak seeding must be done from an Outbreak intervention (or serialized population).

Parameters

demog – emod-api.demographics.Demographics instance.

Returns

None

Raises

None

emod_api.demographics.DemographicsTemplates.InitPrevUniform(demog, prevalence)
emod_api.demographics.DemographicsTemplates.InitSusceptConstant(demog)
emod_api.demographics.DemographicsTemplates.EveryoneInitiallySusceptible(demog, setting=1.0)
emod_api.demographics.DemographicsTemplates.StepFunctionSusceptibility(demog, protected_setting=0.0, threshold_age=1825.0)
emod_api.demographics.DemographicsTemplates.SimpleSusceptibilityDistribution(demog, meanAgeAtInfection=2.5)
emod_api.demographics.DemographicsTemplates.DefaultSusceptibilityDistribution(demog)
emod_api.demographics.DemographicsTemplates.MortalityRateByAge(demog, age_bins, mort_rates)

Mortality Rate by Age

emod_api.demographics.DemographicsTemplates.ConstantMortality(demog, CrudeMortRate)
emod_api.demographics.DemographicsTemplates.MortalityStructureNigeriaDHS(demog)
emod_api.demographics.DemographicsTemplates.get_fert_dist(path_to_csv)

This function takes a fertility csv file (by year and age bin) and populates a DTK demographics.json file, and the corresponding config file to do individual pregnancies by age and year from data.

Parameters
  • demog – emod_api.demographics.Demographics instance.

  • path_to_csv – absolute path to csv input file. The file should have columns for 5-year age bins

  • "15-19", etc. up to "45-49", and a column named "Years" with values like "1950-1955". (labelled) –

  • can be extra columns and the columns can be anywhere. (There) –

Returns

(complex) dictionary. fertility distribution, ready to be added to demographics file.

emod_api.demographics.DemographicsTemplates.InitAgeUniform(demog)
emod_api.demographics.DemographicsTemplates.AgeStructureUNWPP(demog)
emod_api.demographics.DemographicsTemplates.EquilibriumAgeDistFromBirthAndMortRates(demog, CrudeBirthRate=0.04, CrudeMortRate=0.02)

For the moment, this is assuming constant mortality, should update with an interpolator based on demographics file to improve Reuse of some of these demographics variables and passing them around indicates this may be better as a class. May be best to wait however, until the idmtools Demographics class is around, so that we can inherit from that and only add functionality. Should maybe allow user to specify the “fineness” of the age-binning for the final demographics distribution Having to do this conversion of crude birth rates to per-day per-person rates frequently. Should find the right place to do this only once.