vivarium-public-health 3.0.3__py3-none-any.whl → 3.0.5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vivarium_public_health/_version.py +1 -1
- vivarium_public_health/disease/state.py +24 -19
- vivarium_public_health/mslt/delay.py +13 -5
- vivarium_public_health/mslt/disease.py +35 -14
- vivarium_public_health/mslt/intervention.py +12 -9
- vivarium_public_health/mslt/observer.py +56 -17
- vivarium_public_health/mslt/population.py +7 -10
- vivarium_public_health/plugins/parser.py +29 -80
- vivarium_public_health/population/add_new_birth_cohorts.py +8 -9
- vivarium_public_health/population/base_population.py +0 -5
- vivarium_public_health/population/data_transformations.py +1 -8
- vivarium_public_health/population/mortality.py +3 -3
- vivarium_public_health/results/columns.py +1 -1
- vivarium_public_health/results/disability.py +89 -15
- vivarium_public_health/results/disease.py +128 -5
- vivarium_public_health/results/mortality.py +82 -6
- vivarium_public_health/results/observer.py +151 -6
- vivarium_public_health/results/risk.py +66 -5
- vivarium_public_health/results/simple_cause.py +30 -5
- vivarium_public_health/results/stratification.py +39 -14
- vivarium_public_health/risks/base_risk.py +14 -16
- vivarium_public_health/risks/data_transformations.py +3 -1
- vivarium_public_health/risks/distributions.py +0 -1
- vivarium_public_health/risks/effect.py +31 -29
- vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +51 -30
- vivarium_public_health/treatment/scale_up.py +6 -10
- vivarium_public_health/treatment/therapeutic_inertia.py +3 -1
- {vivarium_public_health-3.0.3.dist-info → vivarium_public_health-3.0.5.dist-info}/METADATA +1 -1
- vivarium_public_health-3.0.5.dist-info/RECORD +49 -0
- {vivarium_public_health-3.0.3.dist-info → vivarium_public_health-3.0.5.dist-info}/WHEEL +1 -1
- vivarium_public_health-3.0.3.dist-info/RECORD +0 -49
- {vivarium_public_health-3.0.3.dist-info → vivarium_public_health-3.0.5.dist-info}/LICENSE.txt +0 -0
- {vivarium_public_health-3.0.3.dist-info → vivarium_public_health-3.0.5.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
__version__ = "3.0.
|
1
|
+
__version__ = "3.0.5"
|
@@ -103,9 +103,8 @@ class BaseDiseaseState(State):
|
|
103
103
|
----------
|
104
104
|
index
|
105
105
|
An iterable of integer labels for the simulants.
|
106
|
-
event_time
|
106
|
+
event_time
|
107
107
|
The time at which this transition occurs.
|
108
|
-
|
109
108
|
"""
|
110
109
|
pop = self.population_view.get(index)
|
111
110
|
pop[self.event_time_column] = event_time
|
@@ -141,13 +140,13 @@ class BaseDiseaseState(State):
|
|
141
140
|
The end state after the transition.
|
142
141
|
|
143
142
|
get_data_functions
|
144
|
-
|
143
|
+
Map from transition type to the function to pull that transition's data.
|
145
144
|
triggered
|
145
|
+
The trigger for the transition
|
146
146
|
|
147
147
|
|
148
148
|
Returns
|
149
149
|
-------
|
150
|
-
RateTransition
|
151
150
|
The created transition object.
|
152
151
|
"""
|
153
152
|
transition = RateTransition(self, output, get_data_functions, triggered)
|
@@ -157,7 +156,7 @@ class BaseDiseaseState(State):
|
|
157
156
|
def add_proportion_transition(
|
158
157
|
self,
|
159
158
|
output: "BaseDiseaseState",
|
160
|
-
get_data_functions: Dict[str, Callable] = None,
|
159
|
+
get_data_functions: Optional[Dict[str, Callable]] = None,
|
161
160
|
triggered=Trigger.NOT_TRIGGERED,
|
162
161
|
) -> ProportionTransition:
|
163
162
|
"""Builds a ProportionTransition from this state to the given state.
|
@@ -166,13 +165,13 @@ class BaseDiseaseState(State):
|
|
166
165
|
----------
|
167
166
|
output
|
168
167
|
The end state after the transition.
|
169
|
-
|
170
168
|
get_data_functions
|
171
|
-
|
169
|
+
Map from transition type to the function to pull that transition's data.
|
170
|
+
triggered
|
171
|
+
The trigger for the transition.
|
172
172
|
|
173
173
|
Returns
|
174
174
|
-------
|
175
|
-
RateTransition
|
176
175
|
The created transition object.
|
177
176
|
"""
|
178
177
|
if "proportion" not in get_data_functions:
|
@@ -302,8 +301,8 @@ class DiseaseState(BaseDiseaseState):
|
|
302
301
|
allow_self_transition: bool = False,
|
303
302
|
side_effect_function: Optional[Callable] = None,
|
304
303
|
cause_type: str = "cause",
|
305
|
-
get_data_functions: Dict[str, Callable] = None,
|
306
|
-
cleanup_function: Callable = None,
|
304
|
+
get_data_functions: Optional[Dict[str, Callable]] = None,
|
305
|
+
cleanup_function: Optional[Callable] = None,
|
307
306
|
):
|
308
307
|
"""
|
309
308
|
Parameters
|
@@ -312,14 +311,16 @@ class DiseaseState(BaseDiseaseState):
|
|
312
311
|
The name of this state.
|
313
312
|
allow_self_transition
|
314
313
|
Whether this state allows simulants to remain in the state for
|
315
|
-
multiple time-steps
|
314
|
+
multiple time-steps.
|
316
315
|
side_effect_function
|
317
316
|
A function to be called when this state is entered.
|
318
317
|
cause_type
|
319
318
|
The type of cause represented by this state. Either "cause" or "sequela".
|
320
319
|
get_data_functions
|
321
320
|
A dictionary containing a mapping to functions to retrieve data for
|
322
|
-
various state attributes
|
321
|
+
various state attributes.
|
322
|
+
cleanup_function
|
323
|
+
The cleanup function.
|
323
324
|
"""
|
324
325
|
super().__init__(
|
325
326
|
state_id,
|
@@ -344,7 +345,7 @@ class DiseaseState(BaseDiseaseState):
|
|
344
345
|
|
345
346
|
Parameters
|
346
347
|
----------
|
347
|
-
builder
|
348
|
+
builder
|
348
349
|
Interface to several simulation tools.
|
349
350
|
"""
|
350
351
|
super().setup(builder)
|
@@ -506,9 +507,9 @@ class DiseaseState(BaseDiseaseState):
|
|
506
507
|
----------
|
507
508
|
index
|
508
509
|
An iterable of integer labels for the simulants.
|
509
|
-
event_time
|
510
|
+
event_time
|
510
511
|
The time at which this transition occurs.
|
511
|
-
population_view
|
512
|
+
population_view
|
512
513
|
A view of the internal state of the simulation.
|
513
514
|
"""
|
514
515
|
eligible_index = self._filter_for_transition_eligibility(index, event_time)
|
@@ -528,7 +529,6 @@ class DiseaseState(BaseDiseaseState):
|
|
528
529
|
|
529
530
|
Returns
|
530
531
|
-------
|
531
|
-
`pandas.Series`
|
532
532
|
An iterable of disability weights indexed by the provided `index`.
|
533
533
|
"""
|
534
534
|
disability_weight = pd.Series(0.0, index=index)
|
@@ -555,8 +555,12 @@ class DiseaseState(BaseDiseaseState):
|
|
555
555
|
----------
|
556
556
|
index
|
557
557
|
An iterable of integer labels for the simulants.
|
558
|
-
rates_df
|
558
|
+
rates_df
|
559
|
+
A DataFrame of mortality rates.
|
559
560
|
|
561
|
+
Returns
|
562
|
+
-------
|
563
|
+
The modified DataFrame of mortality rates.
|
560
564
|
"""
|
561
565
|
rate = self.excess_mortality_rate(index, skip_post_processor=True)
|
562
566
|
rates_df[self.state_id] = rate
|
@@ -599,17 +603,18 @@ class DiseaseState(BaseDiseaseState):
|
|
599
603
|
infected_at = current_time - pd.to_timedelta(infected_at, unit="D")
|
600
604
|
return infected_at
|
601
605
|
|
602
|
-
def _filter_for_transition_eligibility(self, index, event_time):
|
606
|
+
def _filter_for_transition_eligibility(self, index, event_time) -> pd.Index:
|
603
607
|
"""Filter out all simulants who haven't been in the state for the prescribed dwell time.
|
604
608
|
|
605
609
|
Parameters
|
606
610
|
----------
|
607
611
|
index
|
608
612
|
An iterable of integer labels for the simulants.
|
613
|
+
event_time
|
614
|
+
The time at which this transition occurs.
|
609
615
|
|
610
616
|
Returns
|
611
617
|
-------
|
612
|
-
pd.Index
|
613
618
|
A filtered index of the simulants.
|
614
619
|
"""
|
615
620
|
population = self.population_view.get(index, query='alive == "alive"')
|
@@ -19,8 +19,7 @@ from vivarium.framework.population import SimulantData
|
|
19
19
|
|
20
20
|
|
21
21
|
class DelayedRisk(Component):
|
22
|
-
"""
|
23
|
-
A delayed risk represents an exposure whose impact takes time to come into
|
22
|
+
"""A delayed risk represents an exposure whose impact takes time to come into
|
24
23
|
effect (e.g., smoking uptake and cessation).
|
25
24
|
|
26
25
|
The data required by this component are:
|
@@ -320,8 +319,7 @@ class DelayedRisk(Component):
|
|
320
319
|
########################
|
321
320
|
|
322
321
|
def on_initialize_simulants(self, pop_data: SimulantData) -> None:
|
323
|
-
"""
|
324
|
-
Define the initial distribution of the population across the bins, in
|
322
|
+
"""Define the initial distribution of the population across the bins, in
|
325
323
|
both the BAU and the intervention scenario.
|
326
324
|
"""
|
327
325
|
# Set all bins to zero, in order to create the required columns.
|
@@ -364,7 +362,6 @@ class DelayedRisk(Component):
|
|
364
362
|
- New exposures
|
365
363
|
- Cessation of exposure
|
366
364
|
- Increased duration of time since exposure
|
367
|
-
|
368
365
|
"""
|
369
366
|
if self.clock().year == self.start_year:
|
370
367
|
return
|
@@ -540,6 +537,17 @@ def pivot_load(builder: Builder, entity_key: str) -> pd.DataFrame:
|
|
540
537
|
Performs a long to wide conversion if dataframe has an index column
|
541
538
|
named 'measure'.
|
542
539
|
|
540
|
+
Parameters
|
541
|
+
----------
|
542
|
+
builder
|
543
|
+
The builder object for the simulation.
|
544
|
+
entity_key
|
545
|
+
The key for the entity to be loaded.
|
546
|
+
|
547
|
+
Returns
|
548
|
+
-------
|
549
|
+
pd.DataFrame
|
550
|
+
The loaded data and potentially pivoted data.
|
543
551
|
"""
|
544
552
|
data = builder.data.load(entity_key)
|
545
553
|
|
@@ -19,7 +19,8 @@ from vivarium.framework.population import SimulantData
|
|
19
19
|
|
20
20
|
|
21
21
|
class AcuteDisease(Component):
|
22
|
-
"""
|
22
|
+
"""This component characterises an acute disease.
|
23
|
+
|
23
24
|
An acute disease has a sufficiently short duration, relative to the
|
24
25
|
time-step size, that it is not meaningful to talk about prevalence.
|
25
26
|
Instead, it simply contributes an excess mortality rate, and/or a
|
@@ -32,10 +33,18 @@ class AcuteDisease(Component):
|
|
32
33
|
|
33
34
|
where `<disease>` is the name as provided to the constructor.
|
34
35
|
|
35
|
-
|
36
|
+
Attributes
|
36
37
|
----------
|
37
38
|
disease
|
38
39
|
The disease name (referred to as `<disease>` here).
|
40
|
+
excess_mortality
|
41
|
+
The excess mortality rate for the disease.
|
42
|
+
int_excess_mortality
|
43
|
+
The excess mortality rate for the disease in the intervention scenario.
|
44
|
+
disability_rate
|
45
|
+
The years lost due to disability (YLD) rate for the disease.
|
46
|
+
int_disability_rate
|
47
|
+
The YLD rate for the disease in the intervention scenario.
|
39
48
|
|
40
49
|
"""
|
41
50
|
|
@@ -77,16 +86,14 @@ class AcuteDisease(Component):
|
|
77
86
|
##################################
|
78
87
|
|
79
88
|
def mortality_adjustment(self, index, mortality_rate):
|
80
|
-
"""
|
81
|
-
Adjust the all-cause mortality rate in the intervention scenario, to
|
89
|
+
"""Adjust the all-cause mortality rate in the intervention scenario, to
|
82
90
|
account for any change in prevalence (relative to the BAU scenario).
|
83
91
|
"""
|
84
92
|
delta = self.int_excess_mortality(index) - self.excess_mortality(index)
|
85
93
|
return mortality_rate + delta
|
86
94
|
|
87
95
|
def disability_adjustment(self, index, yld_rate):
|
88
|
-
"""
|
89
|
-
Adjust the years lost due to disability (YLD) rate in the intervention
|
96
|
+
"""Adjust the years lost due to disability (YLD) rate in the intervention
|
90
97
|
scenario, to account for any change in prevalence (relative to the BAU
|
91
98
|
scenario).
|
92
99
|
"""
|
@@ -106,10 +113,28 @@ class Disease(Component):
|
|
106
113
|
|
107
114
|
where `<disease>` is the name as provided to the constructor.
|
108
115
|
|
109
|
-
|
116
|
+
Attributes
|
110
117
|
----------
|
111
118
|
disease
|
112
119
|
The disease name (referred to as `<disease>` here).
|
120
|
+
clock
|
121
|
+
The simulation clock.
|
122
|
+
start_year
|
123
|
+
The simulation start year.
|
124
|
+
simplified_equations
|
125
|
+
Whether to use simplified equations for the disease model.
|
126
|
+
incidence
|
127
|
+
The incidence rate for the disease.
|
128
|
+
incidence_intervention
|
129
|
+
The incidence rate for the disease in the intervention scenario.
|
130
|
+
remission
|
131
|
+
The remission rate for the disease.
|
132
|
+
excess_mortality
|
133
|
+
The excess mortality rate for the disease.
|
134
|
+
disability_rate
|
135
|
+
The years lost due to disability (YLD) rate for the disease.
|
136
|
+
initial_prevalence
|
137
|
+
The initial prevalence of the disease.
|
113
138
|
|
114
139
|
"""
|
115
140
|
|
@@ -231,9 +256,7 @@ class Disease(Component):
|
|
231
256
|
self.population_view.update(pop)
|
232
257
|
|
233
258
|
def on_time_step_prepare(self, event: Event) -> None:
|
234
|
-
"""
|
235
|
-
Update the disease status for both the BAU and intervention scenarios.
|
236
|
-
"""
|
259
|
+
"""Update the disease status for both the BAU and intervention scenarios."""
|
237
260
|
# Do not update the disease status in the first year, the initial data
|
238
261
|
# describe the disease state at the end of the year.
|
239
262
|
if self.clock().year == self.start_year:
|
@@ -356,8 +379,7 @@ class Disease(Component):
|
|
356
379
|
##################################
|
357
380
|
|
358
381
|
def mortality_adjustment(self, index, mortality_rate):
|
359
|
-
"""
|
360
|
-
Adjust the all-cause mortality rate in the intervention scenario, to
|
382
|
+
"""Adjust the all-cause mortality rate in the intervention scenario, to
|
361
383
|
account for any change in disease prevalence (relative to the BAU
|
362
384
|
scenario).
|
363
385
|
"""
|
@@ -387,8 +409,7 @@ class Disease(Component):
|
|
387
409
|
return mortality_rate + delta
|
388
410
|
|
389
411
|
def disability_adjustment(self, index, yld_rate):
|
390
|
-
"""
|
391
|
-
Adjust the years lost due to disability (YLD) rate in the intervention
|
412
|
+
"""Adjust the years lost due to disability (YLD) rate in the intervention
|
392
413
|
scenario, to account for any change in disease prevalence (relative to
|
393
414
|
the BAU scenario).
|
394
415
|
"""
|
@@ -100,9 +100,9 @@ class ModifyDiseaseRate(Component):
|
|
100
100
|
|
101
101
|
|
102
102
|
class ModifyDiseaseIncidence(ModifyDiseaseRate):
|
103
|
-
"""
|
104
|
-
Interventions that modify a disease incidence rate, based on a PIF lookup
|
103
|
+
"""Interventions that modify a disease incidence rate, based on a PIF lookup
|
105
104
|
table.
|
105
|
+
|
106
106
|
"""
|
107
107
|
|
108
108
|
def __init__(self, intervention: str, disease: str):
|
@@ -110,9 +110,9 @@ class ModifyDiseaseIncidence(ModifyDiseaseRate):
|
|
110
110
|
|
111
111
|
|
112
112
|
class ModifyDiseaseMortality(ModifyDiseaseRate):
|
113
|
-
"""
|
114
|
-
Interventions that modify a disease fatality rate, based on a PIF lookup
|
113
|
+
"""Interventions that modify a disease fatality rate, based on a PIF lookup
|
115
114
|
table.
|
115
|
+
|
116
116
|
"""
|
117
117
|
|
118
118
|
def __init__(self, intervention: str, disease: str):
|
@@ -120,9 +120,9 @@ class ModifyDiseaseMortality(ModifyDiseaseRate):
|
|
120
120
|
|
121
121
|
|
122
122
|
class ModifyDiseaseMorbidity(ModifyDiseaseRate):
|
123
|
-
"""
|
124
|
-
Interventions that modify a disease disability rate, based on a PIF lookup
|
123
|
+
"""Interventions that modify a disease disability rate, based on a PIF lookup
|
125
124
|
table.
|
125
|
+
|
126
126
|
"""
|
127
127
|
|
128
128
|
def __init__(self, intervention: str, disease: str):
|
@@ -130,10 +130,13 @@ class ModifyDiseaseMorbidity(ModifyDiseaseRate):
|
|
130
130
|
|
131
131
|
|
132
132
|
class ModifyAcuteDiseaseIncidence(Component):
|
133
|
-
"""
|
134
|
-
|
135
|
-
|
133
|
+
"""Interventions that modify an acute disease incidence rate.
|
134
|
+
|
135
|
+
Notes
|
136
|
+
-----
|
137
|
+
This intervention will simply modify both the disability rate
|
136
138
|
and the mortality rate for the chosen acute disease.
|
139
|
+
|
137
140
|
"""
|
138
141
|
|
139
142
|
##############
|
@@ -16,9 +16,8 @@ from vivarium.framework.engine import Builder
|
|
16
16
|
from vivarium.framework.event import Event
|
17
17
|
|
18
18
|
|
19
|
-
def output_file(config, suffix, sep="_", ext="csv"):
|
20
|
-
"""
|
21
|
-
Determine the output file name for an observer, based on the prefix
|
19
|
+
def output_file(config, suffix, sep="_", ext="csv") -> str:
|
20
|
+
"""Determine the output file name for an observer, based on the prefix
|
22
21
|
defined in ``config.observer.output_prefix`` and the (optional)
|
23
22
|
``config.input_data.input_draw_number``.
|
24
23
|
|
@@ -33,6 +32,9 @@ def output_file(config, suffix, sep="_", ext="csv"):
|
|
33
32
|
ext
|
34
33
|
The output file extension.
|
35
34
|
|
35
|
+
Returns
|
36
|
+
-------
|
37
|
+
The output file name for the observer.
|
36
38
|
"""
|
37
39
|
if "observer" not in config:
|
38
40
|
raise ValueError("observer.output_prefix not defined")
|
@@ -51,16 +53,22 @@ def output_file(config, suffix, sep="_", ext="csv"):
|
|
51
53
|
|
52
54
|
|
53
55
|
class MorbidityMortality(Component):
|
54
|
-
"""
|
55
|
-
This class records the all-cause morbidity and mortality rates for each
|
56
|
+
"""This class records the all-cause morbidity and mortality rates for each
|
56
57
|
cohort at each year of the simulation.
|
57
58
|
|
58
|
-
|
59
|
+
Attributes
|
59
60
|
----------
|
60
61
|
output_suffix
|
61
62
|
The suffix for the CSV file in which to record the
|
62
63
|
morbidity and mortality data.
|
63
|
-
|
64
|
+
clock
|
65
|
+
The simulation clock.
|
66
|
+
tables
|
67
|
+
The tables of morbidity and mortality data.
|
68
|
+
table_cols
|
69
|
+
The columns in the tables.
|
70
|
+
output_file
|
71
|
+
The output file for the morbidity and mortality data.
|
64
72
|
"""
|
65
73
|
|
66
74
|
##############
|
@@ -148,7 +156,7 @@ class MorbidityMortality(Component):
|
|
148
156
|
# Helper methods #
|
149
157
|
##################
|
150
158
|
|
151
|
-
def calculate_LE(self, table, py_col, denom_col):
|
159
|
+
def calculate_LE(self, table, py_col, denom_col) -> pd.Series:
|
152
160
|
"""Calculate the life expectancy for each cohort at each time-step.
|
153
161
|
|
154
162
|
Parameters
|
@@ -162,9 +170,7 @@ class MorbidityMortality(Component):
|
|
162
170
|
|
163
171
|
Returns
|
164
172
|
-------
|
165
|
-
The life expectancy for each table row
|
166
|
-
pandas.Series object.
|
167
|
-
|
173
|
+
The life expectancy for each table row.
|
168
174
|
"""
|
169
175
|
# Group the person-years by cohort.
|
170
176
|
group_cols = ["year_of_birth", "sex"]
|
@@ -180,17 +186,36 @@ class MorbidityMortality(Component):
|
|
180
186
|
|
181
187
|
|
182
188
|
class Disease(Component):
|
183
|
-
"""
|
184
|
-
This class records the disease incidence rate and disease prevalence for
|
189
|
+
"""This class records the disease incidence rate and disease prevalence for
|
185
190
|
each cohort at each year of the simulation.
|
186
191
|
|
187
|
-
|
192
|
+
Attributes
|
188
193
|
----------
|
189
194
|
disease
|
190
195
|
The name of the chronic disease.
|
191
196
|
output_suffix
|
192
197
|
The suffix for the CSV file in which to record the
|
193
198
|
disease data.
|
199
|
+
bau_S_col
|
200
|
+
The name of the BAU susceptible column.
|
201
|
+
bau_C_col
|
202
|
+
The name of the BAU chronic column.
|
203
|
+
int_S_col
|
204
|
+
The name of the intervention susceptible column.
|
205
|
+
int_C_col
|
206
|
+
The name of the intervention chronic column.
|
207
|
+
bau_incidence
|
208
|
+
The incidence rate for the BAU scenario.
|
209
|
+
int_incidence
|
210
|
+
The incidence rate for the intervention scenario.
|
211
|
+
tables
|
212
|
+
The tables of disease data.
|
213
|
+
table_cols
|
214
|
+
The columns in the tables.
|
215
|
+
clock
|
216
|
+
The simulation clock.
|
217
|
+
output_file
|
218
|
+
The output file for the disease data.
|
194
219
|
|
195
220
|
"""
|
196
221
|
|
@@ -286,12 +311,23 @@ class Disease(Component):
|
|
286
311
|
class TobaccoPrevalence(Component):
|
287
312
|
"""This class records the prevalence of tobacco use in the population.
|
288
313
|
|
289
|
-
|
314
|
+
Attributes
|
290
315
|
----------
|
291
316
|
output_suffix
|
292
317
|
The suffix for the CSV file in which to record the
|
293
318
|
prevalence data.
|
294
|
-
|
319
|
+
config
|
320
|
+
The builder configuration object.
|
321
|
+
clock
|
322
|
+
The simulation clock.
|
323
|
+
bin_years
|
324
|
+
The number of years post-exposure to consider.
|
325
|
+
tables
|
326
|
+
The tables of tobacco prevalence data.
|
327
|
+
table_cols
|
328
|
+
The columns in the tables.
|
329
|
+
output_file
|
330
|
+
The output file for the tobacco prevalence data.
|
295
331
|
"""
|
296
332
|
|
297
333
|
##############
|
@@ -339,7 +375,7 @@ class TobaccoPrevalence(Component):
|
|
339
375
|
# Setup methods #
|
340
376
|
#################
|
341
377
|
|
342
|
-
def get_bin_names(self):
|
378
|
+
def get_bin_names(self) -> list[str]:
|
343
379
|
"""Return the bin names for both the BAU and the intervention scenario.
|
344
380
|
|
345
381
|
These names take the following forms:
|
@@ -356,6 +392,9 @@ class TobaccoPrevalence(Component):
|
|
356
392
|
|
357
393
|
The intervention bin names take the form ``"name_intervention.X"``.
|
358
394
|
|
395
|
+
Returns
|
396
|
+
-------
|
397
|
+
The bin names for tobacco use.
|
359
398
|
"""
|
360
399
|
if self.bin_years == 0:
|
361
400
|
delay_bins = [str(0)]
|
@@ -19,8 +19,7 @@ from vivarium.framework.population import SimulantData
|
|
19
19
|
|
20
20
|
|
21
21
|
class BasePopulation(Component):
|
22
|
-
"""
|
23
|
-
This component implements the core population demographics: age, sex,
|
22
|
+
"""This component implements the core population demographics: age, sex,
|
24
23
|
population size.
|
25
24
|
|
26
25
|
The configuration options for this component are:
|
@@ -113,9 +112,9 @@ class BasePopulation(Component):
|
|
113
112
|
|
114
113
|
|
115
114
|
class Mortality(Component):
|
116
|
-
"""
|
117
|
-
This component reduces the population size of each cohort over time,
|
115
|
+
"""This component reduces the population size of each cohort over time,
|
118
116
|
according to the all-cause mortality rate.
|
117
|
+
|
119
118
|
"""
|
120
119
|
|
121
120
|
##############
|
@@ -156,8 +155,7 @@ class Mortality(Component):
|
|
156
155
|
########################
|
157
156
|
|
158
157
|
def on_time_step(self, event: Event) -> None:
|
159
|
-
"""
|
160
|
-
Calculate the number of deaths and survivors at each time-step, for
|
158
|
+
"""Calculate the number of deaths and survivors at each time-step, for
|
161
159
|
both the BAU and intervention scenarios.
|
162
160
|
"""
|
163
161
|
pop = self.population_view.get(event.index)
|
@@ -181,10 +179,10 @@ class Mortality(Component):
|
|
181
179
|
|
182
180
|
|
183
181
|
class Disability(Component):
|
184
|
-
"""
|
185
|
-
This component calculates the health-adjusted life years (HALYs) for each
|
182
|
+
"""This component calculates the health-adjusted life years (HALYs) for each
|
186
183
|
cohort over time, according to the years lost due to disability (YLD)
|
187
184
|
rate.
|
185
|
+
|
188
186
|
"""
|
189
187
|
|
190
188
|
##############
|
@@ -219,8 +217,7 @@ class Disability(Component):
|
|
219
217
|
########################
|
220
218
|
|
221
219
|
def on_time_step(self, event: Event) -> None:
|
222
|
-
"""
|
223
|
-
Calculate the HALYs for each cohort at each time-step, for both the
|
220
|
+
"""Calculate the HALYs for each cohort at each time-step, for both the
|
224
221
|
BAU and intervention scenarios.
|
225
222
|
"""
|
226
223
|
pop = self.population_view.get(event.index)
|