vivarium-public-health 2.3.0__py3-none-any.whl → 2.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- __version__ = "2.3.0"
1
+ __version__ = "2.3.2"
@@ -85,8 +85,9 @@ class BaseDiseaseState(State):
85
85
  def get_initialization_parameters(self) -> Dict[str, Any]:
86
86
  """Exclude side effect function and cause type from name and __repr__."""
87
87
  initialization_parameters = super().get_initialization_parameters()
88
- del initialization_parameters["side_effect_function"]
89
- del initialization_parameters["cause_type"]
88
+ for key in ["side_effect_function", "cause_type"]:
89
+ if key in initialization_parameters.keys():
90
+ del initialization_parameters[key]
90
91
  return initialization_parameters
91
92
 
92
93
  def get_initial_event_times(self, pop_data: SimulantData) -> pd.DataFrame:
@@ -54,6 +54,17 @@ class MortalityObserver(Component):
54
54
  }
55
55
  }
56
56
 
57
+ def __init__(self):
58
+ super().__init__()
59
+ self.causes_of_death = ["other_causes"]
60
+ self.required_death_columns = ["alive", "exit_time"]
61
+ self.required_yll_columns = [
62
+ "alive",
63
+ "cause_of_death",
64
+ "exit_time",
65
+ "years_of_life_lost",
66
+ ]
67
+
57
68
  ##############
58
69
  # Properties #
59
70
  ##############
@@ -75,17 +86,14 @@ class MortalityObserver(Component):
75
86
  def setup(self, builder: Builder) -> None:
76
87
  self.clock = builder.time.clock()
77
88
  self.config = builder.configuration.stratification.mortality
78
- self._cause_components = builder.components.get_components_by_type(
89
+ cause_components = builder.components.get_components_by_type(
79
90
  (DiseaseState, RiskAttributableDisease)
80
91
  )
81
-
92
+ self.causes_of_death += [
93
+ cause.state_id for cause in cause_components if cause.has_excess_mortality
94
+ ]
82
95
  if not self.config.aggregate:
83
- causes_of_death = ["other_causes"] + [
84
- cause.state_id
85
- for cause in self._cause_components
86
- if cause.has_excess_mortality
87
- ]
88
- for cause_of_death in causes_of_death:
96
+ for cause_of_death in self.causes_of_death:
89
97
  self._register_mortality_observations(
90
98
  builder, cause_of_death, f'cause_of_death == "{cause_of_death}"'
91
99
  )
@@ -100,15 +108,15 @@ class MortalityObserver(Component):
100
108
  self, builder: Builder, cause: str, additional_pop_filter: str = ""
101
109
  ) -> None:
102
110
  pop_filter = (
103
- 'alive == "dead"'
111
+ 'alive == "dead" and tracked == True'
104
112
  if additional_pop_filter == ""
105
- else f'alive == "dead" and {additional_pop_filter}'
113
+ else f'alive == "dead" and tracked == True and {additional_pop_filter}'
106
114
  )
107
115
  builder.results.register_observation(
108
116
  name=f"death_due_to_{cause}",
109
117
  pop_filter=pop_filter,
110
118
  aggregator=self.count_deaths,
111
- requires_columns=["alive", "exit_time"],
119
+ requires_columns=self.required_death_columns,
112
120
  additional_stratifications=self.config.include,
113
121
  excluded_stratifications=self.config.exclude,
114
122
  when="collect_metrics",
@@ -117,12 +125,7 @@ class MortalityObserver(Component):
117
125
  name=f"ylls_due_to_{cause}",
118
126
  pop_filter=pop_filter,
119
127
  aggregator=self.calculate_ylls,
120
- requires_columns=[
121
- "alive",
122
- "cause_of_death",
123
- "exit_time",
124
- "years_of_life_lost",
125
- ],
128
+ requires_columns=self.required_yll_columns,
126
129
  additional_stratifications=self.config.include,
127
130
  excluded_stratifications=self.config.exclude,
128
131
  when="collect_metrics",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium_public_health
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: Components for modelling diseases, risks, and interventions with ``vivarium``
5
5
  Home-page: https://github.com/ihmeuw/vivarium_public_health
6
6
  Author: The vivarium developers
@@ -1,17 +1,17 @@
1
1
  vivarium_public_health/__about__.py,sha256=RgWycPypKZS80TpSX7o41cREnG8PfguNHDHLuLyl820,487
2
2
  vivarium_public_health/__init__.py,sha256=tomMOl3PI7O8GdxDWGBiBjT0Bwd31GpyQTYTzwIv108,361
3
- vivarium_public_health/_version.py,sha256=CpK8IH_dCUAwg9tqv7zm9FxbBFkxCnED1JUiRe7cftU,22
3
+ vivarium_public_health/_version.py,sha256=J4CRnpR3v72FGOMp8gqSua_XWZpAfXuqgVWiQFB-gTY,22
4
4
  vivarium_public_health/utilities.py,sha256=_X9sZQ7flsi2sVWQ9zrf8GJw8QwZsPZm3NUjx1gu7bM,2555
5
5
  vivarium_public_health/disease/__init__.py,sha256=RuuiRcvAJfX9WQGt_WZZjxN7Cu3E5rMTmuaRS-UaFPM,419
6
6
  vivarium_public_health/disease/model.py,sha256=9Ru3mg3UUp3h1W0y-1xkWjQBgxqSq-LXM0ByiEcNmGA,8332
7
7
  vivarium_public_health/disease/models.py,sha256=uiB2qUlxBsPPPmHJ8Cgot_T1ItZ8RYSNVOBtxtn93Y0,3478
8
8
  vivarium_public_health/disease/special_disease.py,sha256=gl8aK0z6afCxiCZxgJafLe4xmbR91zk3079hsi2pUAw,14751
9
- vivarium_public_health/disease/state.py,sha256=83GRVyioDofeN396tJ3a5_XVH6X57OccZqLdaWKWiHY,24785
9
+ vivarium_public_health/disease/state.py,sha256=wTSiWKXgJ4k9kr0p8oC3gAHil0-zQPOifNoBftHnTRw,24837
10
10
  vivarium_public_health/disease/transition.py,sha256=Or5nucRzeGG-UuE_CGkPZ9qE35-Ed9I9LWHj4rjknCc,5334
11
11
  vivarium_public_health/metrics/__init__.py,sha256=bWAvvdCm_7RPIazo12qFohA2x5-_EV6ceV8IhKS37sk,209
12
12
  vivarium_public_health/metrics/disability.py,sha256=zm0vAG00wj44CHjYGdT2_pebgARa3XXIerrR06t80rc,3984
13
13
  vivarium_public_health/metrics/disease.py,sha256=_WQYjd6FRrxRs1Oj8NR9ZmcbXVvsHqX_hods10hwHzU,4546
14
- vivarium_public_health/metrics/mortality.py,sha256=Um29BnDPojr2K-9Zy5mrGxmX6RPnLncmvkrbaxz3b64,4643
14
+ vivarium_public_health/metrics/mortality.py,sha256=B1AX-N4aO1Jd2NEJ_yMC1NHaDr4pEXmQxNm5kXoLz8w,4826
15
15
  vivarium_public_health/metrics/risk.py,sha256=ANwgwpasX-5t0OHMQysV8p_cM86NL2bV6za1FM0JR88,3201
16
16
  vivarium_public_health/metrics/stratification.py,sha256=_ChQy8yeP09wFKne4UPPiUEfCKDM6UGfHl4moKCjoNQ,4612
17
17
  vivarium_public_health/mslt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -42,8 +42,8 @@ vivarium_public_health/treatment/__init__.py,sha256=wONElu9aJbBYwpYIovYPYaN_GYfV
42
42
  vivarium_public_health/treatment/magic_wand.py,sha256=iPKFN3VjfiMy_XvN94UqM-FUrGuI0ULwmOdAGdOepYQ,1979
43
43
  vivarium_public_health/treatment/scale_up.py,sha256=EkuEAmKaW7AvPWDqDa9WJ2Iy_yiKFytsJu8HVli5Lrg,7078
44
44
  vivarium_public_health/treatment/therapeutic_inertia.py,sha256=VwZ7t90zzfGoBusduIvcE4lDe5zTvzmHiUNB3u2I52Y,2339
45
- vivarium_public_health-2.3.0.dist-info/LICENSE.txt,sha256=mN4bNLUQNcN9njYRc_3jCZkfPySVpmM6MRps104FxA4,1548
46
- vivarium_public_health-2.3.0.dist-info/METADATA,sha256=cenPaCk9zKdjvDxbdF3eC2N877KFTelGRVLLjQUcSdY,3590
47
- vivarium_public_health-2.3.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
- vivarium_public_health-2.3.0.dist-info/top_level.txt,sha256=VVInlpzCFD0UNNhjOq_j-a29odzjwUwYFTGfvqbi4dY,23
49
- vivarium_public_health-2.3.0.dist-info/RECORD,,
45
+ vivarium_public_health-2.3.2.dist-info/LICENSE.txt,sha256=mN4bNLUQNcN9njYRc_3jCZkfPySVpmM6MRps104FxA4,1548
46
+ vivarium_public_health-2.3.2.dist-info/METADATA,sha256=UWxOYZMSTZHmUbO4DQhLZ4maatsr-kGX_1Paks8518Q,3590
47
+ vivarium_public_health-2.3.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
48
+ vivarium_public_health-2.3.2.dist-info/top_level.txt,sha256=VVInlpzCFD0UNNhjOq_j-a29odzjwUwYFTGfvqbi4dY,23
49
+ vivarium_public_health-2.3.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5