Social contact visit distributor
SocialContactVisitDistributor: Assigns visit_social_contact activity based on social contacts' residences.
This distributor creates a derived activity where the venues are the residences of a person's social contacts. It runs AFTER relationship building so that social_contacts are already populated.
The activity allows disease modeling to track visits to contacts' homes.
SocialContactVisitDistributor
Distributor that assigns visit_social_contact activity based on social contacts.
For each person with social contacts: 1. Look up each contact's residence from their activity_map 2. Add that residence to this person's activity_map under 'visit_social_contact'
This creates a derived activity where venues are determined by relationships, not by direct venue allocation.
Source code in may/venue_distributor/social_contact_visit_distributor.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
__init__(config_file=None, config_dict=None)
Initialize SocialContactVisitDistributor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
str
|
Path to YAML config file |
None
|
config_dict
|
Dict
|
Dictionary config (alternative to file) |
None
|
Source code in may/venue_distributor/social_contact_visit_distributor.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
allocate(world)
Assign visit_social_contact activity to all eligible people.
For each person: 1. Check eligibility 2. Get their social contacts from properties 3. For each contact, get their residence 4. Add the residence to this person's visit_social_contact activity
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world
|
World object containing population and venues |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Statistics dictionary |
Source code in may/venue_distributor/social_contact_visit_distributor.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
from_yaml(yaml_path)
classmethod
Factory method to create distributor from YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yaml_path
|
str
|
Path to YAML config file |
required |
Returns:
| Type | Description |
|---|---|
|
SocialContactVisitDistributor instance |
Source code in may/venue_distributor/social_contact_visit_distributor.py
220 221 222 223 224 225 226 227 228 229 230 231 | |