src.policies.domain_level_policy_blocks

Functions to create building blocks of policies with common dates and domains.

Currently we distinguish the domains “work”, “educ” and “other”. “households” are not included in any domain because they are currently not subject to policies.

The functions here should not be called directly but will be used in the module full_policy_blocks.py.

All public functions here take the following arguments (and possibly some more)

  • contact_models (dict): A sid compatible dictionary with contact models.

  • block_info (dict): A dictionary containing start_date, end_date and prefix of a block of policies.

The functions here expect that the domain names are part of contact model names.

Module Contents

Functions

reduce_work_models(contact_models, block_info, attend_multiplier, hygiene_multiplier)

Reduce contacts of workers by a attend_multiplier.

shut_down_educ_models(contact_models, block_info, educ_type)

Shut down all educ models to zero.

reduce_educ_models(contact_models, block_info, educ_type, multiplier)

Apply a simple hygiene multiplier to a subset of the educ models.

apply_mixed_educ_policies(contact_models, block_info, educ_type, always_attend_query, a_b_query, non_a_b_attend, hygiene_multiplier, a_b_rhythm=None)

Apply mixed_educ_policies to a set of contact models.

apply_emergency_care_policies(contact_models, block_info, educ_type, attend_multiplier, hygiene_multiplier)

Implement emergency care that is only based on the educ_contact_priority.

shut_down_other_models(contact_models, block_info)

Reduce all other contacts to zero.

reduce_other_models(contact_models, block_info, multiplier)

Reduce other contacts with multiplier.

reopen_other_models(contact_models, block_info, start_multiplier, end_multiplier)

Reduce other contacts with gradually changing multiplier.

_get_base_policy(affected_model, block_info)

_get_educ_models(contact_models, educ_type)

_get_work_models(contact_models)

_get_other_models(contact_models)

_determine_educ_type(model_name)

Determine whether an education model is school, preschool or nursery.

reduce_work_models(contact_models, block_info, attend_multiplier, hygiene_multiplier)[source]

Reduce contacts of workers by a attend_multiplier.

Parameters
  • attend_multiplier (float or pd.Series) – Must be smaller or equal to one. If a Series is supplied the index must be dates.

  • hygiene_multiplier (float or pd.Series) – Must be smaller or equal to one. If a Series is supplied the index must be dates.

shut_down_educ_models(contact_models, block_info, educ_type)[source]

Shut down all educ models to zero.

reduce_educ_models(contact_models, block_info, educ_type, multiplier)[source]

Apply a simple hygiene multiplier to a subset of the educ models.

Parameters
  • contact_models (dict) – sid contact models

  • block_info (dict) – keys are ‘start_date’, ‘end_date’ and ‘prefix’.

  • educ_type (str) – “young_educ” or “school”. The function f”_get_{educ_type}_models” must exist in the local namespace.

  • multiplier (float) – value of the hygiene multiplier.

apply_mixed_educ_policies(contact_models, block_info, educ_type, always_attend_query, a_b_query, non_a_b_attend, hygiene_multiplier, a_b_rhythm=None)[source]

Apply mixed_educ_policies to a set of contact models.

Parameters
  • contact_models (dict) – sid contact models

  • block_info (dict) – keys are ‘start_date’, ‘end_date’ and ‘prefix’.

  • educ_type (str) – “young_educ” or “school”. The function f”_get_{educ_type}_models” must exist in the local namespace.

  • educ_options (dict) – keys must contain ‘always_attend_query’, ‘a_b_query’, ‘non_a_b_attend’ and ‘hygiene_multiplier’. ‘a_b_rhythm’ is an optional key. See mixed_educ_policy for details.

apply_emergency_care_policies(contact_models, block_info, educ_type, attend_multiplier, hygiene_multiplier)[source]

Implement emergency care that is only based on the educ_contact_priority.

This is a convenience function.

Parameters
  • contact_models (dict) – sid contact models

  • block_info (dict) – keys are ‘start_date’, ‘end_date’ and ‘prefix’.

  • educ_type (str) – “young_educ” or “school”. The function f”_get_{educ_type}_models” must exist in the local namespace.

shut_down_other_models(contact_models, block_info)[source]

Reduce all other contacts to zero.

reduce_other_models(contact_models, block_info, multiplier)[source]

Reduce other contacts with multiplier.

reopen_other_models(contact_models, block_info, start_multiplier, end_multiplier)[source]

Reduce other contacts with gradually changing multiplier.

_get_base_policy(affected_model, block_info)[source]
_get_educ_models(contact_models, educ_type)[source]
_get_work_models(contact_models)[source]
_get_other_models(contact_models)[source]
_determine_educ_type(model_name)[source]

Determine whether an education model is school, preschool or nursery.

Parameters

model_name (str) – name of the education model, e.g. educ_school_0.