synthpops.workplaces module

synthpops.workplaces.get_uids_potential_workers(syn_school_uids, employment_rates, age_by_uid_dic)

Get IDs for everyone who could be a worker by removing those who are students and those who can’t be employed officially.

Parameters
  • syn_school_uids (list) – A list of lists where each sublist represents a school with the IDs of students in the school.

  • employment_rates (dict) – The employment rates by age.

  • age_by_uid_dic (dict) – A dictionary mapping ID to age for individuals in the population.

Returns

A dictionary of potential workers mapping their ID to their age, a dictionary mapping age to the list of IDs for potential workers with that age, and a dictionary mapping age to the count of potential workers left to assign to a workplace for that age.

synthpops.workplaces.generate_workplace_sizes(workplace_size_distr_by_bracket, workplace_size_brackets, workers_by_age_to_assign_count)

Given a number of individuals employed, generate a list of workplace sizes to place everyone in a workplace.

Parameters
  • workplace_size_distr_by_bracket (dict) – The distribution of binned workplace sizes.

  • worplace_size_brackets (dict) – A dictionary of workplace size brackets.

  • workers_by_age_to_assign_count (dict) – A dictionary mapping age to the count of employed individuals of that age.

Returns

A list of workplace sizes.

synthpops.workplaces.get_workers_by_age_to_assign(employment_rates, potential_worker_ages_left_count, uids_by_age_dic)

Get the number of people to assign to a workplace by age using those left who can potentially go to work and employment rates by age.

Parameters
  • employment_rates (dict) – A dictionary of employment rates by age.

  • potential_worker_ages_left_count (dict) – A dictionary of the count of workers to assign by age.

  • uids_by_age_dic (dict) – A dictionary mapping age to the list of ids with that age.

Returns

A dictionary with a count of workers to assign to a workplace.

synthpops.workplaces.assign_rest_of_workers(workplace_sizes, potential_worker_uids, potential_worker_uids_by_age, workers_by_age_to_assign_count, age_by_uid_dic, age_brackets, age_by_brackets_dic, contact_matrix_dic, verbose=False)

Assign the rest of the workers to non-school workplaces.

Parameters
  • workplace_sizes (list) – list of workplace sizes

  • potential_worker_uids (dict) – dictionary of potential workers mapping their id to their age

  • potential_worker_uids_by_age (dict) – dictionary mapping age to the list of worker ids with that age

  • workers_by_age_to_assign_count (dict) – dictionary of the count of workers left to assign by age

  • age_by_uid_dic (dict) – dictionary mapping id to age for all individuals in the population

  • age_brackets (dict) – dictionary mapping age bracket keys to age bracket range

  • age_by_brackets_dic (dict) – dictionary mapping age to the age bracket range it falls in

  • contact_matrix_dic (dict) – dictionary of age specific contact matrix for different physical contact settings

  • verbose (bool) – If True, print statements about the generated schools as teachers are being added to each school.

Returns

List of lists where each sublist is a workplace with the ages of workers, list of lists where each sublist is a workplace with the ids of workers, dictionary of potential workers left mapping id to age, dictionary mapping age to a list of potential workers left of that age, dictionary mapping age to the count of workers left to assign.