vivarium-public-health 3.0.9__tar.gz → 3.0.11__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.0.11/.github/workflows/build.yml +25 -0
  2. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/CHANGELOG.rst +8 -0
  3. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/Jenkinsfile +55 -29
  4. {vivarium_public_health-3.0.9/src/vivarium_public_health.egg-info → vivarium_public_health-3.0.11}/PKG-INFO +1 -1
  5. vivarium_public_health-3.0.11/src/vivarium_public_health/__init__.py +60 -0
  6. vivarium_public_health-3.0.11/src/vivarium_public_health/_version.py +1 -0
  7. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/disease/__init__.py +1 -0
  8. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/population/__init__.py +1 -1
  9. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/population/base_population.py +47 -3
  10. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/population/data_transformations.py +3 -1
  11. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/__init__.py +1 -0
  12. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11/src/vivarium_public_health.egg-info}/PKG-INFO +1 -1
  13. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/population/test_add_new_birth_cohort.py +1 -1
  14. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/population/test_base_population.py +68 -2
  15. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/population/test_data_transformations.py +1 -1
  16. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/test_utilities.py +37 -1
  17. vivarium_public_health-3.0.9/.github/workflows/build.yml +0 -96
  18. vivarium_public_health-3.0.9/src/vivarium_public_health/__init__.py +0 -21
  19. vivarium_public_health-3.0.9/src/vivarium_public_health/_version.py +0 -1
  20. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.bandit +0 -0
  21. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.flake8 +0 -0
  22. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.gitattributes +0 -0
  23. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.github/CODEOWNERS +0 -0
  24. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.github/pull_request_template.md +0 -0
  25. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.github/workflows/deploy.yml +0 -0
  26. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.gitignore +0 -0
  27. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.pylintrc +0 -0
  28. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.readthedocs.yml +0 -0
  29. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/.zenodo.json +0 -0
  30. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/CODE_OF_CONDUCT.rst +0 -0
  31. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/CONTRIBUTING.rst +0 -0
  32. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/LICENSE.txt +0 -0
  33. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/MANIFEST.in +0 -0
  34. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/Makefile +0 -0
  35. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/README.rst +0 -0
  36. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/Makefile +0 -0
  37. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/nitpick-exceptions +0 -0
  38. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/_static/style.css +0 -0
  39. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/_templates/layout.html +0 -0
  40. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/disease/index.rst +0 -0
  41. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/disease/model.rst +0 -0
  42. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/disease/models.rst +0 -0
  43. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/disease/special_disease.rst +0 -0
  44. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/disease/state.rst +0 -0
  45. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/disease/transition.rst +0 -0
  46. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/index.rst +0 -0
  47. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/delay.rst +0 -0
  48. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/disease.rst +0 -0
  49. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/index.rst +0 -0
  50. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/intervention.rst +0 -0
  51. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/magic_wand_components.rst +0 -0
  52. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/observer.rst +0 -0
  53. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/mslt/population.rst +0 -0
  54. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/plugins/index.rst +0 -0
  55. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/plugins/parser.rst +0 -0
  56. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/population/add_new_birth_cohorts.rst +0 -0
  57. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/population/base_population.rst +0 -0
  58. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/population/data_transformations.rst +0 -0
  59. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/population/index.rst +0 -0
  60. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/population/mortality.rst +0 -0
  61. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/disability.rst +0 -0
  62. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/disease.rst +0 -0
  63. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/index.rst +0 -0
  64. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/mortality.rst +0 -0
  65. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/observer.rst +0 -0
  66. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/risk.rst +0 -0
  67. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/simple_cause.rst +0 -0
  68. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/results/stratification.rst +0 -0
  69. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/base_risk.rst +0 -0
  70. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/data_transformations.rst +0 -0
  71. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/distributions.rst +0 -0
  72. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/effect.rst +0 -0
  73. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/implementations/index.rst +0 -0
  74. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/implementations/low_birth_weight_and_short_gestation.rst +0 -0
  75. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/risks/index.rst +0 -0
  76. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/treatment/index.rst +0 -0
  77. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/treatment/magic_wand.rst +0 -0
  78. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/treatment/scale_up.rst +0 -0
  79. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/treatment/therapeutic_inertia.rst +0 -0
  80. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/api_reference/utilities.rst +0 -0
  81. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/conf.py +0 -0
  82. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/index.rst +0 -0
  83. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/tutorials/index.rst +0 -0
  84. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/docs/source/tutorials/risk_exposure.rst +0 -0
  85. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/pyproject.toml +0 -0
  86. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/setup.cfg +0 -0
  87. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/setup.py +0 -0
  88. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/__about__.py +0 -0
  89. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/disease/model.py +0 -0
  90. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/disease/models.py +0 -0
  91. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/disease/special_disease.py +0 -0
  92. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/disease/state.py +0 -0
  93. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/disease/transition.py +0 -0
  94. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/__init__.py +0 -0
  95. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/delay.py +0 -0
  96. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/disease.py +0 -0
  97. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/intervention.py +0 -0
  98. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/magic_wand_components.py +0 -0
  99. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/observer.py +0 -0
  100. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/mslt/population.py +0 -0
  101. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/plugins/__init__.py +0 -0
  102. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/plugins/parser.py +0 -0
  103. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/population/add_new_birth_cohorts.py +0 -0
  104. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/population/mortality.py +0 -0
  105. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/columns.py +0 -0
  106. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/disability.py +0 -0
  107. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/disease.py +0 -0
  108. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/mortality.py +0 -0
  109. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/observer.py +0 -0
  110. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/risk.py +0 -0
  111. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/simple_cause.py +0 -0
  112. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/results/stratification.py +0 -0
  113. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/__init__.py +0 -0
  114. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/base_risk.py +0 -0
  115. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/data_transformations.py +0 -0
  116. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/distributions.py +0 -0
  117. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/effect.py +0 -0
  118. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/implementations/__init__.py +0 -0
  119. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +0 -0
  120. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/treatment/__init__.py +0 -0
  121. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/treatment/magic_wand.py +0 -0
  122. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/treatment/scale_up.py +0 -0
  123. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/treatment/therapeutic_inertia.py +0 -0
  124. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health/utilities.py +0 -0
  125. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health.egg-info/SOURCES.txt +0 -0
  126. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health.egg-info/dependency_links.txt +0 -0
  127. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health.egg-info/not-zip-safe +0 -0
  128. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health.egg-info/requires.txt +0 -0
  129. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/src/vivarium_public_health.egg-info/top_level.txt +0 -0
  130. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/__init__.py +0 -0
  131. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/conftest.py +0 -0
  132. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/disease/__init__.py +0 -0
  133. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/disease/test_disease.py +0 -0
  134. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/disease/test_special_disease.py +0 -0
  135. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/mock_artifact.py +0 -0
  136. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/plugins/__init__.py +0 -0
  137. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/plugins/test_parser.py +0 -0
  138. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/population/__init__.py +0 -0
  139. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/population/conftest.py +0 -0
  140. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/population/test_mortality.py +0 -0
  141. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/__init__.py +0 -0
  142. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/test_categorical_risk_observer.py +0 -0
  143. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/test_disability.py +0 -0
  144. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/test_disability_observer.py +0 -0
  145. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/test_disease_observer.py +0 -0
  146. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/test_mortality_observer.py +0 -0
  147. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/results/test_stratification.py +0 -0
  148. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/__init__.py +0 -0
  149. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/conftest.py +0 -0
  150. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/test_base_risk.py +0 -0
  151. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/test_data_transformations.py +0 -0
  152. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/test_distributions.py +0 -0
  153. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/test_effect.py +0 -0
  154. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/risks/test_low_birth_weight_and_short_gestation.py +0 -0
  155. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/treatment/__init__.py +0 -0
  156. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tests/treatment/test_scale_up.py +0 -0
  157. {vivarium_public_health-3.0.9 → vivarium_public_health-3.0.11}/tox.ini +0 -0
@@ -0,0 +1,25 @@
1
+ # -----------------------------------------------------------------------------
2
+ # - invoked on push, pull_request, manual trigger, or schedule
3
+ # - test under at least 3 versions of python
4
+ # -----------------------------------------------------------------------------
5
+ name: build
6
+ on:
7
+ push:
8
+ pull_request:
9
+ workflow_dispatch:
10
+ schedule:
11
+ - cron: "0 8 * * *"
12
+
13
+ jobs:
14
+ build:
15
+ strategy:
16
+ matrix:
17
+ python-version: ["3.9", "3.10", "3.11"]
18
+ uses:
19
+ ihmeuw/vivarium_build_utils/.github/workflows/build.yml@main
20
+ with:
21
+ dependencies: "layered_config_tree,vivarium"
22
+ skip_mypy: true
23
+ secrets:
24
+ NOTIFY_EMAIL: ${{ secrets.NOTIFY_EMAIL }}
25
+ NOTIFY_PASSWORD: ${{ secrets.NOTIFY_PASSWORD }}
@@ -1,3 +1,11 @@
1
+ **3.0.11 - 11/07/24**
2
+
3
+ - Add ScaledPopulation component to population package
4
+
5
+ **3.0.10 - 10/29/24**
6
+
7
+ - Import subpackage classes to top-level namespace
8
+
1
9
  **3.0.9 - 09/12/24**
2
10
 
3
11
  - Fix broken import in scale_up module
@@ -1,3 +1,15 @@
1
+ def githubUsernameToSlackName(github_author) {
2
+ // Add team members as necessary
3
+ def mapping = [
4
+ "Jim Albright": "albrja",
5
+ "Steve Bachmeier": "sbachmei",
6
+ "Hussain Jafari": "hjafari",
7
+ "Patrick Nast": "pnast",
8
+ "Rajan Mudambi": "rmudambi",
9
+ ]
10
+ return mapping.get(github_author, "channel")
11
+ }
12
+
1
13
  pipeline_name="vivarium_public_health"
2
14
  conda_env_name="${pipeline_name}-${BUILD_NUMBER}"
3
15
  conda_env_path="/tmp/${conda_env_name}"
@@ -190,40 +202,54 @@ pipeline {
190
202
  } // build and deploy stage
191
203
  } // stages bracket within Python matrix
192
204
  post {
193
- always {
194
- sh "${ACTIVATE} && make clean"
195
- sh "rm -rf ${CONDA_ENV_PATH}"
196
- // Delete the workspace directory.
197
- deleteDir()
198
- }
199
- failure {
200
- script {
201
- if (env.BRANCH == "main") {
202
- channelName = "simsci-ci-status"
203
- } else {
204
- channelName = "simsci-ci-status-test"
205
- }
205
+ always {
206
+ sh "${ACTIVATE} && make clean"
207
+ sh "rm -rf ${CONDA_ENV_PATH}"
208
+ // Generate a message to send to Slack.
209
+ script {
210
+ if (env.BRANCH == "main") {
211
+ channelName = "simsci-ci-status"
212
+ } else {
213
+ channelName = "simsci-ci-status-test"
206
214
  }
207
- // TODO: DM the developer instead of the slack channel
208
- echo "This build failed on ${GIT_BRANCH}. Sending a failure message to Slack."
209
- slackSend channel: "#${channelName}",
210
- message: ":x: JOB FAILURE: $JOB_NAME - $BUILD_ID\n\n${BUILD_URL}console\n\n<!channel>",
215
+ // Run git command to get the author of the last commit
216
+ developerID = sh(
217
+ script: "git log -1 --pretty=format:'%an'",
218
+ returnStdout: true
219
+ ).trim()
220
+ slackID = githubUsernameToSlackName(developerID)
221
+ slackMessage = """
222
+ Job: *${env.JOB_NAME}*
223
+ Build number: #${env.BUILD_NUMBER}
224
+ Build status: *${currentBuild.result}*
225
+ Author: @${slackID}
226
+ Build details: <${env.BUILD_URL}/console|See in web console>
227
+ """.stripIndent()
228
+ }
229
+
230
+ // Delete the workspace directory.
231
+ deleteDir()
232
+ }
233
+ failure {
234
+ echo "This build triggered by ${developerID} failed on ${GIT_BRANCH}. Sending a failure message to Slack."
235
+ slackSend channel: "#${channelName}",
236
+ message: slackMessage,
237
+ teamDomain: "ihme",
238
+ tokenCredentialId: "slack"
239
+ }
240
+ success {
241
+ script {
242
+ if (params.DEBUG) {
243
+ echo 'Debug is enabled. Sending a success message to Slack.'
244
+ slackSend channel: "#${channelName}",
245
+ message: slackMessage,
211
246
  teamDomain: "ihme",
212
247
  tokenCredentialId: "slack"
213
- }
214
- success {
215
- script {
216
- if (params.DEBUG) {
217
- echo 'Debug is enabled. Sending a success message to Slack.'
218
- slackSend channel: "#${params.SLACK_TO}",
219
- message: ":white_check_mark: (debugging) JOB SUCCESS: $JOB_NAME - $BUILD_ID\n\n${BUILD_URL}console",
220
- teamDomain: "ihme",
221
- tokenCredentialId: "slack"
222
- } else {
223
- echo 'Debug is not enabled. No success message will be sent to Slack.'
224
- }
248
+ } else {
249
+ echo 'Debug is not enabled. No success message will be sent to Slack.'
225
250
  }
226
251
  }
252
+ }
227
253
  } // post bracket
228
254
  } // Python matrix bracket
229
255
  } // Python matrix stage bracket
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium_public_health
3
- Version: 3.0.9
3
+ Version: 3.0.11
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,60 @@
1
+ from vivarium_public_health.__about__ import (
2
+ __author__,
3
+ __copyright__,
4
+ __email__,
5
+ __license__,
6
+ __summary__,
7
+ __title__,
8
+ __uri__,
9
+ )
10
+ from vivarium_public_health._version import __version__
11
+ from vivarium_public_health.disease import (
12
+ SI,
13
+ SIR,
14
+ SIS,
15
+ DiseaseModel,
16
+ DiseaseState,
17
+ NeonatalSWC_with_incidence,
18
+ NeonatalSWC_without_incidence,
19
+ RecoveredState,
20
+ RiskAttributableDisease,
21
+ SIR_fixed_duration,
22
+ SIS_fixed_duration,
23
+ SusceptibleState,
24
+ TransientDiseaseState,
25
+ )
26
+ from vivarium_public_health.plugins import CausesConfigurationParser
27
+ from vivarium_public_health.population import (
28
+ BasePopulation,
29
+ FertilityAgeSpecificRates,
30
+ FertilityCrudeBirthRate,
31
+ FertilityDeterministic,
32
+ Mortality,
33
+ ScaledPopulation,
34
+ )
35
+ from vivarium_public_health.results import (
36
+ CategoricalRiskObserver,
37
+ DisabilityObserver,
38
+ DiseaseObserver,
39
+ MortalityObserver,
40
+ ResultsStratifier,
41
+ )
42
+ from vivarium_public_health.risks import (
43
+ LBWSGRisk,
44
+ LBWSGRiskEffect,
45
+ NonLogLinearRiskEffect,
46
+ Risk,
47
+ RiskEffect,
48
+ )
49
+ from vivarium_public_health.treatment import AbsoluteShift, LinearScaleUp, TherapeuticInertia
50
+
51
+ __all__ = [
52
+ __author__,
53
+ __copyright__,
54
+ __email__,
55
+ __license__,
56
+ __summary__,
57
+ __title__,
58
+ __uri__,
59
+ __version__,
60
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "3.0.11"
@@ -5,6 +5,7 @@ from .models import (
5
5
  SIS,
6
6
  NeonatalSWC_with_incidence,
7
7
  NeonatalSWC_without_incidence,
8
+ SIR_fixed_duration,
8
9
  SIS_fixed_duration,
9
10
  )
10
11
  from .special_disease import RiskAttributableDisease
@@ -3,5 +3,5 @@ from .add_new_birth_cohorts import (
3
3
  FertilityCrudeBirthRate,
4
4
  FertilityDeterministic,
5
5
  )
6
- from .base_population import BasePopulation, generate_population
6
+ from .base_population import BasePopulation, ScaledPopulation, generate_population
7
7
  from .mortality import Mortality
@@ -8,6 +8,8 @@ characteristics to simulants.
8
8
 
9
9
  """
10
10
 
11
+ from __future__ import annotations
12
+
11
13
  from typing import Callable, Dict, Iterable, List
12
14
 
13
15
  import numpy as np
@@ -76,12 +78,11 @@ class BasePopulation(Component):
76
78
  # Validate configuration for deprecated keys
77
79
  self._validate_config_for_deprecated_keys()
78
80
 
79
- source_population_structure = load_population_structure(builder)
81
+ source_population_structure = self._load_population_structure(builder)
80
82
  self.demographic_proportions = assign_demographic_proportions(
81
83
  source_population_structure,
82
84
  include_sex=self.config.include_sex,
83
85
  )
84
-
85
86
  self.randomness = self.get_randomness_streams(builder)
86
87
  self.register_simulants = builder.randomness.register_simulants
87
88
 
@@ -138,7 +139,6 @@ class BasePopulation(Component):
138
139
  demographic_proportions = self.get_demographic_proportions_for_creation_time(
139
140
  self.demographic_proportions, pop_data.creation_time.year
140
141
  )
141
-
142
142
  self.population_view.update(
143
143
  generate_population(
144
144
  simulant_ids=pop_data.index,
@@ -202,6 +202,50 @@ class BasePopulation(Component):
202
202
  f"Public Health. Use the new key '{mapper[key]}' instead."
203
203
  )
204
204
 
205
+ def _load_population_structure(self, builder: Builder) -> pd.DataFrame:
206
+ return load_population_structure(builder)
207
+
208
+
209
+ class ScaledPopulation(BasePopulation):
210
+ """This component is to be used in place of BasePopulation when all simulants are
211
+ a subset of the total population and need to be rescaled. The base population
212
+ structure is multiplied by a provided scaling factor. This scaling factor
213
+ can be a dataframe passed in or a string that corresponds to an artifact key.
214
+ If providing an artifact key, users can specify that in the configuration file.
215
+ For example:
216
+
217
+ .. code-block:: yaml
218
+
219
+ components:
220
+ vivarium_public_health:
221
+ population:
222
+ - ScaledPopulation("some.artifact.key")
223
+
224
+
225
+ """
226
+
227
+ def __init__(self, scaling_factor: str | pd.DataFrame):
228
+ super().__init__()
229
+ self.scaling_factor = scaling_factor
230
+ """Set a multiplicative scaling factor for the population structure."""
231
+
232
+ def _load_population_structure(self, builder: Builder) -> pd.DataFrame:
233
+ scaling_factor = self.get_data(builder, self.scaling_factor)
234
+ population_structure = load_population_structure(builder)
235
+ if not isinstance(scaling_factor, pd.DataFrame):
236
+ raise ValueError(
237
+ f"Scaling factor must be a pandas DataFrame. Provided value: {scaling_factor}"
238
+ )
239
+ scaling_factor = scaling_factor.set_index(
240
+ [col for col in scaling_factor.columns if col != "value"]
241
+ )
242
+ population_structure = population_structure.set_index(
243
+ [col for col in population_structure.columns if col != "value"]
244
+ )
245
+ scaled_population_structure = (population_structure * scaling_factor).reset_index()
246
+
247
+ return scaled_population_structure
248
+
205
249
 
206
250
  class AgeOutSimulants(Component):
207
251
  """Component for handling aged-out simulants"""
@@ -13,6 +13,7 @@ from typing import Tuple, Union
13
13
 
14
14
  import numpy as np
15
15
  import pandas as pd
16
+ from vivarium.framework.engine import Builder
16
17
  from vivarium.framework.randomness import RandomnessStream
17
18
 
18
19
  _SORT_ORDER = ["location", "year_start", "sex", "age_start"]
@@ -493,11 +494,12 @@ def get_cause_deleted_mortality_rate(all_cause_mortality_rate, list_of_csmrs):
493
494
  )
494
495
 
495
496
 
496
- def load_population_structure(builder):
497
+ def load_population_structure(builder: Builder) -> pd.DataFrame:
497
498
  data = builder.data.load("population.structure")
498
499
  # create an age column which is the midpoint of the age group
499
500
  data["age"] = data.apply(lambda row: (row["age_start"] + row["age_end"]) / 2, axis=1)
500
501
  data["location"] = builder.data.load("population.location")
502
+
501
503
  return data
502
504
 
503
505
 
@@ -4,4 +4,5 @@ from .disease import DiseaseObserver
4
4
  from .mortality import MortalityObserver
5
5
  from .observer import PublicHealthObserver
6
6
  from .risk import CategoricalRiskObserver
7
+ from .simple_cause import SimpleCause
7
8
  from .stratification import ResultsStratifier
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium_public_health
3
- Version: 3.0.9
3
+ Version: 3.0.11
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
@@ -130,7 +130,7 @@ def test_FertilityCrudeBirthRate_extrapolate(base_config, base_plugins):
130
130
  }
131
131
  )
132
132
  pop_size = base_config.population.population_size
133
- true_pop_size = 50000 # What's available in the mock artifact
133
+ true_pop_size = 25000 # What's available in the mock artifact
134
134
  live_births_by_sex = 500
135
135
  components = [TestPopulation(), FertilityCrudeBirthRate()]
136
136
 
@@ -1,15 +1,16 @@
1
1
  import math
2
- from pathlib import Path
3
2
 
4
3
  import numpy as np
5
4
  import pandas as pd
6
5
  import pytest
7
6
  from vivarium import InteractiveContext
8
7
  from vivarium.testing_utilities import get_randomness
8
+ from vivarium_testing_utils import FuzzyChecker
9
9
 
10
10
  import vivarium_public_health.population.base_population as bp
11
11
  import vivarium_public_health.population.data_transformations as dt
12
- from tests.test_utilities import make_uniform_pop_data
12
+ from tests.mock_artifact import MockArtifact
13
+ from tests.test_utilities import make_uniform_pop_data, simple_pop_structure
13
14
  from vivarium_public_health import utilities
14
15
 
15
16
 
@@ -283,6 +284,71 @@ def test__assign_demography_with_age_bounds_error(base_simulants, include_sex):
283
284
  )
284
285
 
285
286
 
287
+ @pytest.mark.parametrize("constructor_type", ["string", "data"])
288
+ def test_scaled_population(
289
+ constructor_type, config, base_plugins, mocker, fuzzy_checker: FuzzyChecker
290
+ ):
291
+ config.update(
292
+ {
293
+ "population": {
294
+ "population_size": 1_000_000,
295
+ "include_sex": "Both",
296
+ },
297
+ "time": {"step_size": 1},
298
+ },
299
+ layer="override",
300
+ )
301
+
302
+ # Simple pop data
303
+ pop_structure = simple_pop_structure()
304
+ # Simple scalar data to pass to ScaledPopulation
305
+ scalar_data = simple_pop_structure().drop(columns=["location"])
306
+ scalar_values = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
307
+ scalar_data["value"] = scalar_values
308
+
309
+ # Add data to artifact and mock return for plugin
310
+ mock_art = MockArtifact()
311
+ mock_art.write("population.structure", pop_structure)
312
+ mocker.patch(
313
+ "tests.mock_artifact.MockArtifactManager._load_artifact",
314
+ ).return_value = mock_art
315
+
316
+ if constructor_type == "string":
317
+ mock_art.write("population.scalar", scalar_data)
318
+ scaling_factor = "population.scalar"
319
+ else:
320
+ scaling_factor = scalar_data
321
+ scaled_pop = bp.ScaledPopulation(scaling_factor)
322
+ sim = InteractiveContext(
323
+ components=[scaled_pop], configuration=config, plugin_configuration=base_plugins
324
+ )
325
+ pop = sim.get_population()
326
+ # Use FuzzyChecker to compare population structure to demographic proportion by
327
+ # iterating through each age_group/sex combination
328
+ scaled_structure = pop_structure.copy()
329
+ scaled_structure["value"] = scaled_structure["value"] * scalar_data["value"]
330
+
331
+ for row in range(len(scaled_structure)):
332
+ row_data = scaled_structure.iloc[row]
333
+ age_start = row_data["age_start"]
334
+ sex = row_data["sex"]
335
+ # Get proportion of each age group
336
+ target_proportion = row_data["value"] / scaled_structure["value"].sum()
337
+ number_of_sims = len(
338
+ pop.loc[
339
+ (pop["age"] >= age_start)
340
+ & (pop["age"] <= row_data["age_end"])
341
+ & (pop["sex"] == sex)
342
+ ]
343
+ )
344
+ fuzzy_checker.fuzzy_assert_proportion(
345
+ observed_numerator=number_of_sims,
346
+ observed_denominator=len(pop),
347
+ target_proportion=target_proportion,
348
+ name=f"scaled_pop_proportion_check_{sex}_{age_start}",
349
+ )
350
+
351
+
286
352
  def _check_population(simulants, initial_age, step_size, include_sex):
287
353
  assert len(simulants) == len(simulants.age.unique())
288
354
  assert simulants.age.min() > initial_age
@@ -127,7 +127,7 @@ def test_smooth_ages(pop_data, include_sex):
127
127
  "sex": (
128
128
  ["Male", "Female"] * 10000 if include_sex == "Both" else [include_sex] * 20000
129
129
  ),
130
- "location": [1, 2] * 10000,
130
+ "location": [1] * 20000,
131
131
  }
132
132
  )
133
133
  randomness = get_randomness()
@@ -64,7 +64,7 @@ def make_uniform_pop_data(age_bin_midpoint=False):
64
64
  age_bins = [(b.age_start, b.age_end) for b in make_age_bins().itertuples()]
65
65
  sexes = ("Male", "Female")
66
66
  years = zip(range(1990, 2018), range(1991, 2019))
67
- locations = (1, 2)
67
+ locations = list(range(1, 2))
68
68
 
69
69
  age_bins, sexes, years, locations = zip(*product(age_bins, sexes, years, locations))
70
70
  mins, maxes = zip(*age_bins)
@@ -116,3 +116,39 @@ def make_age_bins():
116
116
  names=["age_start", "age_end", "age_group_name"],
117
117
  )
118
118
  return pd.DataFrame(index=idx).reset_index()
119
+
120
+
121
+ def simple_pop_structure() -> pd.DataFrame:
122
+ # Create simple population structure
123
+ age_idx = pd.MultiIndex.from_tuples(
124
+ [
125
+ (0.0, 25.0, "Young People"),
126
+ (25.0, 50.0, "Old People"),
127
+ (50.0, 75.0, "Ancient People"),
128
+ (75.0, 100.0, "People Who Beat the Odds"),
129
+ ],
130
+ names=["age_start", "age_end", "age_group_name"],
131
+ )
132
+ age_df = pd.DataFrame(index=age_idx).reset_index()
133
+ age_bins = [(group.age_start, group.age_end) for group in age_df.itertuples()]
134
+ sexes = ("Male", "Female")
135
+ location = ["Kenya"]
136
+ years = zip(range(2021, 2022), range(2022, 2023))
137
+
138
+ age_bins, sexes, years, location = zip(*product(age_bins, sexes, years, location))
139
+ mins, maxes = zip(*age_bins)
140
+ year_starts, year_ends = zip(*years)
141
+
142
+ pop_structure = pd.DataFrame(
143
+ {
144
+ "age_start": mins,
145
+ "age_end": maxes,
146
+ "sex": sexes,
147
+ "year_start": year_starts,
148
+ "year_end": year_ends,
149
+ "location": location,
150
+ # We have 8 demographic groups (4 age groups * 2 sexes)
151
+ "value": [1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0],
152
+ }
153
+ )
154
+ return pop_structure
@@ -1,96 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- # - invoked on push, pull_request, manual trigger, or schedule
3
- # - test under at least 3 versions of python
4
- # -----------------------------------------------------------------------------
5
- name: build
6
- on:
7
- push:
8
- pull_request:
9
- workflow_dispatch:
10
- schedule:
11
- - cron: "0 8 * * *"
12
-
13
- jobs:
14
- build:
15
- runs-on: ubuntu-latest
16
- strategy:
17
- matrix:
18
- python-version: ["3.9", "3.10", "3.11"]
19
- defaults:
20
- run:
21
- shell: bash -le {0}
22
- steps:
23
- - uses: actions/checkout@v3
24
- with:
25
- fetch-depth: 0
26
- - name: Set up Python ${{ matrix.python-version }}
27
- uses: actions/setup-python@v4
28
- with:
29
- python-version: ${{ matrix.python-version }}
30
- - name: get upstream branch name
31
- run: |
32
- if "${{ github.event_name == 'pull_request' }}" ; then
33
- echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
34
- else
35
- echo "branch_name=${GITHUB_REF_NAME}" >> $GITHUB_ENV
36
- fi
37
- - name: Update pip
38
- run: |
39
- python -m pip install --upgrade pip
40
- - name: Install dependencies
41
- run: |
42
- pip install .[dev]
43
- git checkout ${branch_name}
44
- - name: check for dependency branches and install if needed
45
- run: |
46
- cd ..
47
- git clone https://github.com/ihmeuw/vivarium_build_utils.git
48
- cd vivarium_public_health
49
- echo "Contents of install_dependency_branch.sh"
50
- echo "----------------------------------------"
51
- cat ../vivarium_build_utils/install_dependency_branch.sh
52
- echo ""
53
- echo "----------------------------------------"
54
- sh ../vivarium_build_utils/install_dependency_branch.sh layered_config_tree ${branch_name} github
55
- sh ../vivarium_build_utils/install_dependency_branch.sh vivarium ${branch_name} github
56
- sh ../vivarium_build_utils/install_dependency_branch.sh risk_distributions ${branch_name} github
57
- - name: print environment values
58
- run: |
59
- cat $GITHUB_ENV
60
- - name: Lint
61
- run: |
62
- pip install black==22.3.0 isort
63
- isort . --check --verbose --only-modified --diff
64
- black . --check --diff
65
- - name: Test
66
- run: |
67
- if "${{ github.event_name == 'schedule' }}"; then
68
- pytest --runslow ./tests
69
- else
70
- pytest ./tests
71
- fi
72
- - name: Doc build
73
- run: |
74
- make html -C docs/ SPHINXOPTS="-W --keep-going -n"
75
- - name: Doctest
76
- run: |
77
- make doctest -C docs/
78
- - name: Send mail
79
- # Notify when cron job fails
80
- if: (github.event_name == 'schedule' && failure())
81
- uses: dawidd6/action-send-mail@v2
82
- with:
83
- # mail server settings
84
- server_address: smtp.gmail.com
85
- server_port: 465
86
- # user credentials
87
- username: ${{ secrets.NOTIFY_EMAIL }}
88
- password: ${{ secrets.NOTIFY_PASSWORD }}
89
- # email subject
90
- subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
91
- # email body as text
92
- body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
93
- # comma-separated string, send email to
94
- to: uw_ihme_simulationscience@uw.edu
95
- # from email name
96
- from: Vivarium Notifications
@@ -1,21 +0,0 @@
1
- from vivarium_public_health.__about__ import (
2
- __author__,
3
- __copyright__,
4
- __email__,
5
- __license__,
6
- __summary__,
7
- __title__,
8
- __uri__,
9
- )
10
- from vivarium_public_health._version import __version__
11
-
12
- __all__ = [
13
- __author__,
14
- __copyright__,
15
- __email__,
16
- __license__,
17
- __summary__,
18
- __title__,
19
- __uri__,
20
- __version__,
21
- ]
@@ -1 +0,0 @@
1
- __version__ = "3.0.9"