vivarium-public-health 4.1.0__tar.gz → 4.2.0__tar.gz

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.
Files changed (158) hide show
  1. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/CHANGELOG.rst +8 -0
  2. vivarium_public_health-4.2.0/Jenkinsfile +6 -0
  3. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/PKG-INFO +2 -2
  4. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/setup.py +1 -1
  5. vivarium_public_health-4.2.0/src/vivarium_public_health/_version.py +1 -0
  6. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/disability.py +1 -15
  7. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/disease.py +2 -26
  8. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/mortality.py +0 -14
  9. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/risk.py +2 -26
  10. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +88 -10
  11. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health.egg-info/PKG-INFO +2 -2
  12. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health.egg-info/requires.txt +1 -1
  13. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/conftest.py +10 -1
  14. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/test_disability_observer.py +0 -1
  15. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/test_low_birth_weight_and_short_gestation.py +115 -9
  16. vivarium_public_health-4.1.0/Jenkinsfile +0 -4
  17. vivarium_public_health-4.1.0/src/vivarium_public_health/_version.py +0 -1
  18. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.bandit +0 -0
  19. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.flake8 +0 -0
  20. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.gitattributes +0 -0
  21. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.github/CODEOWNERS +0 -0
  22. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.github/pull_request_template.md +0 -0
  23. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.github/workflows/deploy.yml +0 -0
  24. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.gitignore +0 -0
  25. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.pylintrc +0 -0
  26. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.readthedocs.yml +0 -0
  27. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/.zenodo.json +0 -0
  28. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/CODE_OF_CONDUCT.rst +0 -0
  29. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/CONTRIBUTING.rst +0 -0
  30. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/LICENSE.txt +0 -0
  31. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/MANIFEST.in +0 -0
  32. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/Makefile +0 -0
  33. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/README.rst +0 -0
  34. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/Makefile +0 -0
  35. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/nitpick-exceptions +0 -0
  36. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/_static/style.css +0 -0
  37. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/_templates/layout.html +0 -0
  38. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/disease/index.rst +0 -0
  39. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/disease/model.rst +0 -0
  40. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/disease/models.rst +0 -0
  41. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/disease/special_disease.rst +0 -0
  42. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/disease/state.rst +0 -0
  43. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/disease/transition.rst +0 -0
  44. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/index.rst +0 -0
  45. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/delay.rst +0 -0
  46. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/disease.rst +0 -0
  47. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/index.rst +0 -0
  48. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/intervention.rst +0 -0
  49. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/magic_wand_components.rst +0 -0
  50. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/observer.rst +0 -0
  51. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/mslt/population.rst +0 -0
  52. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/plugins/index.rst +0 -0
  53. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/plugins/parser.rst +0 -0
  54. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/population/add_new_birth_cohorts.rst +0 -0
  55. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/population/base_population.rst +0 -0
  56. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/population/data_transformations.rst +0 -0
  57. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/population/index.rst +0 -0
  58. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/population/mortality.rst +0 -0
  59. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/disability.rst +0 -0
  60. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/disease.rst +0 -0
  61. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/index.rst +0 -0
  62. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/mortality.rst +0 -0
  63. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/observer.rst +0 -0
  64. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/risk.rst +0 -0
  65. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/simple_cause.rst +0 -0
  66. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/results/stratification.rst +0 -0
  67. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/base_risk.rst +0 -0
  68. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/data_transformations.rst +0 -0
  69. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/distributions.rst +0 -0
  70. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/effect.rst +0 -0
  71. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/implementations/index.rst +0 -0
  72. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/implementations/low_birth_weight_and_short_gestation.rst +0 -0
  73. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/risks/index.rst +0 -0
  74. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/treatment/index.rst +0 -0
  75. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/treatment/magic_wand.rst +0 -0
  76. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/treatment/scale_up.rst +0 -0
  77. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/treatment/therapeutic_inertia.rst +0 -0
  78. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/api_reference/utilities.rst +0 -0
  79. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/conf.py +0 -0
  80. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/index.rst +0 -0
  81. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/tutorials/index.rst +0 -0
  82. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/docs/source/tutorials/risk_exposure.rst +0 -0
  83. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/pyproject.toml +0 -0
  84. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/python_versions.json +0 -0
  85. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/setup.cfg +0 -0
  86. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/__about__.py +0 -0
  87. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/__init__.py +0 -0
  88. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/__init__.py +0 -0
  89. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/exceptions.py +0 -0
  90. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/model.py +0 -0
  91. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/models.py +0 -0
  92. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/special_disease.py +0 -0
  93. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/state.py +0 -0
  94. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/disease/transition.py +0 -0
  95. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/__init__.py +0 -0
  96. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/delay.py +0 -0
  97. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/disease.py +0 -0
  98. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/intervention.py +0 -0
  99. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/magic_wand_components.py +0 -0
  100. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/observer.py +0 -0
  101. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/mslt/population.py +0 -0
  102. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/plugins/__init__.py +0 -0
  103. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/plugins/parser.py +0 -0
  104. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/population/__init__.py +0 -0
  105. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/population/add_new_birth_cohorts.py +0 -0
  106. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/population/base_population.py +0 -0
  107. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/population/data_transformations.py +0 -0
  108. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/population/mortality.py +0 -0
  109. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/__init__.py +0 -0
  110. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/columns.py +0 -0
  111. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/observer.py +0 -0
  112. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/simple_cause.py +0 -0
  113. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/results/stratification.py +0 -0
  114. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/__init__.py +0 -0
  115. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/base_risk.py +0 -0
  116. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/data_transformations.py +0 -0
  117. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/distributions.py +0 -0
  118. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/effect.py +0 -0
  119. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/risks/implementations/__init__.py +0 -0
  120. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/treatment/__init__.py +0 -0
  121. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/treatment/magic_wand.py +0 -0
  122. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/treatment/scale_up.py +0 -0
  123. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/treatment/therapeutic_inertia.py +0 -0
  124. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health/utilities.py +0 -0
  125. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health.egg-info/SOURCES.txt +0 -0
  126. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health.egg-info/dependency_links.txt +0 -0
  127. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health.egg-info/not-zip-safe +0 -0
  128. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/src/vivarium_public_health.egg-info/top_level.txt +0 -0
  129. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/__init__.py +0 -0
  130. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/data/rr_interpolator.csv +0 -0
  131. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/disease/__init__.py +0 -0
  132. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/disease/test_disease.py +0 -0
  133. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/disease/test_special_disease.py +0 -0
  134. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/mock_artifact.py +0 -0
  135. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/plugins/__init__.py +0 -0
  136. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/plugins/test_parser.py +0 -0
  137. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/population/__init__.py +0 -0
  138. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/population/conftest.py +0 -0
  139. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/population/test_add_new_birth_cohort.py +0 -0
  140. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/population/test_base_population.py +0 -0
  141. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/population/test_data_transformations.py +0 -0
  142. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/population/test_mortality.py +0 -0
  143. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/__init__.py +0 -0
  144. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/test_categorical_risk_observer.py +0 -0
  145. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/test_disability.py +0 -0
  146. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/test_disease_observer.py +0 -0
  147. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/test_mortality_observer.py +0 -0
  148. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/results/test_stratification.py +0 -0
  149. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/__init__.py +0 -0
  150. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/conftest.py +0 -0
  151. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/test_base_risk.py +0 -0
  152. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/test_data_transformations.py +0 -0
  153. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/test_distributions.py +0 -0
  154. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/risks/test_effect.py +0 -0
  155. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/test_utilities.py +0 -0
  156. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/treatment/__init__.py +0 -0
  157. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tests/treatment/test_scale_up.py +0 -0
  158. {vivarium_public_health-4.1.0 → vivarium_public_health-4.2.0}/tox.ini +0 -0
@@ -1,3 +1,11 @@
1
+ **4.2.0 - 06/11/25**
2
+
3
+ - Feature: Update LBWSG to use exposure data based on simulant age
4
+
5
+ **4.1.1 - 05/23/25**
6
+
7
+ - Feature: Update Observer to use super class get_configuration method
8
+
1
9
  **4.1.0 - 05/20/25**
2
10
 
3
11
  - Feature: Update RateTransition to have configuration key for rate conversion type
@@ -0,0 +1,6 @@
1
+ @Library("vivarium_build_utils") _
2
+ reusable_pipeline(
3
+ scheduled_branches: ["main"],
4
+ upstream_repos: ["vivarium", "layered_config_tree", "risk_distributions"],
5
+ run_mypy: false,
6
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vivarium_public_health
3
- Version: 4.1.0
3
+ Version: 4.2.0
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
@@ -26,7 +26,7 @@ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
26
26
  Classifier: Topic :: Scientific/Engineering :: Physics
27
27
  Classifier: Topic :: Software Development :: Libraries
28
28
  License-File: LICENSE.txt
29
- Requires-Dist: vivarium>=3.4.0
29
+ Requires-Dist: vivarium>=3.4.3
30
30
  Requires-Dist: layered_config_tree>=1.0.1
31
31
  Requires-Dist: loguru
32
32
  Requires-Dist: numpy<2.0.0
@@ -42,7 +42,7 @@ if __name__ == "__main__":
42
42
  long_description = f.read()
43
43
 
44
44
  install_requirements = [
45
- "vivarium>=3.4.0",
45
+ "vivarium>=3.4.3",
46
46
  "layered_config_tree>=1.0.1",
47
47
  "loguru",
48
48
  "numpy<2.0.0",
@@ -0,0 +1 @@
1
+ __version__ = "4.2.0"
@@ -34,7 +34,7 @@ class DisabilityObserver(PublicHealthObserver):
34
34
  .. code-block:: yaml
35
35
 
36
36
  configuration:
37
- observers:
37
+ stratification:
38
38
  disability:
39
39
  exclude:
40
40
  - "sex"
@@ -128,20 +128,6 @@ class DisabilityObserver(PublicHealthObserver):
128
128
  cause for cause in causes_of_disability if cause.state_id not in excluded_causes
129
129
  ]
130
130
 
131
- def get_configuration(self, builder: Builder) -> LayeredConfigTree:
132
- """Get the stratification configuration for this observer.
133
-
134
- Parameters
135
- ----------
136
- builder
137
- The builder object for the simulation.
138
-
139
- Returns
140
- -------
141
- The stratification configuration for this observer.
142
- """
143
- return builder.configuration.stratification.disability
144
-
145
131
  def register_observations(self, builder: Builder) -> None:
146
132
  """Register an observation for years lived with disability."""
147
133
  cause_pipelines = [
@@ -66,19 +66,6 @@ class DiseaseObserver(PublicHealthObserver):
66
66
  # Properties #
67
67
  ##############
68
68
 
69
- @property
70
- def configuration_defaults(self) -> dict[str, Any]:
71
- """A dictionary containing the defaults for any configurations managed by
72
- this component.
73
- """
74
- return {
75
- "stratification": {
76
- self.disease: super().configuration_defaults["stratification"][
77
- self.get_configuration_name()
78
- ]
79
- }
80
- }
81
-
82
69
  @property
83
70
  def columns_created(self) -> list[str]:
84
71
  """Columns created by this observer."""
@@ -122,19 +109,8 @@ class DiseaseObserver(PublicHealthObserver):
122
109
  self.entity = self.disease_model.cause
123
110
  self.transition_stratification_name = f"transition_{self.disease}"
124
111
 
125
- def get_configuration(self, builder: Builder) -> LayeredConfigTree:
126
- """Get the stratification configuration for this observer.
127
-
128
- Parameters
129
- ----------
130
- builder
131
- The builder object for the simulation.
132
-
133
- Returns
134
- -------
135
- The stratification configuration for this observer.
136
- """
137
- return builder.configuration.stratification[self.disease]
112
+ def get_configuration_name(self) -> str:
113
+ return self.disease
138
114
 
139
115
  def register_observations(self, builder: Builder) -> None:
140
116
  """Register stratifications and observations.
@@ -136,20 +136,6 @@ class MortalityObserver(PublicHealthObserver):
136
136
  SimpleCause("other_causes", "other_causes", "cause"),
137
137
  ]
138
138
 
139
- def get_configuration(self, builder: Builder) -> LayeredConfigTree:
140
- """Get the stratification configuration for this observer.
141
-
142
- Parameters
143
- ----------
144
- builder
145
- The builder object for the simulation.
146
-
147
- Returns
148
- -------
149
- The stratification configuration for this observer.
150
- """
151
- return builder.configuration.stratification[self.get_configuration_name()]
152
-
153
139
  def register_observations(self, builder: Builder) -> None:
154
140
  """Register stratifications and observations.
155
141
 
@@ -58,19 +58,6 @@ class CategoricalRiskObserver(PublicHealthObserver):
58
58
  # Properties #
59
59
  ##############
60
60
 
61
- @property
62
- def configuration_defaults(self) -> dict[str, Any]:
63
- """A dictionary containing the defaults for any configurations managed by
64
- this component.
65
- """
66
- return {
67
- "stratification": {
68
- f"{self.risk}": super().configuration_defaults["stratification"][
69
- self.get_configuration_name()
70
- ]
71
- }
72
- }
73
-
74
61
  @property
75
62
  def columns_required(self) -> list[str] | None:
76
63
  """The columns required by this observer."""
@@ -101,19 +88,8 @@ class CategoricalRiskObserver(PublicHealthObserver):
101
88
  self.step_size = builder.time.step_size()
102
89
  self.categories = builder.data.load(f"risk_factor.{self.risk}.categories")
103
90
 
104
- def get_configuration(self, builder: Builder) -> LayeredConfigTree:
105
- """Get the stratification configuration for this observer.
106
-
107
- Parameters
108
- ----------
109
- builder
110
- The builder object for the simulation.
111
-
112
- Returns
113
- -------
114
- The stratification configuration for this observer.
115
- """
116
- return builder.configuration.stratification[self.risk]
91
+ def get_configuration_name(self) -> str:
92
+ return self.risk
117
93
 
118
94
  def register_observations(self, builder: Builder) -> None:
119
95
  """Register a stratification and observation.
@@ -14,6 +14,8 @@ from typing import Any
14
14
 
15
15
  import numpy as np
16
16
  import pandas as pd
17
+ from layered_config_tree import ConfigurationError
18
+ from loguru import logger
17
19
  from vivarium.framework.engine import Builder
18
20
  from vivarium.framework.lifecycle import LifeCycleError
19
21
  from vivarium.framework.population import SimulantData
@@ -21,9 +23,12 @@ from vivarium.framework.resource import Resource
21
23
  from vivarium.framework.values import Pipeline
22
24
 
23
25
  from vivarium_public_health.risks import Risk, RiskEffect
24
- from vivarium_public_health.risks.data_transformations import get_exposure_post_processor
26
+ from vivarium_public_health.risks.data_transformations import (
27
+ get_exposure_post_processor,
28
+ pivot_categorical,
29
+ )
25
30
  from vivarium_public_health.risks.distributions import PolytomousDistribution
26
- from vivarium_public_health.utilities import get_lookup_columns, to_snake_case
31
+ from vivarium_public_health.utilities import EntityString, get_lookup_columns, to_snake_case
27
32
 
28
33
  CATEGORICAL = "categorical"
29
34
  BIRTH_WEIGHT = "birth_weight"
@@ -31,16 +36,76 @@ GESTATIONAL_AGE = "gestational_age"
31
36
 
32
37
 
33
38
  class LBWSGDistribution(PolytomousDistribution):
39
+ @property
40
+ def categories(self) -> list[str]:
41
+ # These need to be sorted so the cumulative sum is in the correct order of categories
42
+ # and results are therefore reproducible and correct
43
+ return sorted(self.lookup_tables[self.exposure_key].value_columns)
34
44
 
35
45
  #################
36
46
  # Setup methods #
37
47
  #################
38
48
 
49
+ def __init__(
50
+ self,
51
+ risk: EntityString,
52
+ distribution_type: str,
53
+ exposure_data: int | float | pd.DataFrame | None = None,
54
+ ) -> None:
55
+ super().__init__(risk, distribution_type, exposure_data)
56
+ self.exposure_key = "birth_exposure"
57
+
39
58
  # noinspection PyAttributeOutsideInit
40
59
  def setup(self, builder: Builder) -> None:
41
60
  super().setup(builder)
42
61
  self.category_intervals = self.get_category_intervals(builder)
43
62
 
63
+ def build_all_lookup_tables(self, builder: Builder) -> None:
64
+ try:
65
+ birth_exposure_data = self.get_data(
66
+ builder, self.configuration["data_sources"]["birth_exposure"]
67
+ )
68
+ birth_exposure_value_columns = self.get_exposure_value_columns(
69
+ birth_exposure_data
70
+ )
71
+
72
+ if isinstance(birth_exposure_data, pd.DataFrame):
73
+ birth_exposure_data = pivot_categorical(
74
+ builder, self.risk, birth_exposure_data, "parameter"
75
+ )
76
+
77
+ self.lookup_tables["birth_exposure"] = self.build_lookup_table(
78
+ builder, birth_exposure_data, birth_exposure_value_columns
79
+ )
80
+ except ConfigurationError:
81
+ logger.warning("Birth exposure data for LBWSG is missing from the simulation")
82
+ try:
83
+ super().build_all_lookup_tables(builder)
84
+ except ConfigurationError:
85
+ logger.warning("The data for LBWSG exposure is missing from the simulation.")
86
+
87
+ if (
88
+ "birth_exposure" not in self.lookup_tables
89
+ and "exposure" not in self.lookup_tables
90
+ ):
91
+ raise ConfigurationError(
92
+ "The LBWSG distribution requires either 'birth_exposure' or 'exposure' data to be "
93
+ "available in the simulation."
94
+ )
95
+
96
+ def get_exposure_parameter_pipeline(self, builder: Builder) -> Pipeline:
97
+ lookup_columns = []
98
+ if "exposure" in self.lookup_tables:
99
+ lookup_columns.extend(get_lookup_columns([self.lookup_tables["exposure"]]))
100
+ if "birth_exposure" in self.lookup_tables:
101
+ lookup_columns.extend(get_lookup_columns([self.lookup_tables["birth_exposure"]]))
102
+ return builder.value.register_value_producer(
103
+ self.parameters_pipeline_name,
104
+ source=lambda index: self.lookup_tables[self.exposure_key](index),
105
+ component=self,
106
+ required_resources=list(set(lookup_columns)),
107
+ )
108
+
44
109
  def get_category_intervals(self, builder: Builder) -> dict[str, dict[str, pd.Interval]]:
45
110
  """Gets the intervals for each category.
46
111
 
@@ -203,8 +268,9 @@ class LBWSGRisk(Risk):
203
268
  @property
204
269
  def configuration_defaults(self) -> dict[str, Any]:
205
270
  configuration_defaults = super().configuration_defaults
271
+ # Add birth exposure data source
206
272
  configuration_defaults[self.name]["data_sources"][
207
- "exposure"
273
+ "birth_exposure"
208
274
  ] = f"{self.risk}.birth_exposure"
209
275
  configuration_defaults[self.name]["distribution_type"] = "lbwsg"
210
276
  return configuration_defaults
@@ -224,6 +290,7 @@ class LBWSGRisk(Risk):
224
290
  def setup(self, builder: Builder) -> None:
225
291
  super().setup(builder)
226
292
  self.birth_exposures = self.get_birth_exposure_pipelines(builder)
293
+ self.configuration_age_end = builder.configuration.population.initialization_age_max
227
294
 
228
295
  #################
229
296
  # Setup methods #
@@ -242,7 +309,7 @@ class LBWSGRisk(Risk):
242
309
  self.exposure_distribution.lookup_tables.values()
243
310
  )
244
311
 
245
- def get_pipeline(axis_: str):
312
+ def get_pipeline(axis_: str) -> Pipeline:
246
313
  return builder.value.register_value_producer(
247
314
  self.birth_exposure_pipeline_name(axis_),
248
315
  source=lambda index: self.get_birth_exposure(axis_, index),
@@ -260,12 +327,23 @@ class LBWSGRisk(Risk):
260
327
  ########################
261
328
 
262
329
  def on_initialize_simulants(self, pop_data: SimulantData) -> None:
263
- birth_exposures = {
264
- self.get_exposure_column_name(axis): self.birth_exposures[
265
- self.birth_exposure_pipeline_name(axis)
266
- ](pop_data.index)
267
- for axis in self.AXES
268
- }
330
+ if pop_data.user_data.get("age_end", self.configuration_age_end) == 0:
331
+ self.exposure_distribution.exposure_key = "birth_exposure"
332
+ else:
333
+ self.exposure_distribution.exposure_key = "exposure"
334
+
335
+ try:
336
+ birth_exposures = {
337
+ self.get_exposure_column_name(axis): self.birth_exposures[
338
+ self.birth_exposure_pipeline_name(axis)
339
+ ](pop_data.index)
340
+ for axis in self.AXES
341
+ }
342
+ except KeyError:
343
+ raise ConfigurationError(
344
+ f"{self.exposure_distribution.exposure_key} data for {self.name} is missing from the "
345
+ "simulation. Simulants cannot be initialized."
346
+ )
269
347
  self.population_view.update(pd.DataFrame(birth_exposures))
270
348
 
271
349
  ##################################
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vivarium_public_health
3
- Version: 4.1.0
3
+ Version: 4.2.0
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
@@ -26,7 +26,7 @@ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
26
26
  Classifier: Topic :: Scientific/Engineering :: Physics
27
27
  Classifier: Topic :: Software Development :: Libraries
28
28
  License-File: LICENSE.txt
29
- Requires-Dist: vivarium>=3.4.0
29
+ Requires-Dist: vivarium>=3.4.3
30
30
  Requires-Dist: layered_config_tree>=1.0.1
31
31
  Requires-Dist: loguru
32
32
  Requires-Dist: numpy<2.0.0
@@ -1,4 +1,4 @@
1
- vivarium>=3.4.0
1
+ vivarium>=3.4.3
2
2
  layered_config_tree>=1.0.1
3
3
  loguru
4
4
  numpy<2.0.0
@@ -1,8 +1,10 @@
1
- from collections.abc import Callable
1
+ from collections.abc import Callable, Generator
2
2
  from pathlib import Path
3
3
 
4
4
  import pytest
5
+ from _pytest.logging import LogCaptureFixture
5
6
  from layered_config_tree import LayeredConfigTree
7
+ from loguru import logger
6
8
  from vivarium.framework.configuration import build_simulation_configuration
7
9
  from vivarium_testing_utils import FuzzyChecker
8
10
 
@@ -69,3 +71,10 @@ def fuzzy_checker() -> FuzzyChecker:
69
71
  yield checker
70
72
  test_dir = Path(__file__).resolve().parent
71
73
  checker.save_diagnostic_output(test_dir)
74
+
75
+
76
+ @pytest.fixture
77
+ def caplog(caplog: LogCaptureFixture) -> Generator[LogCaptureFixture, None, None]:
78
+ handler_id = logger.add(caplog.handler, format="{message}")
79
+ yield caplog
80
+ logger.remove(handler_id)
@@ -39,7 +39,6 @@ def test_disability_observer_setup(mocker):
39
39
  observer = DisabilityObserver_()
40
40
  builder = mocker.Mock()
41
41
  mocker.patch("vivarium.component.Component.build_all_lookup_tables")
42
- mocker.patch("vivarium.component.Component.get_configuration")
43
42
  builder.results.register_adding_observation = mocker.Mock()
44
43
  builder.configuration.time.step_size = 28
45
44
  builder.configuration.output_data.results_directory = "some/results/directory"
@@ -1,6 +1,9 @@
1
1
  import numpy as np
2
2
  import pandas as pd
3
3
  import pytest
4
+ from layered_config_tree import ConfigurationError
5
+ from vivarium import InteractiveContext
6
+ from vivarium.testing_utilities import TestPopulation
4
7
 
5
8
  from tests.risks.test_effect import _setup_risk_effect_simulation
6
9
  from tests.test_utilities import make_age_bins
@@ -57,11 +60,15 @@ def test_lbwsg_risk_effect_rr_pipeline(base_config, base_plugins, mock_rr_interp
57
60
  # Have to match age bins and rr data to make age intervals
58
61
  rr_data = make_categorical_data(agees)
59
62
  # Exposure data used for risk component
60
- exposure = make_categorical_data(agees)
63
+ birth_exposure = make_categorical_data(agees)
64
+ exposure = birth_exposure.copy()
65
+ exposure.loc[exposure["value"] == 0.75, "value"] = 0.65
66
+ exposure.loc[exposure["value"] == 0.25, "value"] = 0.35
61
67
 
62
68
  # Add data dict to add to artifact
63
69
  data = {
64
- f"{risk.name}.birth_exposure": exposure,
70
+ f"{risk.name}.birth_exposure": birth_exposure,
71
+ f"{risk.name}.exposure": exposure,
65
72
  f"{risk.name}.relative_risk": rr_data,
66
73
  f"{risk.name}.population_attributable_fraction": 0,
67
74
  f"{risk.name}.categories": categories,
@@ -81,6 +88,16 @@ def test_lbwsg_risk_effect_rr_pipeline(base_config, base_plugins, mock_rr_interp
81
88
  )
82
89
  sim = _setup_risk_effect_simulation(base_config, base_plugins, risk, lbwsg_effect, data)
83
90
  pop = sim.get_population()
91
+ # Verify exposure is used instead of birth_exposure since age end is 1.0
92
+ # Check values of pipeline match birth exposure data since age_end is 0.0
93
+ exposure_pipeline_values = sim.get_value(
94
+ "risk_factor.low_birth_weight_and_short_gestation.exposure_parameters"
95
+ )(pop.index)
96
+ assert isinstance(exposure_pipeline_values, pd.DataFrame)
97
+ assert "cat81" in exposure_pipeline_values.columns
98
+ assert "cat82" in exposure_pipeline_values.columns
99
+ assert (exposure_pipeline_values["cat81"] == 0.65).all()
100
+ assert (exposure_pipeline_values["cat82"] == 0.35).all()
84
101
 
85
102
  expected_pipeline_name = (
86
103
  f"effect_of_{lbwsg_effect.risk.name}_on_{lbwsg_effect.target.name}.relative_risk"
@@ -120,7 +137,8 @@ def test_lbwsg_risk_effect_rr_pipeline(base_config, base_plugins, mock_rr_interp
120
137
  assert (actual_rr == 1.0).all()
121
138
 
122
139
 
123
- def test_use_birth_exposure(base_config, base_plugins, mock_rr_interpolators):
140
+ @pytest.mark.parametrize("age_end", [0.0, 1.0])
141
+ def test_use_exposure(base_config, base_plugins, mock_rr_interpolators, age_end):
124
142
  risk = LBWSGRisk()
125
143
  lbwsg_effect = LBWSGRiskEffect("cause.test_cause.cause_specific_mortality_rate")
126
144
 
@@ -135,7 +153,7 @@ def test_use_birth_exposure(base_config, base_plugins, mock_rr_interpolators):
135
153
  # Have to match age bins and rr data to make age intervals
136
154
  rr_data = make_categorical_data(ages)
137
155
  # Format birth exposure data
138
- exposure = pd.DataFrame(
156
+ birth_exposure = pd.DataFrame(
139
157
  {
140
158
  "sex": ["Male", "Female", "Male", "Female"],
141
159
  "year_start": [2021, 2021, 2021, 2021],
@@ -144,10 +162,13 @@ def test_use_birth_exposure(base_config, base_plugins, mock_rr_interpolators):
144
162
  "value": [0.75, 0.75, 0.25, 0.25],
145
163
  }
146
164
  )
165
+ exposure = birth_exposure.copy()
166
+ exposure["value"] = [0.65, 0.65, 0.35, 0.35]
147
167
 
148
168
  # Add data dict to add to artifact
149
169
  data = {
150
- f"{risk.name}.birth_exposure": exposure,
170
+ f"{risk.name}.birth_exposure": birth_exposure,
171
+ f"{risk.name}.exposure": exposure,
151
172
  f"{risk.name}.relative_risk": rr_data,
152
173
  f"{risk.name}.population_attributable_fraction": 0,
153
174
  f"{risk.name}.categories": categories,
@@ -155,24 +176,109 @@ def test_use_birth_exposure(base_config, base_plugins, mock_rr_interpolators):
155
176
  }
156
177
 
157
178
  # Only have neontal age groups
158
- age_start = 0.0
159
- age_end = 1.0
179
+ age_end = 0.0
160
180
  base_config.update(
161
181
  {
162
182
  "population": {
163
- "initialization_age_start": age_start,
183
+ "initialization_age_start": 0.0,
164
184
  "initialization_age_max": age_end,
165
- }
185
+ },
166
186
  }
167
187
  )
168
188
  sim = _setup_risk_effect_simulation(base_config, base_plugins, risk, lbwsg_effect, data)
169
189
  pop = sim.get_population()
190
+ # Check values of pipeline match birth exposure data since age_end is 0.0
191
+ exposure_pipeline_values = sim.get_value(
192
+ "risk_factor.low_birth_weight_and_short_gestation.exposure_parameters"
193
+ )(pop.index)
194
+ assert isinstance(exposure_pipeline_values, pd.DataFrame)
195
+ assert "cat81" in exposure_pipeline_values.columns
196
+ assert "cat82" in exposure_pipeline_values.columns
197
+ exposure_values = {
198
+ 0.0: {"cat81": 0.75, "cat82": 0.25},
199
+ 1.0: {"cat81": 0.65, "cat82": 0.35},
200
+ }
201
+ assert (exposure_pipeline_values["cat81"] == exposure_values[age_end]["cat81"]).all()
202
+ assert (exposure_pipeline_values["cat82"] == exposure_values[age_end]["cat82"]).all()
170
203
 
171
204
  # Assert LBWSG birth exposure columns were created
172
205
  assert "birth_weight_exposure" in pop.columns
173
206
  assert "gestational_age_exposure" in pop.columns
174
207
 
175
208
 
209
+ @pytest.mark.parametrize("exposure_key", ["birth_exposure", "exposure", "missing"])
210
+ def test_lbwsg_exposure_data_logging(exposure_key, base_config, mocker, caplog) -> None:
211
+ risk = LBWSGRisk()
212
+
213
+ # Add mock data to artifact
214
+ # Format birth exposure data
215
+ exposure_data = pd.DataFrame(
216
+ {
217
+ "sex": ["Male", "Female", "Male", "Female"],
218
+ "year_start": [2021, 2021, 2021, 2021],
219
+ "year_end": [2022, 2022, 2022, 2022],
220
+ "parameter": ["cat81", "cat81", "cat82", "cat82"],
221
+ "value": [0.75, 0.75, 0.25, 0.25],
222
+ }
223
+ )
224
+
225
+ # Only have neontal age groups
226
+ if exposure_key == "birth_exposure":
227
+ age_end = 0.0
228
+ else:
229
+ age_end = 1.0
230
+
231
+ if exposure_key != "missing":
232
+ no_data_dict = {
233
+ "birth_exposure": "exposure",
234
+ "exposure": "birth_exposure",
235
+ }
236
+ no_data_key = no_data_dict[exposure_key]
237
+ override_config = {
238
+ "population": {
239
+ "initialization_age_start": 0.0,
240
+ "initialization_age_max": age_end,
241
+ },
242
+ risk.name: {
243
+ "data_sources": {
244
+ exposure_key: exposure_data,
245
+ }
246
+ },
247
+ }
248
+ else:
249
+ override_config = {
250
+ "population": {
251
+ "initialization_age_start": 0.0,
252
+ "initialization_age_max": age_end,
253
+ },
254
+ }
255
+
256
+ # Patch get_category intervals so we do not need the mock artifact
257
+ mocker.patch(
258
+ "vivarium_public_health.risks.implementations.low_birth_weight_and_short_gestation.LBWSGDistribution.get_category_intervals"
259
+ )
260
+ assert not caplog.records
261
+ if exposure_key != "missing":
262
+ missing_key = "exposure" if exposure_key == "birth_exposure" else "birth_exposure"
263
+ sim = InteractiveContext(
264
+ base_config,
265
+ components=[TestPopulation(), risk],
266
+ configuration=override_config,
267
+ )
268
+ assert f"The data for LBWSG {missing_key} is missing from the simulation"
269
+ else:
270
+ with pytest.raises(
271
+ ConfigurationError,
272
+ match="The LBWSG distribution requires either 'birth_exposure' or 'exposure' data to be "
273
+ "available in the simulation.",
274
+ ):
275
+ InteractiveContext(
276
+ base_config,
277
+ components=[TestPopulation(), risk],
278
+ configuration=override_config,
279
+ )
280
+
281
+
176
282
  def make_categorical_data(data: pd.DataFrame) -> pd.DataFrame:
177
283
  # Takes age gropus and adds sex, years, categories, and values
178
284
  dfs = []
@@ -1,4 +0,0 @@
1
- @Library("vivarium_build_utils") _
2
- reusable_pipeline(scheduled_branches: ["main"],
3
- upstream_repos: ["vivarium", "layered_config_tree", "risk_distributions"],
4
- )
@@ -1 +0,0 @@
1
- __version__ = "4.1.0"