ingest

ingest

Functionality related to ingesting data from files. Ingesting encompasses loading data from files, parsing data and reformatting data, and processing so they tcan be consumed by typhoidsim or starsim.

Functions

Name Description
get_age_distribution A small wrapper of synthpops.people.loaders.get_age_distributon().
get_age_mix_distribution Return Prem et al.’s (2017) matrices, which project inferred age mixing
get_household_head_age_by_size_distribution Calculate the contigency table, representing thr probabilities of each
get_household_head_age_distribution Load household head’s age distribution.
get_household_size A small wrapper of synthpops.people.loaders.get_household_size().
get_household_size_distribution Load household size distribution.

get_age_distribution

ingest.get_age_distribution(location)

A small wrapper of synthpops.people.loaders.get_age_distributon(). This function returns the array of age distribution of ‘location’, in the shape required by starsim People’s age_data keyword argument.

Parameters

Name Type Description Default
location str the name of the country required

Returns

Name Type Description
age_data np.array the array of age distribution of ‘location’

get_age_mix_distribution

ingest.get_age_mix_distribution(location, make_symmetric=True)

Return Prem et al.’s (2017) matrices, which project inferred age mixing patterns.

Parameters

Name Type Description Default
location str name of the country to load contact age mixing required
make_symmetric bool whether to make the age mixing matrix symmetric True

Returns

Name Type Description
age_mix_matrix This is a contact pattern matrix. Each row i tells you
the average daily contacts for a person from age group i.
The columns stand for the age groups of those contacts. The element i,j
in the matrix, it’s how often (or how many times) a typical person
from age group i interacts with someone from age group j in
that specific physical contact setting.

get_household_head_age_by_size_distribution

ingest.get_household_head_age_by_size_distribution(location)

Calculate the contigency table, representing thr probabilities of each combination of household size and head age. The assumption is that household size and household head age are independent.

If they are not independent, then we would need the joint distribution of these two variables which needs to be collected or estimated separately.

Parameters

Name Type Description Default
location str or list name of the country or countries to load the age distribution for required

Returns

Name Type Description
household_head_age_distribution float N x 2: household head age bracket and proportion

get_household_head_age_distribution

ingest.get_household_head_age_distribution(location=None)

Load household head’s age distribution.

Parameters

Name Type Description Default
location str or list name of the country or countries to load the age distribution for None

Returns

Name Type Description
household_head_age_distribution float N x 2: household head age bracket and proportion

get_household_size

ingest.get_household_size(location)

A small wrapper of synthpops.people.loaders.get_household_size(). This function returns the average household size for that location. This parameter is necessary when creating a HouseholdNet.

Parameters

Name Type Description Default
location str the name of the country required

Returns

Name Type Description
household_size float the average household size of ‘location’.

get_household_size_distribution

ingest.get_household_size_distribution(location=None)

Load household size distribution.

Parameters

Name Type Description Default
location str or list name of the country or countries to load the age distribution for None

Returns

Name Type Description
household_size_distribution np.array Nx2 array. First column household size;
second column: fraction of household of that size