Disease config
Disease Configuration
This module handles the configuration of diseases for the epidemiology model.
Classes:
Name | Description |
---|---|
DiseaseConfig |
Manages disease-specific configurations. |
RatesManager |
Handles infection outcome rates. |
InteractionManager |
Manages interaction-related configurations. |
SymptomManager |
Manages symptom-related configurations. |
VaccinationManager |
Manages vaccination-related configurations. |
PolicyManager |
Handles policy-related configurations. |
DiseaseConfig
Manages the configuration of a specific disease.
This class loads and parses disease-specific YAML configurations, and initialises managers for rates, interactions, symptoms, vaccinations, and policies.
Source code in june/epidemiology/infection/disease_config.py
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 |
|
__init__(disease_name, config_path)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_path
|
str
|
Path to the disease configuration file to get the disease configuration file. |
required |
Source code in june/epidemiology/infection/disease_config.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
InteractionManager
Manages interaction-related configurations for a specific disease.
This class loads interaction settings from a YAML file and initialises attributes related to disease susceptibility, interaction coefficients, contact matrices, and interactive groups.
Source code in june/epidemiology/infection/disease_config.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
alpha_physical
property
Retrieve the physical interaction coefficient (alpha).
betas
property
Retrieve beta coefficients for interaction types.
contact_matrices
property
Retrieve the contact matrices for population groups.
susceptibilities
property
Retrieve susceptibility values for different groups.
PolicyManager
Manages policy configurations for a specific disease.
Source code in june/epidemiology/infection/disease_config.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
get_all_policies()
Retrieve all categorised policies.
Returns:
Type | Description |
---|---|
dict
|
A dictionary of all policies organised by categories. |
Source code in june/epidemiology/infection/disease_config.py
437 438 439 440 441 442 443 444 445 |
|
get_policy_data(policy_name)
Retrieve the configuration for a specific policy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
policy_name
|
str
|
Name of the policy. |
required |
Returns:
Type | Description |
---|---|
dict
|
Configuration dictionary for the policy. |
Source code in june/epidemiology/infection/disease_config.py
425 426 427 428 429 430 431 432 433 434 435 |
|
RatesManager
Manages infection outcome rates for a specific disease.
This class handles the loading and processing of infection outcome rates for a disease based on its configuration. It initialises rate structures, maps rates to symptom tags, and provides access to infection outcome rates.
Source code in june/epidemiology/infection/disease_config.py
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 |
|
rates_structure
property
Retrieve or initialise the rates structure.
The rates structure is a nested dictionary mapping rate parameters, population sectors, and genders to their precomputed values.
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Dict[str, Union[None, Dict[str, float]]]]]
|
dict[str, dict[str, dict[str, Union[None, dict[str, float]]]]]: A nested dictionary where keys are parameters, population sectors (e.g., 'gp', 'ch'), and genders ('male', 'female'). |
get_precomputed_rates(rates_df, population, sex, parameter)
Retrieve or compute precomputed rates for a given parameter, population, and gender.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rates_df
|
DataFrame
|
A DataFrame containing rate values indexed by age bins. |
required |
population
|
str
|
The population type (e.g., 'ch', 'gp'). |
required |
sex
|
str
|
The sex of the individual ('male' or 'female'). |
required |
parameter
|
str
|
The rate parameter to retrieve or compute (e.g., 'hospital', 'ifr'). |
required |
Returns:
Type | Description |
---|---|
Dict[str, float]
|
dict[str, float]: A dictionary mapping age bins to precomputed rate values. |
Raises:
Type | Description |
---|---|
ValueError
|
If the specified column (constructed from population, parameter, and sex) is not found in the DataFrame. |
Source code in june/epidemiology/infection/disease_config.py
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 |
|
get_rates_file()
Retrieve the path to the infection outcome rates file.
Returns:
Type | Description |
---|---|
str
|
Path to the rates file. |
Source code in june/epidemiology/infection/disease_config.py
210 211 212 213 214 215 216 217 218 |
|
get_tag_for_rate(rate_name)
Get the tag value corresponding to a rate name using the mapping.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rate_name
|
str
|
The name of the rate in the CSV or configuration. |
required |
Returns:
Type | Description |
---|---|
int
|
The tag value corresponding to the rate name. |
Raises:
Type | Description |
---|---|
KeyError
|
If the rate name or tag is not found in the configuration. |
Source code in june/epidemiology/infection/disease_config.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
map_rate_to_tag(rate_name)
Map a rate name to its corresponding symptom tag using the rate-to-tag mapping.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rate_name
|
str
|
The name of the rate in the CSV or configuration. |
required |
Returns:
Type | Description |
---|---|
str
|
The corresponding symptom tag name. |
Raises:
Type | Description |
---|---|
KeyError
|
If the rate name is not found in the mapping. |
Source code in june/epidemiology/infection/disease_config.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
SymptomManager
Manages symptom-related configurations for a specific disease.
This class initialises and processes symptom-related attributes for a disease based on its YAML configuration. It provides functionality to retrieve symptom tag indices, categories, and default stages.
Source code in june/epidemiology/infection/disease_config.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
default_lowest_stage_index
property
Retrieve the index of the default lowest stage.
Returns:
Type | Description |
---|---|
int
|
The index of the default lowest stage. |
Raises:
Type | Description |
---|---|
ValueError
|
If the default lowest stage is not found in the symptom tags. |
max_mild_symptom_tag
property
Retrieve the index of the maximum mild symptom tag.
Returns:
Type | Description |
---|---|
Optional[int]
|
Optional[int]: The value corresponding to |
Raises:
Type | Description |
---|---|
ValueError
|
If |
get_tag_value(tag_name)
Get the value of a symptom tag by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag_name
|
str
|
The name of the symptom tag. |
required |
Returns:
Type | Description |
---|---|
int
|
The value of the symptom tag. |
Raises:
Type | Description |
---|---|
KeyError
|
If the tag name is not found in the configuration. |
Source code in june/epidemiology/infection/disease_config.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
VaccinationManager
Manages vaccination-related configurations for a specific disease.
This class loads and processes vaccination-related settings from a YAML file. It initialises attributes for available vaccines and vaccination campaigns.
Source code in june/epidemiology/infection/disease_config.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
get_vaccination_campaigns()
Retrieve all vaccination campaigns.
Returns:
Type | Description |
---|---|
dict
|
A dictionary of vaccination campaigns. |
Source code in june/epidemiology/infection/disease_config.py
407 408 409 410 411 412 413 414 415 |
|
get_vaccines()
Retrieve all vaccines.
Returns:
Type | Description |
---|---|
dict
|
A dictionary of vaccines. |
Source code in june/epidemiology/infection/disease_config.py
397 398 399 400 401 402 403 404 405 |
|
get_nested_key(data, keys, default=None)
Retrieve the value from a nested dictionary using a list of keys.
This function iteratively traverses a dictionary using the provided list of keys to access nested values. If a key is missing at any level, the function returns the specified default value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict
|
The dictionary to traverse. |
required |
keys
|
list[str]
|
A list of keys representing the path to the desired value. |
required |
default
|
any
|
The value to return if any key in the path is missing (default is None). |
None
|
Returns:
Type | Description |
---|---|
any
|
The value from the nested dictionary if all keys exist, otherwise the specified default value. |
Source code in june/epidemiology/infection/disease_config.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
load_yaml(file_path)
Utility function to load a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
Path
|
The path to the YAML file. |
required |
Returns:
Type | Description |
---|---|
dict
|
The contents of the YAML file as a dictionary. |
Source code in june/epidemiology/infection/disease_config.py
21 22 23 24 25 26 27 28 29 30 31 32 |
|