vivarium-public-health 2.0.2__tar.gz → 2.1.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.github/workflows/build.yml +1 -1
  2. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/CHANGELOG.rst +4 -0
  3. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/PKG-INFO +1 -1
  4. vivarium_public_health-2.1.1/src/vivarium_public_health/_version.py +1 -0
  5. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/disease/state.py +83 -40
  6. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health.egg-info/PKG-INFO +1 -1
  7. vivarium_public_health-2.0.2/src/vivarium_public_health/_version.py +0 -1
  8. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.gitattributes +0 -0
  9. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.github/CODEOWNERS +0 -0
  10. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.github/pull_request_template.md +0 -0
  11. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.github/workflows/deploy.yml +0 -0
  12. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.gitignore +0 -0
  13. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.pylintrc +0 -0
  14. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.readthedocs.yml +0 -0
  15. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/.zenodo.json +0 -0
  16. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/CODE_OF_CONDUCT.rst +0 -0
  17. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/CONTRIBUTING.rst +0 -0
  18. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/LICENSE.txt +0 -0
  19. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/MANIFEST.in +0 -0
  20. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/README.rst +0 -0
  21. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/Makefile +0 -0
  22. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/nitpick-exceptions +0 -0
  23. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/_static/style.css +0 -0
  24. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/_templates/layout.html +0 -0
  25. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/disease/index.rst +0 -0
  26. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/disease/model.rst +0 -0
  27. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/disease/models.rst +0 -0
  28. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/disease/special_disease.rst +0 -0
  29. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/disease/state.rst +0 -0
  30. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/disease/transition.rst +0 -0
  31. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/index.rst +0 -0
  32. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/metrics/disability.rst +0 -0
  33. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/metrics/disease.rst +0 -0
  34. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/metrics/index.rst +0 -0
  35. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/metrics/mortality.rst +0 -0
  36. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/metrics/risk.rst +0 -0
  37. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/metrics/stratification.rst +0 -0
  38. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/delay.rst +0 -0
  39. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/disease.rst +0 -0
  40. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/index.rst +0 -0
  41. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/intervention.rst +0 -0
  42. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/magic_wand_components.rst +0 -0
  43. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/observer.rst +0 -0
  44. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/mslt/population.rst +0 -0
  45. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/population/add_new_birth_cohorts.rst +0 -0
  46. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/population/base_population.rst +0 -0
  47. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/population/data_transformations.rst +0 -0
  48. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/population/index.rst +0 -0
  49. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/population/mortality.rst +0 -0
  50. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/base_risk.rst +0 -0
  51. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/data_transformations.rst +0 -0
  52. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/distributions.rst +0 -0
  53. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/effect.rst +0 -0
  54. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/implementations/index.rst +0 -0
  55. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/implementations/low_birth_weight_and_short_gestation.rst +0 -0
  56. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/risks/index.rst +0 -0
  57. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/testing/index.rst +0 -0
  58. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/testing/mock_artifact.rst +0 -0
  59. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/testing/utils.rst +0 -0
  60. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/treatment/index.rst +0 -0
  61. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/treatment/magic_wand.rst +0 -0
  62. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/treatment/scale_up.rst +0 -0
  63. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/treatment/therapeutic_inertia.rst +0 -0
  64. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/api_reference/utilities.rst +0 -0
  65. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/conf.py +0 -0
  66. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/index.rst +0 -0
  67. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/tutorials/index.rst +0 -0
  68. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/docs/source/tutorials/risk_exposure.rst +0 -0
  69. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/pyproject.toml +0 -0
  70. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/setup.cfg +0 -0
  71. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/setup.py +0 -0
  72. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/__about__.py +0 -0
  73. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/__init__.py +0 -0
  74. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/disease/__init__.py +0 -0
  75. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/disease/model.py +0 -0
  76. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/disease/models.py +0 -0
  77. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/disease/special_disease.py +0 -0
  78. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/disease/transition.py +0 -0
  79. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/metrics/__init__.py +0 -0
  80. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/metrics/disability.py +0 -0
  81. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/metrics/disease.py +0 -0
  82. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/metrics/mortality.py +0 -0
  83. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/metrics/risk.py +0 -0
  84. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/metrics/stratification.py +0 -0
  85. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/__init__.py +0 -0
  86. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/delay.py +0 -0
  87. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/disease.py +0 -0
  88. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/intervention.py +0 -0
  89. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/magic_wand_components.py +0 -0
  90. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/observer.py +0 -0
  91. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/mslt/population.py +0 -0
  92. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/population/__init__.py +0 -0
  93. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/population/add_new_birth_cohorts.py +0 -0
  94. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/population/base_population.py +0 -0
  95. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/population/data_transformations.py +0 -0
  96. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/population/mortality.py +0 -0
  97. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/__init__.py +0 -0
  98. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/base_risk.py +0 -0
  99. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/data_transformations.py +0 -0
  100. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/distributions.py +0 -0
  101. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/effect.py +0 -0
  102. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/implementations/__init__.py +0 -0
  103. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +0 -0
  104. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/testing/__init__.py +0 -0
  105. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/testing/mock_artifact.py +0 -0
  106. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/testing/utils.py +0 -0
  107. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/treatment/__init__.py +0 -0
  108. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/treatment/magic_wand.py +0 -0
  109. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/treatment/scale_up.py +0 -0
  110. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/treatment/therapeutic_inertia.py +0 -0
  111. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health/utilities.py +0 -0
  112. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health.egg-info/SOURCES.txt +0 -0
  113. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health.egg-info/dependency_links.txt +0 -0
  114. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health.egg-info/not-zip-safe +0 -0
  115. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health.egg-info/requires.txt +0 -0
  116. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/src/vivarium_public_health.egg-info/top_level.txt +0 -0
  117. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/__init__.py +0 -0
  118. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/conftest.py +0 -0
  119. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/disease/__init__.py +0 -0
  120. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/disease/test_disease.py +0 -0
  121. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/disease/test_special_disease.py +0 -0
  122. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/__init__.py +0 -0
  123. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/test_categorical_risk_observer.py +0 -0
  124. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/test_disability.py +0 -0
  125. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/test_disability_observer.py +0 -0
  126. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/test_disease_observer.py +0 -0
  127. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/test_mortality_observer.py +0 -0
  128. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/metrics/test_stratification.py +0 -0
  129. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/population/__init__.py +0 -0
  130. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/population/conftest.py +0 -0
  131. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/population/test_add_new_birth_cohort.py +0 -0
  132. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/population/test_base_population.py +0 -0
  133. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/population/test_data_transformations.py +0 -0
  134. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/risks/__init__.py +0 -0
  135. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/risks/conftest.py +0 -0
  136. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/risks/test_base_risk.py +0 -0
  137. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/risks/test_data_transformations.py +0 -0
  138. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/risks/test_distributions.py +0 -0
  139. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/risks/test_effect.py +0 -0
  140. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/test_utilities.py +0 -0
  141. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tests/treatment/__init__.py +0 -0
  142. {vivarium_public_health-2.0.2 → vivarium_public_health-2.1.1}/tox.ini +0 -0
@@ -15,7 +15,7 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- python-version: ["3.9", "3.10", "3.11", "3.12"]
18
+ python-version: ["3.9", "3.10", "3.11"]
19
19
  defaults:
20
20
  run:
21
21
  shell: bash -le {0}
@@ -1,3 +1,7 @@
1
+ **2.1.1 - 10/13/23**
2
+
3
+ - Perform actions in DiseaseState setup using class methods rather than hardcoding to allow for cleaner subclassing
4
+
1
5
  **2.1.0 - 10/05/23**
2
6
 
3
7
  - Remove explicit support for Python 3.8
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium_public_health
3
- Version: 2.0.2
3
+ Version: 2.1.1
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
@@ -0,0 +1 @@
1
+ __version__ = "2.1.1"
@@ -11,10 +11,11 @@ from typing import Callable, Dict, List, Optional
11
11
  import numpy as np
12
12
  import pandas as pd
13
13
  from vivarium.framework.engine import Builder
14
- from vivarium.framework.lookup import LookupTableData
14
+ from vivarium.framework.lookup import LookupTable, LookupTableData
15
15
  from vivarium.framework.population import PopulationView, SimulantData
16
+ from vivarium.framework.randomness import RandomnessStream
16
17
  from vivarium.framework.state_machine import State, Transient, Transition, Trigger
17
- from vivarium.framework.values import list_combiner, union_post_processor
18
+ from vivarium.framework.values import Pipeline, list_combiner, union_post_processor
18
19
 
19
20
  from vivarium_public_health.disease.transition import (
20
21
  ProportionTransition,
@@ -323,65 +324,41 @@ class DiseaseState(BaseDiseaseState):
323
324
  self.clock = builder.time.clock()
324
325
 
325
326
  prevalence_data = self.load_prevalence_data(builder)
326
- self.prevalence = builder.lookup.build_table(
327
- prevalence_data, key_columns=["sex"], parameter_columns=["age", "year"]
328
- )
327
+ self.prevalence = self.get_prevalence(builder, prevalence_data)
329
328
 
330
329
  birth_prevalence_data = self.load_birth_prevalence_data(builder)
331
- self.birth_prevalence = builder.lookup.build_table(
332
- birth_prevalence_data, key_columns=["sex"], parameter_columns=["year"]
333
- )
330
+ self.birth_prevalence = self.get_birth_prevalence(builder, birth_prevalence_data)
334
331
 
335
332
  dwell_time_data = self.load_dwell_time_data(builder)
336
- self.dwell_time = builder.value.register_value_producer(
337
- f"{self.state_id}.dwell_time",
338
- source=builder.lookup.build_table(
339
- dwell_time_data, key_columns=["sex"], parameter_columns=["age", "year"]
340
- ),
341
- requires_columns=["age", "sex"],
342
- )
333
+ self.dwell_time = self.get_dwell_time_pipeline(builder, dwell_time_data)
343
334
 
344
335
  disability_weight_data = self.load_disability_weight_data(builder)
345
336
  self.has_disability = is_non_zero(disability_weight_data)
346
- self.base_disability_weight = builder.lookup.build_table(
347
- disability_weight_data, key_columns=["sex"], parameter_columns=["age", "year"]
348
- )
349
- self.disability_weight = builder.value.register_value_producer(
350
- f"{self.state_id}.disability_weight",
351
- source=self.compute_disability_weight,
352
- requires_columns=["age", "sex", "alive", self.model],
337
+ self.base_disability_weight = self.get_base_disability_weight(
338
+ builder, disability_weight_data
353
339
  )
340
+
341
+ self.disability_weight = self.get_disability_weight_pipeline(builder)
342
+
354
343
  builder.value.register_value_modifier(
355
344
  "disability_weight", modifier=self.disability_weight
356
345
  )
357
346
 
358
347
  excess_mortality_data = self.load_excess_mortality_rate_data(builder)
359
348
  self.has_excess_mortality = is_non_zero(excess_mortality_data)
360
- self.base_excess_mortality_rate = builder.lookup.build_table(
361
- excess_mortality_data, key_columns=["sex"], parameter_columns=["age", "year"]
362
- )
363
- self.excess_mortality_rate = builder.value.register_rate_producer(
364
- self.excess_mortality_rate_pipeline_name,
365
- source=self.compute_excess_mortality_rate,
366
- requires_columns=["age", "sex", "alive", self.model],
367
- requires_values=[self.excess_mortality_rate_paf_pipeline_name],
368
- )
369
- paf = builder.lookup.build_table(0)
370
- self.joint_paf = builder.value.register_value_producer(
371
- self.excess_mortality_rate_paf_pipeline_name,
372
- source=lambda idx: [paf(idx)],
373
- preferred_combiner=list_combiner,
374
- preferred_post_processor=union_post_processor,
349
+ self.base_excess_mortality_rate = self.get_base_excess_mortality_rate(
350
+ builder, excess_mortality_data
375
351
  )
352
+ self.excess_mortality_rate = self.get_excess_mortality_rate_pipeline(builder)
353
+ self.joint_paf = self.get_joint_paf(builder)
354
+
376
355
  builder.value.register_value_modifier(
377
356
  "mortality_rate",
378
357
  modifier=self.adjust_mortality_rate,
379
358
  requires_values=[self.excess_mortality_rate_pipeline_name],
380
359
  )
381
360
 
382
- self.randomness_prevalence = builder.randomness.get_stream(
383
- f"{self.state_id}_prevalent_cases"
384
- )
361
+ self.randomness_prevalence = self.get_randomness_prevalence(builder)
385
362
 
386
363
  #################
387
364
  # Setup methods #
@@ -393,12 +370,26 @@ class DiseaseState(BaseDiseaseState):
393
370
  else:
394
371
  return builder.data.load(f"{self.cause_type}.{self.state_id}.prevalence")
395
372
 
373
+ def get_prevalence(
374
+ self, builder: Builder, prevalence_data: LookupTableData
375
+ ) -> LookupTable:
376
+ return builder.lookup.build_table(
377
+ prevalence_data, key_columns=["sex"], parameter_columns=["age", "year"]
378
+ )
379
+
396
380
  def load_birth_prevalence_data(self, builder: Builder) -> LookupTableData:
397
381
  if "birth_prevalence" in self._get_data_functions:
398
382
  return self._get_data_functions["birth_prevalence"](builder, self.state_id)
399
383
  else:
400
384
  return 0
401
385
 
386
+ def get_birth_prevalence(
387
+ self, builder: Builder, birth_prevalence_data: LookupTableData
388
+ ) -> LookupTable:
389
+ return builder.lookup.build_table(
390
+ birth_prevalence_data, key_columns=["sex"], parameter_columns=["year"]
391
+ )
392
+
402
393
  def load_dwell_time_data(self, builder: Builder) -> LookupTableData:
403
394
  if "dwell_time" in self._get_data_functions:
404
395
  dwell_time = self._get_data_functions["dwell_time"](builder, self.state_id)
@@ -414,6 +405,17 @@ class DiseaseState(BaseDiseaseState):
414
405
 
415
406
  return dwell_time
416
407
 
408
+ def get_dwell_time_pipeline(
409
+ self, builder: Builder, dwell_time_data: LookupTableData
410
+ ) -> Pipeline:
411
+ return builder.value.register_value_producer(
412
+ f"{self.state_id}.dwell_time",
413
+ source=builder.lookup.build_table(
414
+ dwell_time_data, key_columns=["sex"], parameter_columns=["age", "year"]
415
+ ),
416
+ requires_columns=["age", "sex"],
417
+ )
418
+
417
419
  def load_disability_weight_data(self, builder: Builder) -> LookupTableData:
418
420
  if "disability_weight" in self._get_data_functions:
419
421
  disability_weight = self._get_data_functions["disability_weight"](
@@ -429,6 +431,20 @@ class DiseaseState(BaseDiseaseState):
429
431
 
430
432
  return disability_weight
431
433
 
434
+ def get_base_disability_weight(
435
+ self, builder: Builder, disability_weight_data: LookupTableData
436
+ ) -> LookupTable:
437
+ return builder.lookup.build_table(
438
+ disability_weight_data, key_columns=["sex"], parameter_columns=["age", "year"]
439
+ )
440
+
441
+ def get_disability_weight_pipeline(self, builder: Builder) -> Pipeline:
442
+ return builder.value.register_value_producer(
443
+ f"{self.state_id}.disability_weight",
444
+ source=self.compute_disability_weight,
445
+ requires_columns=["age", "sex", "alive", self.model],
446
+ )
447
+
432
448
  def load_excess_mortality_rate_data(self, builder: Builder) -> LookupTableData:
433
449
  if "excess_mortality_rate" in self._get_data_functions:
434
450
  return self._get_data_functions["excess_mortality_rate"](builder, self.state_id)
@@ -439,6 +455,33 @@ class DiseaseState(BaseDiseaseState):
439
455
  f"{self.cause_type}.{self.state_id}.excess_mortality_rate"
440
456
  )
441
457
 
458
+ def get_base_excess_mortality_rate(
459
+ self, builder: Builder, excess_mortality_data: LookupTableData
460
+ ) -> LookupTable:
461
+ return builder.lookup.build_table(
462
+ excess_mortality_data, key_columns=["sex"], parameter_columns=["age", "year"]
463
+ )
464
+
465
+ def get_excess_mortality_rate_pipeline(self, builder: Builder) -> Pipeline:
466
+ return builder.value.register_rate_producer(
467
+ self.excess_mortality_rate_pipeline_name,
468
+ source=self.compute_excess_mortality_rate,
469
+ requires_columns=["age", "sex", "alive", self.model],
470
+ requires_values=[self.excess_mortality_rate_paf_pipeline_name],
471
+ )
472
+
473
+ def get_joint_paf(self, builder: Builder) -> Pipeline:
474
+ paf = builder.lookup.build_table(0)
475
+ return builder.value.register_value_producer(
476
+ self.excess_mortality_rate_paf_pipeline_name,
477
+ source=lambda idx: [paf(idx)],
478
+ preferred_combiner=list_combiner,
479
+ preferred_post_processor=union_post_processor,
480
+ )
481
+
482
+ def get_randomness_prevalence(self, builder: Builder) -> RandomnessStream:
483
+ return builder.randomness.get_stream(f"{self.state_id}_prevalent_cases")
484
+
442
485
  ##################
443
486
  # Public methods #
444
487
  ##################
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium-public-health
3
- Version: 2.0.2
3
+ Version: 2.1.1
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 +0,0 @@
1
- __version__ = "2.0.2"