june.policy.individual_policies¶
-
class
june.policy.individual_policies.
CloseCompanies
(start_time: str, end_time: str, full_closure=False, avoid_work_probability=None, furlough_probability=None, key_probability=None)¶ Prevents workers with the tag ``person.lockdown_status=furlough” to go to work. If full_closure is True, then no one will go to work.
-
__init__
(start_time: str, end_time: str, full_closure=False, avoid_work_probability=None, furlough_probability=None, key_probability=None)¶ Prevents workers with the tag ``person.lockdown_status=furlough” to go to work. If full_closure is True, then no one will go to work.
-
apply
(activities: List[str]) → List[str]¶ Remove an activity from a list of activities
- activities:
list of activities
- activity_to_remove:
activity that will be removed from the list
-
check_skips_activity
(person: june.demography.person.Person, furlough_ratio=None, key_ratio=None, random_ratio=None) → bool¶ Returns True if the activity is to be skipped, otherwise False
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
-
class
june.policy.individual_policies.
CloseSchools
(start_time: str, end_time: str, years_to_close=None, attending_compliance=1.0, full_closure=None)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time: str, end_time: str, years_to_close=None, attending_compliance=1.0, full_closure=None)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
_check_kid_goes_to_school
(person: june.demography.person.Person)¶ Checks if a kid should go to school when there is a lockdown. The rule is that a kid goes to school if the age is below 14 (not included) and there are at least two key workers at home.
-
apply
(activities: List[str]) → List[str]¶ Remove an activity from a list of activities
- activities:
list of activities
- activity_to_remove:
activity that will be removed from the list
-
check_skips_activity
(person: june.demography.person.Person) → bool¶ Returns True if the activity is to be skipped, otherwise False
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
CloseUniversities
(start_time: str, end_time: str)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time: str, end_time: str)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
apply
(activities: List[str]) → List[str]¶ Remove an activity from a list of activities
- activities:
list of activities
- activity_to_remove:
activity that will be removed from the list
-
check_skips_activity
(person: june.demography.person.Person) → bool¶ Returns True if the activity is to be skipped, otherwise False
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
IndividualPolicies
(policies: List[june.policy.policy.Policy])¶ A collection of like policies active on the same date
-
__init__
(policies: List[june.policy.policy.Policy])¶ A collection of like policies active on the same date
-
apply
(active_policies, person: june.demography.person.Person, days_from_start: float, activities: List[str], furlough_ratio=None, key_ratio=None, random_ratio=None)¶ Applies all active individual policies to the person. Stay home policies are applied first, since if the person stays home we don’t need to check for the others. IF a person is below 15 years old, then we look for a guardian to stay with that person at home.
-
classmethod
from_policies
(policies: june.policy.policy.Policies)¶
-
get_active
(date: datetime.date)¶
-
min_age_home_alone
= 15¶
-
policy_type
= 'individual'¶
-
-
class
june.policy.individual_policies.
IndividualPolicy
(start_time: Union[str, datetime.datetime], end_time: Union[str, datetime.datetime])¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time: Union[str, datetime.datetime], end_time: Union[str, datetime.datetime])¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
Quarantine
(start_time: Union[str, datetime.datetime] = '1900-01-01', end_time: Union[str, datetime.datetime] = '2100-01-01', n_days: int = 7, n_days_household: int = 14, compliance: float = 1.0, household_compliance: float = 1.0)¶ This policy forces people to stay at home for
`n_days`
days after they show symtpoms, and for`n_days_household`
if someone else in their household shows symptoms- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
- n_days:
days for which the person has to stay at home if they show symtpoms
- n_days_household:
days for which the person has to stay at home if someone in their household shows symptoms
- compliance:
percentage of symptomatic people that will adhere to the quarantine policy
- household_compliance:
percentage of people that will adhere to the hoseuhold quarantine policy
-
__init__
(start_time: Union[str, datetime.datetime] = '1900-01-01', end_time: Union[str, datetime.datetime] = '2100-01-01', n_days: int = 7, n_days_household: int = 14, compliance: float = 1.0, household_compliance: float = 1.0)¶ This policy forces people to stay at home for
`n_days`
days after they show symtpoms, and for`n_days_household`
if someone else in their household shows symptoms- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
- n_days:
days for which the person has to stay at home if they show symtpoms
- n_days_household:
days for which the person has to stay at home if someone in their household shows symptoms
- compliance:
percentage of symptomatic people that will adhere to the quarantine policy
- household_compliance:
percentage of people that will adhere to the hoseuhold quarantine policy
-
apply
(person: june.demography.person.Person, days_from_start: float, activities: List[str])¶ Removes all activities but residence if the person has to stay at home.
-
check_stay_home_condition
(person: june.demography.person.Person, days_from_start)¶ Returns true if a person must stay at home. Parameters ———- person:
person to whom the policy is being applied
- days_from_start:
time past from beginning of simulation, in units of days
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
SevereSymptomsStayHome
(start_time='1900-01-01', end_time='2100-01-01')¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time='1900-01-01', end_time='2100-01-01')¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
apply
(person: june.demography.person.Person, days_from_start: float, activities: List[str])¶ Removes all activities but residence if the person has to stay at home.
-
check_stay_home_condition
(person: june.demography.person.Person, days_from_start: float) → bool¶ Returns true if a person must stay at home. Parameters ———- person:
person to whom the policy is being applied
- days_from_start:
time past from beginning of simulation, in units of days
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
Shielding
(start_time: str, end_time: str, min_age: int, compliance: Optional[float] = None)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time: str, end_time: str, min_age: int, compliance: Optional[float] = None)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
apply
(person: june.demography.person.Person, days_from_start: float, activities: List[str])¶ Removes all activities but residence if the person has to stay at home.
-
check_stay_home_condition
(person: june.demography.person.Person, days_from_start: float)¶ Returns true if a person must stay at home. Parameters ———- person:
person to whom the policy is being applied
- days_from_start:
time past from beginning of simulation, in units of days
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
SkipActivity
(start_time: Union[str, datetime.datetime] = '1900-01-01', end_time: Union[str, datetime.datetime] = '2100-01-01', activities_to_remove=None)¶ Template for policies that will ban an activity for a person
Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time: Union[str, datetime.datetime] = '1900-01-01', end_time: Union[str, datetime.datetime] = '2100-01-01', activities_to_remove=None)¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
apply
(activities: List[str]) → List[str]¶ Remove an activity from a list of activities
- activities:
list of activities
- activity_to_remove:
activity that will be removed from the list
-
check_skips_activity
(person: june.demography.person.Person) → bool¶ Returns True if the activity is to be skipped, otherwise False
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
class
june.policy.individual_policies.
StayHome
(start_time='1900-01-01', end_time='2100-01-01')¶ Template for policies that will force someone to stay at home
Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
__init__
(start_time='1900-01-01', end_time='2100-01-01')¶ Template for a general policy.
- start_time:
date at which to start applying the policy
- end_time:
date from which the policy won’t apply
-
apply
(person: june.demography.person.Person, days_from_start: float, activities: List[str])¶ Removes all activities but residence if the person has to stay at home.
-
check_stay_home_condition
(person: june.demography.person.Person, days_from_start: float)¶ Returns true if a person must stay at home. Parameters ———- person:
person to whom the policy is being applied
- days_from_start:
time past from beginning of simulation, in units of days
-
get_spec
() → str¶ Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool¶ Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime¶ Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>¶
-
june.policy.individual_policies.
random
() → x in the interval [0, 1).¶