vivarium-public-health 3.1.3__tar.gz → 3.1.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.github/workflows/build.yml +1 -0
  2. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/CHANGELOG.rst +10 -0
  3. vivarium_public_health-3.1.5/Jenkinsfile +2 -0
  4. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/Makefile +1 -1
  5. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/PKG-INFO +12 -3
  6. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/setup.py +1 -1
  7. vivarium_public_health-3.1.5/src/vivarium_public_health/_version.py +1 -0
  8. vivarium_public_health-3.1.5/src/vivarium_public_health/disease/exceptions.py +5 -0
  9. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/disease/model.py +116 -112
  10. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/disease/state.py +215 -79
  11. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/disease/transition.py +78 -21
  12. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health.egg-info/PKG-INFO +12 -3
  13. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health.egg-info/SOURCES.txt +1 -0
  14. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health.egg-info/requires.txt +1 -1
  15. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/disease/test_disease.py +108 -84
  16. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/plugins/test_parser.py +1 -1
  17. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/population/test_add_new_birth_cohort.py +4 -3
  18. vivarium_public_health-3.1.3/Jenkinsfile +0 -257
  19. vivarium_public_health-3.1.3/src/vivarium_public_health/_version.py +0 -1
  20. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.bandit +0 -0
  21. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.flake8 +0 -0
  22. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.gitattributes +0 -0
  23. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.github/CODEOWNERS +0 -0
  24. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.github/pull_request_template.md +0 -0
  25. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.github/workflows/deploy.yml +0 -0
  26. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.gitignore +0 -0
  27. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.pylintrc +0 -0
  28. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.readthedocs.yml +0 -0
  29. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/.zenodo.json +0 -0
  30. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/CODE_OF_CONDUCT.rst +0 -0
  31. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/CONTRIBUTING.rst +0 -0
  32. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/LICENSE.txt +0 -0
  33. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/MANIFEST.in +0 -0
  34. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/README.rst +0 -0
  35. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/Makefile +0 -0
  36. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/nitpick-exceptions +0 -0
  37. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/_static/style.css +0 -0
  38. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/_templates/layout.html +0 -0
  39. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/disease/index.rst +0 -0
  40. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/disease/model.rst +0 -0
  41. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/disease/models.rst +0 -0
  42. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/disease/special_disease.rst +0 -0
  43. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/disease/state.rst +0 -0
  44. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/disease/transition.rst +0 -0
  45. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/index.rst +0 -0
  46. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/delay.rst +0 -0
  47. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/disease.rst +0 -0
  48. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/index.rst +0 -0
  49. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/intervention.rst +0 -0
  50. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/magic_wand_components.rst +0 -0
  51. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/observer.rst +0 -0
  52. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/mslt/population.rst +0 -0
  53. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/plugins/index.rst +0 -0
  54. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/plugins/parser.rst +0 -0
  55. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/population/add_new_birth_cohorts.rst +0 -0
  56. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/population/base_population.rst +0 -0
  57. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/population/data_transformations.rst +0 -0
  58. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/population/index.rst +0 -0
  59. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/population/mortality.rst +0 -0
  60. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/disability.rst +0 -0
  61. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/disease.rst +0 -0
  62. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/index.rst +0 -0
  63. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/mortality.rst +0 -0
  64. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/observer.rst +0 -0
  65. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/risk.rst +0 -0
  66. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/simple_cause.rst +0 -0
  67. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/results/stratification.rst +0 -0
  68. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/base_risk.rst +0 -0
  69. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/data_transformations.rst +0 -0
  70. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/distributions.rst +0 -0
  71. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/effect.rst +0 -0
  72. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/implementations/index.rst +0 -0
  73. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/implementations/low_birth_weight_and_short_gestation.rst +0 -0
  74. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/risks/index.rst +0 -0
  75. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/treatment/index.rst +0 -0
  76. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/treatment/magic_wand.rst +0 -0
  77. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/treatment/scale_up.rst +0 -0
  78. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/treatment/therapeutic_inertia.rst +0 -0
  79. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/api_reference/utilities.rst +0 -0
  80. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/conf.py +0 -0
  81. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/index.rst +0 -0
  82. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/tutorials/index.rst +0 -0
  83. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/docs/source/tutorials/risk_exposure.rst +0 -0
  84. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/pyproject.toml +0 -0
  85. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/setup.cfg +0 -0
  86. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/__about__.py +0 -0
  87. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/__init__.py +0 -0
  88. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/disease/__init__.py +0 -0
  89. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/disease/models.py +0 -0
  90. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/disease/special_disease.py +0 -0
  91. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/__init__.py +0 -0
  92. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/delay.py +0 -0
  93. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/disease.py +0 -0
  94. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/intervention.py +0 -0
  95. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/magic_wand_components.py +0 -0
  96. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/observer.py +0 -0
  97. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/mslt/population.py +0 -0
  98. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/plugins/__init__.py +0 -0
  99. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/plugins/parser.py +0 -0
  100. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/population/__init__.py +0 -0
  101. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/population/add_new_birth_cohorts.py +0 -0
  102. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/population/base_population.py +0 -0
  103. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/population/data_transformations.py +0 -0
  104. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/population/mortality.py +0 -0
  105. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/__init__.py +0 -0
  106. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/columns.py +0 -0
  107. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/disability.py +0 -0
  108. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/disease.py +0 -0
  109. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/mortality.py +0 -0
  110. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/observer.py +0 -0
  111. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/risk.py +0 -0
  112. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/simple_cause.py +0 -0
  113. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/results/stratification.py +0 -0
  114. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/__init__.py +0 -0
  115. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/base_risk.py +0 -0
  116. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/data_transformations.py +0 -0
  117. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/distributions.py +0 -0
  118. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/effect.py +0 -0
  119. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/implementations/__init__.py +0 -0
  120. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +0 -0
  121. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/treatment/__init__.py +0 -0
  122. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/treatment/magic_wand.py +0 -0
  123. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/treatment/scale_up.py +0 -0
  124. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/treatment/therapeutic_inertia.py +0 -0
  125. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health/utilities.py +0 -0
  126. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health.egg-info/dependency_links.txt +0 -0
  127. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health.egg-info/not-zip-safe +0 -0
  128. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/src/vivarium_public_health.egg-info/top_level.txt +0 -0
  129. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/__init__.py +0 -0
  130. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/conftest.py +0 -0
  131. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/disease/__init__.py +0 -0
  132. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/disease/test_special_disease.py +0 -0
  133. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/mock_artifact.py +0 -0
  134. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/plugins/__init__.py +0 -0
  135. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/population/__init__.py +0 -0
  136. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/population/conftest.py +0 -0
  137. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/population/test_base_population.py +0 -0
  138. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/population/test_data_transformations.py +0 -0
  139. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/population/test_mortality.py +0 -0
  140. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/__init__.py +0 -0
  141. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/test_categorical_risk_observer.py +0 -0
  142. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/test_disability.py +0 -0
  143. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/test_disability_observer.py +0 -0
  144. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/test_disease_observer.py +0 -0
  145. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/test_mortality_observer.py +0 -0
  146. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/results/test_stratification.py +0 -0
  147. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/__init__.py +0 -0
  148. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/conftest.py +0 -0
  149. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/test_base_risk.py +0 -0
  150. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/test_data_transformations.py +0 -0
  151. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/test_distributions.py +0 -0
  152. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/test_effect.py +0 -0
  153. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/risks/test_low_birth_weight_and_short_gestation.py +0 -0
  154. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/test_utilities.py +0 -0
  155. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/treatment/__init__.py +0 -0
  156. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tests/treatment/test_scale_up.py +0 -0
  157. {vivarium_public_health-3.1.3 → vivarium_public_health-3.1.5}/tox.ini +0 -0
@@ -20,6 +20,7 @@ jobs:
20
20
  with:
21
21
  dependencies: "layered_config_tree,vivarium"
22
22
  skip_mypy: true
23
+ python_version: ${{ matrix.python-version }}
23
24
  secrets:
24
25
  NOTIFY_EMAIL: ${{ secrets.NOTIFY_EMAIL }}
25
26
  NOTIFY_PASSWORD: ${{ secrets.NOTIFY_PASSWORD }}
@@ -1,3 +1,13 @@
1
+ **3.1.5 - 01/14/25**
2
+
3
+ - Bugfix: Vivarium InteractiveContext no longer returns int
4
+
5
+ **3.1.4 - 11/22/24**
6
+
7
+ - Feature: Enable initializing a population of all newborns
8
+ - Feature: Enable setting data sources directly on DiseaseModel components
9
+ - Refactor: Update DiseaseModel to leverage the on_initialize_simulants method of Machine
10
+
1
11
  **3.1.3 - 12/03/24**
2
12
 
3
13
  - Feature: Create relative risk pipeline
@@ -0,0 +1,2 @@
1
+ @Library("vivarium_build_utils") _
2
+ reusable_pipeline(scheduled_branches: ["main"], test_types: ["integration"], python_versions: ["3.10", "3.11"])
@@ -101,4 +101,4 @@ build-package: $(MAKE_SOURCES) # Build the package as a pip wheel
101
101
  clean: # Delete build artifacts and do any custom cleanup such as spinning down services
102
102
  @rm -rf format lint build-doc build-package integration .pytest_cache
103
103
  @rm -rf dist output
104
- $(shell find . -type f -name '*py[co]' -delete -o -type d -name __pycache__ -delete)
104
+ $(shell find . -type f -name '*py[co]' -delete -o -type d -name __pycache__ -delete)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: vivarium_public_health
3
- Version: 3.1.3
3
+ Version: 3.1.5
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.2.0
29
+ Requires-Dist: vivarium>=3.2.3
30
30
  Requires-Dist: layered_config_tree>=1.0.1
31
31
  Requires-Dist: loguru
32
32
  Requires-Dist: numpy<2.0.0
@@ -64,6 +64,15 @@ Requires-Dist: hypothesis; extra == "dev"
64
64
  Requires-Dist: pyyaml; extra == "dev"
65
65
  Requires-Dist: black==22.3.0; extra == "dev"
66
66
  Requires-Dist: isort; extra == "dev"
67
+ Dynamic: author
68
+ Dynamic: author-email
69
+ Dynamic: classifier
70
+ Dynamic: description
71
+ Dynamic: home-page
72
+ Dynamic: license
73
+ Dynamic: provides-extra
74
+ Dynamic: requires-dist
75
+ Dynamic: summary
67
76
 
68
77
  Vivarium Public Health
69
78
  ======================
@@ -15,7 +15,7 @@ if __name__ == "__main__":
15
15
  long_description = f.read()
16
16
 
17
17
  install_requirements = [
18
- "vivarium>=3.2.0",
18
+ "vivarium>=3.2.3",
19
19
  "layered_config_tree>=1.0.1",
20
20
  "loguru",
21
21
  "numpy<2.0.0",
@@ -0,0 +1 @@
1
+ __version__ = "3.1.5"
@@ -0,0 +1,5 @@
1
+ from vivarium.exceptions import VivariumError
2
+
3
+
4
+ class DiseaseModelError(VivariumError):
5
+ pass
@@ -10,24 +10,20 @@ transitions at simulation initialization and during transitions.
10
10
  """
11
11
  import warnings
12
12
  from collections.abc import Callable, Iterable
13
+ from functools import partial
13
14
  from typing import Any
14
15
 
15
- import numpy as np
16
16
  import pandas as pd
17
- from vivarium.exceptions import VivariumError
18
17
  from vivarium.framework.engine import Builder
19
- from vivarium.framework.event import Event
20
18
  from vivarium.framework.population import SimulantData
21
19
  from vivarium.framework.state_machine import Machine
20
+ from vivarium.types import DataInput, LookupTableData
22
21
 
22
+ from vivarium_public_health.disease.exceptions import DiseaseModelError
23
23
  from vivarium_public_health.disease.state import BaseDiseaseState, SusceptibleState
24
24
  from vivarium_public_health.disease.transition import TransitionString
25
25
 
26
26
 
27
- class DiseaseModelError(VivariumError):
28
- pass
29
-
30
-
31
27
  class DiseaseModel(Machine):
32
28
 
33
29
  ##############
@@ -82,57 +78,77 @@ class DiseaseModel(Machine):
82
78
  cause_type: str = "cause",
83
79
  states: Iterable[BaseDiseaseState] = (),
84
80
  residual_state: BaseDiseaseState | None = None,
85
- **kwargs,
86
- ):
87
- super().__init__(cause, states=states, **kwargs)
81
+ cause_specific_mortality_rate: DataInput | None = None,
82
+ ) -> None:
83
+ super().__init__(cause, states=states)
88
84
  self.cause = cause
89
85
  self.cause_type = cause_type
86
+ self.residual_state = self._get_residual_state(initial_state, residual_state)
87
+ self._csmr_source = cause_specific_mortality_rate
88
+ self._get_data_functions = (
89
+ get_data_functions if get_data_functions is not None else {}
90
+ )
90
91
 
91
- if initial_state is not None:
92
+ if get_data_functions is not None:
92
93
  warnings.warn(
93
- "In the future, the 'initial_state' argument to DiseaseModel"
94
- " will be used to initialize all simulants into that state. To"
95
- " retain the current behavior of defining a residual state, use"
96
- " the 'residual_state' argument.",
94
+ "The argument 'get_data_functions' has been deprecated. Use"
95
+ " cause_specific_mortality_rate instead.",
97
96
  DeprecationWarning,
98
97
  stacklevel=2,
99
98
  )
100
99
 
101
- if residual_state:
100
+ if cause_specific_mortality_rate is not None:
102
101
  raise DiseaseModelError(
103
- "A DiseaseModel cannot be initialized with both"
104
- " 'initial_state and 'residual_state'."
102
+ "It is not allowed to pass cause_specific_mortality_rate"
103
+ " both as a stand-alone argument and as part of"
104
+ " get_data_functions."
105
105
  )
106
106
 
107
- self.residual_state = initial_state.state_id
108
- elif residual_state is not None:
109
- self.residual_state = residual_state.state_id
110
- else:
111
- self.residual_state = self._get_default_residual_state()
112
-
113
- self._get_data_functions = (
114
- get_data_functions if get_data_functions is not None else {}
115
- )
116
-
117
107
  def setup(self, builder: Builder) -> None:
118
108
  """Perform this component's setup."""
119
109
  super().setup(builder)
120
110
 
121
111
  self.configuration_age_start = builder.configuration.population.initialization_age_min
122
112
  self.configuration_age_end = builder.configuration.population.initialization_age_max
113
+
123
114
  builder.value.register_value_modifier(
124
115
  "cause_specific_mortality_rate",
125
116
  self.adjust_cause_specific_mortality_rate,
126
117
  requires_columns=["age", "sex"],
127
118
  )
128
- self.randomness = builder.randomness.get_stream(f"{self.state_column}_initial_states")
119
+
120
+ def on_initialize_simulants(self, pop_data: SimulantData) -> None:
121
+ """Initialize the simulants in the population.
122
+
123
+ If all simulants are initialized at age 0, birth prevalence is used.
124
+ Otherwise, prevalence is used.
125
+
126
+ Parameters
127
+ ----------
128
+ pop_data
129
+ The population data object.
130
+ """
131
+ if pop_data.user_data.get("age_end", self.configuration_age_end) == 0:
132
+ initialization_table_name = "birth_prevalence"
133
+ else:
134
+ initialization_table_name = "prevalence"
135
+
136
+ for state in self.states:
137
+ state.lookup_tables["initialization_weights"] = state.lookup_tables[
138
+ initialization_table_name
139
+ ]
140
+
141
+ super().on_initialize_simulants(pop_data)
129
142
 
130
143
  #################
131
144
  # Setup methods #
132
145
  #################
133
146
 
134
147
  def load_cause_specific_mortality_rate(self, builder: Builder) -> float | pd.DataFrame:
135
- if "cause_specific_mortality_rate" not in self._get_data_functions:
148
+ if (
149
+ "cause_specific_mortality_rate" not in self._get_data_functions
150
+ and self._csmr_source is None
151
+ ):
136
152
  only_morbid = builder.data.load(f"cause.{self.cause}.restrictions")["yld_only"]
137
153
  if only_morbid:
138
154
  csmr_data = 0.0
@@ -140,64 +156,14 @@ class DiseaseModel(Machine):
140
156
  csmr_data = builder.data.load(
141
157
  f"{self.cause_type}.{self.cause}.cause_specific_mortality_rate"
142
158
  )
159
+ elif self._csmr_source is not None:
160
+ csmr_data = self.get_data(builder, self._csmr_source)
143
161
  else:
144
162
  csmr_data = self._get_data_functions["cause_specific_mortality_rate"](
145
163
  self.cause, builder
146
164
  )
147
165
  return csmr_data
148
166
 
149
- ########################
150
- # Event-driven methods #
151
- ########################
152
-
153
- def on_initialize_simulants(self, pop_data: SimulantData) -> None:
154
- population = self.population_view.subview(["age", "sex"]).get(pop_data.index)
155
-
156
- assert self.residual_state in {s.state_id for s in self.states}
157
-
158
- if pop_data.user_data["sim_state"] == "setup": # simulation start
159
- if self.configuration_age_start != self.configuration_age_end != 0:
160
- state_names, weights_bins = self.get_state_weights(
161
- pop_data.index, "prevalence"
162
- )
163
- else:
164
- raise NotImplementedError(
165
- "We do not currently support an age 0 cohort. "
166
- "configuration.population.initialization_age_min and "
167
- "configuration.population.initialization_age_max "
168
- "cannot both be 0."
169
- )
170
-
171
- else: # on time step
172
- if pop_data.user_data["age_start"] == pop_data.user_data["age_end"] == 0:
173
- state_names, weights_bins = self.get_state_weights(
174
- pop_data.index, "birth_prevalence"
175
- )
176
- else:
177
- state_names, weights_bins = self.get_state_weights(
178
- pop_data.index, "prevalence"
179
- )
180
-
181
- if state_names and not population.empty:
182
- # only do this if there are states in the model that supply prevalence data
183
- population["sex_id"] = population.sex.apply({"Male": 1, "Female": 2}.get)
184
-
185
- condition_column = self.assign_initial_status_to_simulants(
186
- population,
187
- state_names,
188
- weights_bins,
189
- self.randomness.get_draw(population.index),
190
- )
191
-
192
- condition_column = condition_column.rename(
193
- columns={"condition_state": self.state_column}
194
- )
195
- else:
196
- condition_column = pd.Series(
197
- self.residual_state, index=population.index, name=self.state_column
198
- )
199
- self.population_view.update(condition_column)
200
-
201
167
  ##################################
202
168
  # Pipeline sources and modifiers #
203
169
  ##################################
@@ -209,40 +175,78 @@ class DiseaseModel(Machine):
209
175
  # Helper functions #
210
176
  ####################
211
177
 
212
- def _get_default_residual_state(self):
213
- susceptible_states = [s for s in self.states if isinstance(s, SusceptibleState)]
214
- if len(susceptible_states) != 1:
215
- raise DiseaseModelError("Disease model must have exactly one SusceptibleState.")
216
- return susceptible_states[0].state_id
217
-
218
- def get_state_weights(
219
- self, pop_index: pd.Index, prevalence_type: str
220
- ) -> tuple[list[str], np.ndarray | None]:
221
- states = [state for state in self.states if state.lookup_tables.get(prevalence_type)]
222
-
223
- if not states:
224
- return states, None
178
+ def _get_residual_state(
179
+ self, initial_state: BaseDiseaseState, residual_state: BaseDiseaseState
180
+ ) -> BaseDiseaseState:
181
+ """Get the residual state for the DiseaseModel.
225
182
 
226
- weights = [state.lookup_tables.get(prevalence_type)(pop_index) for state in states]
227
- for w in weights:
228
- w.reset_index(inplace=True, drop=True)
229
- weights += ((1 - np.sum(weights, axis=0)),)
183
+ This will be the residual state if it is provided, otherwise it will be
184
+ the model's SusceptibleState. This method also calculates the residual
185
+ state's birth_prevalence and prevalence.
186
+ """
187
+ if initial_state is not None:
188
+ warnings.warn(
189
+ "In the future, the 'initial_state' argument to DiseaseModel"
190
+ " will be used to initialize all simulants into that state. To"
191
+ " retain the current behavior of defining a residual state, use"
192
+ " the 'residual_state' argument.",
193
+ DeprecationWarning,
194
+ stacklevel=2,
195
+ )
230
196
 
231
- weights = np.array(weights).T
232
- weights_bins = np.cumsum(weights, axis=1)
197
+ if residual_state:
198
+ raise DiseaseModelError(
199
+ "A DiseaseModel cannot be initialized with both"
200
+ " 'initial_state and 'residual_state'."
201
+ )
233
202
 
234
- state_names = [s.state_id for s in states] + [self.residual_state]
203
+ residual_state = initial_state
204
+ elif residual_state is None:
205
+ susceptible_states = [s for s in self.states if isinstance(s, SusceptibleState)]
206
+ if len(susceptible_states) != 1:
207
+ raise DiseaseModelError(
208
+ "Disease model must have exactly one SusceptibleState."
209
+ )
210
+ residual_state = susceptible_states[0]
235
211
 
236
- return state_names, weights_bins
212
+ if residual_state not in self.states:
213
+ raise DiseaseModelError(
214
+ f"Residual state '{self.residual_state}' must be one of the"
215
+ f" states: {self.states}."
216
+ )
237
217
 
238
- @staticmethod
239
- def assign_initial_status_to_simulants(
240
- simulants_df, state_names, weights_bins, propensities
241
- ):
242
- simulants = simulants_df[["age", "sex"]].copy()
218
+ residual_state.birth_prevalence = partial(
219
+ self._get_residual_state_probabilities, table_name="birth_prevalence"
220
+ )
221
+ residual_state.prevalence = partial(
222
+ self._get_residual_state_probabilities, table_name="prevalence"
223
+ )
243
224
 
244
- choice_index = (propensities.values[np.newaxis].T > weights_bins).sum(axis=1)
245
- initial_states = pd.Series(np.array(state_names)[choice_index], index=simulants.index)
225
+ return residual_state
226
+
227
+ def _get_residual_state_probabilities(
228
+ self, builder: Builder, table_name: str
229
+ ) -> LookupTableData:
230
+ """Calculate the probabilities of the residual state based on the other states."""
231
+ non_residual_states = [s for s in self.states if s != self.residual_state]
232
+ non_residual_probabilities = 0
233
+ for state in non_residual_states:
234
+ weights_source = builder.configuration[state.name].data_sources[table_name]
235
+ weights = state.get_data(builder, weights_source)
236
+ if isinstance(weights, pd.DataFrame):
237
+ weights = weights.set_index(
238
+ [c for c in weights.columns if c != "value"]
239
+ ).squeeze()
240
+ non_residual_probabilities += weights
241
+
242
+ residual_probabilities = 1 - non_residual_probabilities
243
+
244
+ if pd.Series(residual_probabilities < 0).any():
245
+ raise ValueError(
246
+ f"The {table_name} for the states in the DiseaseModel must sum"
247
+ " to less than 1."
248
+ )
249
+ if isinstance(residual_probabilities, pd.Series):
250
+ residual_probabilities = residual_probabilities.reset_index()
246
251
 
247
- simulants.loc[:, "condition_state"] = initial_states
248
- return simulants
252
+ return residual_probabilities