コード例 #1
0
def quarantine_routine(person: Person):
    """
    Create a routine change that represents a person being in quarantine.
    Here we try to represent the changing (decreasing of weights) of the weight in all the environment, due to the quarantine.
    :param person: Person
    :return: routine change dict, keys are environment names, values are weight multipliers.
    """
    params = Params.loader()["interventions_routines"]["quarantine"]
    return {env_name: params["all"] for env_name in person.get_routine()}
コード例 #2
0
def household_isolation_routine(person: Person):
    """
    Create a routine change that represents a person being in isolation at home.
    Here we try to represent the changing (decreasing/ increasing of weights) of the weight in all the environment,
    due to the person staying at home.
    :param person: Person
    :return: routine change dict, keys are environment names, values are weight multipliers.
    """
    params = Params.loader()["interventions_routines"]["household_isolation"]
    routine = {}
    for env_name in person.get_routine():
        if env_name == 'household':
            routine['household'] = params["household"]
        else:
            routine[env_name] = params["other"]
    return routine
コード例 #3
0
def workplace_closure_routine(person: Person):
    """
    Create a routine change that represents a closure of the person's workplace.
    Here we try to represent the changing of the weight in the workplace environment as well as other environments,
    due to the closure.
    :param person: Person
    :return: routine change dict, keys are environment names, values are weight multipliers.
    """
    params = Params.loader()["interventions_routines"]["workplace_closure"]
    routine = {}
    for env_name in person.get_routine():
        if env_name == 'workplace':
            routine['workplace'] = params["workplace"]
        else:
            routine[env_name] = params["other"]
    return routine
コード例 #4
0
def social_distancing_routine(person: Person):
    """
    Create a routine change that represents a social distancing effect on a person routine.
    Here we try to represent the changing (decreasing/ increasing of weights) of the weight in all the environment,
    due to the closure.
    :param person: Person
    :return: routine change dict, keys are environment names, values are weight multipliers.
    """
    params = Params.loader()["interventions_routines"]["social_distancing"]
    routine = {}
    for env_name in person.get_routine():
        if env_name == 'household':
            routine['household'] = params["household"]
        elif env_name == 'workplace':
            routine['workplace'] = params["workplace"]
        elif env_name == 'school':
            routine[env_name] = params["school"]
        else:
            routine[env_name] = params["other"]
    return routine