vivarium-public-health 2.1.0__tar.gz → 2.1.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.github/workflows/build.yml +21 -2
  2. vivarium_public_health-2.1.2/.github/workflows/deploy.yml +50 -0
  3. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/CHANGELOG.rst +8 -0
  4. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/PKG-INFO +1 -1
  5. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/nitpick-exceptions +3 -1
  6. vivarium_public_health-2.1.2/src/vivarium_public_health/_version.py +1 -0
  7. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/disease/state.py +142 -40
  8. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/population/mortality.py +40 -0
  9. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/effect.py +28 -0
  10. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/treatment/scale_up.py +31 -0
  11. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health.egg-info/PKG-INFO +1 -1
  12. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/disease/test_disease.py +9 -13
  13. vivarium_public_health-2.1.0/.github/workflows/deploy.yml +0 -31
  14. vivarium_public_health-2.1.0/src/vivarium_public_health/_version.py +0 -1
  15. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.gitattributes +0 -0
  16. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.github/CODEOWNERS +0 -0
  17. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.github/pull_request_template.md +0 -0
  18. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.gitignore +0 -0
  19. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.pylintrc +0 -0
  20. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.readthedocs.yml +0 -0
  21. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/.zenodo.json +0 -0
  22. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/CODE_OF_CONDUCT.rst +0 -0
  23. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/CONTRIBUTING.rst +0 -0
  24. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/LICENSE.txt +0 -0
  25. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/MANIFEST.in +0 -0
  26. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/README.rst +0 -0
  27. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/Makefile +0 -0
  28. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/_static/style.css +0 -0
  29. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/_templates/layout.html +0 -0
  30. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/disease/index.rst +0 -0
  31. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/disease/model.rst +0 -0
  32. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/disease/models.rst +0 -0
  33. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/disease/special_disease.rst +0 -0
  34. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/disease/state.rst +0 -0
  35. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/disease/transition.rst +0 -0
  36. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/index.rst +0 -0
  37. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/metrics/disability.rst +0 -0
  38. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/metrics/disease.rst +0 -0
  39. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/metrics/index.rst +0 -0
  40. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/metrics/mortality.rst +0 -0
  41. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/metrics/risk.rst +0 -0
  42. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/metrics/stratification.rst +0 -0
  43. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/delay.rst +0 -0
  44. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/disease.rst +0 -0
  45. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/index.rst +0 -0
  46. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/intervention.rst +0 -0
  47. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/magic_wand_components.rst +0 -0
  48. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/observer.rst +0 -0
  49. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/mslt/population.rst +0 -0
  50. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/population/add_new_birth_cohorts.rst +0 -0
  51. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/population/base_population.rst +0 -0
  52. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/population/data_transformations.rst +0 -0
  53. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/population/index.rst +0 -0
  54. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/population/mortality.rst +0 -0
  55. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/base_risk.rst +0 -0
  56. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/data_transformations.rst +0 -0
  57. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/distributions.rst +0 -0
  58. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/effect.rst +0 -0
  59. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/implementations/index.rst +0 -0
  60. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/implementations/low_birth_weight_and_short_gestation.rst +0 -0
  61. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/risks/index.rst +0 -0
  62. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/testing/index.rst +0 -0
  63. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/testing/mock_artifact.rst +0 -0
  64. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/testing/utils.rst +0 -0
  65. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/treatment/index.rst +0 -0
  66. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/treatment/magic_wand.rst +0 -0
  67. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/treatment/scale_up.rst +0 -0
  68. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/treatment/therapeutic_inertia.rst +0 -0
  69. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/api_reference/utilities.rst +0 -0
  70. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/conf.py +0 -0
  71. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/index.rst +0 -0
  72. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/tutorials/index.rst +0 -0
  73. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/docs/source/tutorials/risk_exposure.rst +0 -0
  74. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/pyproject.toml +0 -0
  75. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/setup.cfg +0 -0
  76. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/setup.py +0 -0
  77. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/__about__.py +0 -0
  78. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/__init__.py +0 -0
  79. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/disease/__init__.py +0 -0
  80. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/disease/model.py +0 -0
  81. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/disease/models.py +0 -0
  82. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/disease/special_disease.py +0 -0
  83. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/disease/transition.py +0 -0
  84. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/metrics/__init__.py +0 -0
  85. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/metrics/disability.py +0 -0
  86. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/metrics/disease.py +0 -0
  87. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/metrics/mortality.py +0 -0
  88. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/metrics/risk.py +0 -0
  89. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/metrics/stratification.py +0 -0
  90. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/__init__.py +0 -0
  91. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/delay.py +0 -0
  92. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/disease.py +0 -0
  93. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/intervention.py +0 -0
  94. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/magic_wand_components.py +0 -0
  95. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/observer.py +0 -0
  96. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/mslt/population.py +0 -0
  97. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/population/__init__.py +0 -0
  98. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/population/add_new_birth_cohorts.py +0 -0
  99. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/population/base_population.py +0 -0
  100. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/population/data_transformations.py +0 -0
  101. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/__init__.py +0 -0
  102. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/base_risk.py +0 -0
  103. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/data_transformations.py +0 -0
  104. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/distributions.py +0 -0
  105. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/implementations/__init__.py +0 -0
  106. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +0 -0
  107. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/testing/__init__.py +0 -0
  108. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/testing/mock_artifact.py +0 -0
  109. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/testing/utils.py +0 -0
  110. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/treatment/__init__.py +0 -0
  111. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/treatment/magic_wand.py +0 -0
  112. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/treatment/therapeutic_inertia.py +0 -0
  113. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health/utilities.py +0 -0
  114. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health.egg-info/SOURCES.txt +0 -0
  115. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health.egg-info/dependency_links.txt +0 -0
  116. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health.egg-info/not-zip-safe +0 -0
  117. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health.egg-info/requires.txt +0 -0
  118. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/src/vivarium_public_health.egg-info/top_level.txt +0 -0
  119. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/__init__.py +0 -0
  120. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/conftest.py +0 -0
  121. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/disease/__init__.py +0 -0
  122. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/disease/test_special_disease.py +0 -0
  123. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/__init__.py +0 -0
  124. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/test_categorical_risk_observer.py +0 -0
  125. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/test_disability.py +0 -0
  126. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/test_disability_observer.py +0 -0
  127. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/test_disease_observer.py +0 -0
  128. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/test_mortality_observer.py +0 -0
  129. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/metrics/test_stratification.py +0 -0
  130. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/population/__init__.py +0 -0
  131. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/population/conftest.py +0 -0
  132. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/population/test_add_new_birth_cohort.py +0 -0
  133. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/population/test_base_population.py +0 -0
  134. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/population/test_data_transformations.py +0 -0
  135. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/risks/__init__.py +0 -0
  136. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/risks/conftest.py +0 -0
  137. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/risks/test_base_risk.py +0 -0
  138. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/risks/test_data_transformations.py +0 -0
  139. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/risks/test_distributions.py +0 -0
  140. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/risks/test_effect.py +0 -0
  141. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/test_utilities.py +0 -0
  142. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tests/treatment/__init__.py +0 -0
  143. {vivarium_public_health-2.1.0 → vivarium_public_health-2.1.2}/tox.ini +0 -0
@@ -15,7 +15,7 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- python-version: ["3.9", "3.10", "3.11", "3.12"]
18
+ python-version: ["3.9", "3.10", "3.11"]
19
19
  defaults:
20
20
  run:
21
21
  shell: bash -le {0}
@@ -63,7 +63,7 @@ jobs:
63
63
  isort . --check --verbose --only-modified --diff
64
64
  - name: Test
65
65
  run: |
66
- if github.event_name == 'schedule'; then
66
+ if "${{ github.event_name == 'schedule' }}"; then
67
67
  pytest --runslow ./tests
68
68
  else
69
69
  pytest ./tests
@@ -74,3 +74,22 @@ jobs:
74
74
  - name: Doctest
75
75
  run: |
76
76
  make doctest -C docs/
77
+ - name: Send mail
78
+ # Notify when cron job fails
79
+ if: (github.event_name == 'schedule' && failure())
80
+ uses: dawidd6/action-send-mail@v2
81
+ with:
82
+ # mail server settings
83
+ server_address: smtp.gmail.com
84
+ server_port: 465
85
+ # user credentials
86
+ username: ${{ secrets.NOTIFY_EMAIL }}
87
+ password: ${{ secrets.NOTIFY_PASSWORD }}
88
+ # email subject
89
+ subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
90
+ # email body as text
91
+ body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
92
+ # comma-separated string, send email to
93
+ to: uw_ihme_simulationscience@uw.edu
94
+ # from email name
95
+ from: Vivarium Notifications
@@ -0,0 +1,50 @@
1
+ name: deploy
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v4
14
+ with:
15
+ python-version: '3.11'
16
+ - name: Install dependencies
17
+ run: |
18
+ python --version
19
+ python -m pip install --upgrade pip
20
+ pip install setuptools wheel twine
21
+ - name: Test
22
+ run: |
23
+ pip install .[test]
24
+ pytest --runslow ./tests
25
+ - name: Build and publish
26
+ env:
27
+ TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28
+ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29
+ run: |
30
+ python setup.py sdist bdist_wheel
31
+ twine upload dist/*
32
+ - name: Send mail
33
+ # Notify when cron job fails
34
+ if: failure()
35
+ uses: dawidd6/action-send-mail@v2
36
+ with:
37
+ # mail server settings
38
+ server_address: smtp.gmail.com
39
+ server_port: 465
40
+ # user credentials
41
+ username: ${{ secrets.NOTIFY_EMAIL }}
42
+ password: ${{ secrets.NOTIFY_PASSWORD }}
43
+ # email subject
44
+ subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
45
+ # email body as text
46
+ body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
47
+ # comma-separated string, send email to
48
+ to: uw_ihme_simulationscience@uw.edu
49
+ # from email name
50
+ from: Vivarium Notifications
@@ -1,3 +1,11 @@
1
+ **2.1.2 - 12/21/23**
2
+
3
+ - Fix tests failing due to Vivarium 2.3.0 release
4
+
5
+ **2.1.1 - 10/13/23**
6
+
7
+ - Perform actions in DiseaseState setup using class methods rather than hardcoding to allow for cleaner subclassing
8
+
1
9
  **2.1.0 - 10/05/23**
2
10
 
3
11
  - Remove explicit support for Python 3.8
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium_public_health
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: Components for modelling diseases, risks, and interventions with ``vivarium``
5
5
  Home-page: https://github.com/ihmeuw/vivarium_public_health
6
6
  Author: The vivarium developers
@@ -16,4 +16,6 @@ py:class Logger
16
16
  # TODO: Need to revisit this. Nitpicking here to avoid failing everywhere
17
17
  py:class Builder
18
18
  py:class SimulantData
19
- py:class Event
19
+ py:class Event
20
+ py:class LookupTable
21
+ py:class Pipeline
@@ -0,0 +1 @@
1
+ __version__ = "2.1.2"
@@ -11,10 +11,11 @@ from typing import Callable, Dict, List, Optional
11
11
  import numpy as np
12
12
  import pandas as pd
13
13
  from vivarium.framework.engine import Builder
14
- from vivarium.framework.lookup import LookupTableData
14
+ from vivarium.framework.lookup import LookupTable, LookupTableData
15
15
  from vivarium.framework.population import PopulationView, SimulantData
16
+ from vivarium.framework.randomness import RandomnessStream
16
17
  from vivarium.framework.state_machine import State, Transient, Transition, Trigger
17
- from vivarium.framework.values import list_combiner, union_post_processor
18
+ from vivarium.framework.values import Pipeline, list_combiner, union_post_processor
18
19
 
19
20
  from vivarium_public_health.disease.transition import (
20
21
  ProportionTransition,
@@ -323,65 +324,41 @@ class DiseaseState(BaseDiseaseState):
323
324
  self.clock = builder.time.clock()
324
325
 
325
326
  prevalence_data = self.load_prevalence_data(builder)
326
- self.prevalence = builder.lookup.build_table(
327
- prevalence_data, key_columns=["sex"], parameter_columns=["age", "year"]
328
- )
327
+ self.prevalence = self.get_prevalence(builder, prevalence_data)
329
328
 
330
329
  birth_prevalence_data = self.load_birth_prevalence_data(builder)
331
- self.birth_prevalence = builder.lookup.build_table(
332
- birth_prevalence_data, key_columns=["sex"], parameter_columns=["year"]
333
- )
330
+ self.birth_prevalence = self.get_birth_prevalence(builder, birth_prevalence_data)
334
331
 
335
332
  dwell_time_data = self.load_dwell_time_data(builder)
336
- self.dwell_time = builder.value.register_value_producer(
337
- f"{self.state_id}.dwell_time",
338
- source=builder.lookup.build_table(
339
- dwell_time_data, key_columns=["sex"], parameter_columns=["age", "year"]
340
- ),
341
- requires_columns=["age", "sex"],
342
- )
333
+ self.dwell_time = self.get_dwell_time_pipeline(builder, dwell_time_data)
343
334
 
344
335
  disability_weight_data = self.load_disability_weight_data(builder)
345
336
  self.has_disability = is_non_zero(disability_weight_data)
346
- self.base_disability_weight = builder.lookup.build_table(
347
- disability_weight_data, key_columns=["sex"], parameter_columns=["age", "year"]
348
- )
349
- self.disability_weight = builder.value.register_value_producer(
350
- f"{self.state_id}.disability_weight",
351
- source=self.compute_disability_weight,
352
- requires_columns=["age", "sex", "alive", self.model],
337
+ self.base_disability_weight = self.get_base_disability_weight(
338
+ builder, disability_weight_data
353
339
  )
340
+
341
+ self.disability_weight = self.get_disability_weight_pipeline(builder)
342
+
354
343
  builder.value.register_value_modifier(
355
344
  "disability_weight", modifier=self.disability_weight
356
345
  )
357
346
 
358
347
  excess_mortality_data = self.load_excess_mortality_rate_data(builder)
359
348
  self.has_excess_mortality = is_non_zero(excess_mortality_data)
360
- self.base_excess_mortality_rate = builder.lookup.build_table(
361
- excess_mortality_data, key_columns=["sex"], parameter_columns=["age", "year"]
362
- )
363
- self.excess_mortality_rate = builder.value.register_rate_producer(
364
- self.excess_mortality_rate_pipeline_name,
365
- source=self.compute_excess_mortality_rate,
366
- requires_columns=["age", "sex", "alive", self.model],
367
- requires_values=[self.excess_mortality_rate_paf_pipeline_name],
368
- )
369
- paf = builder.lookup.build_table(0)
370
- self.joint_paf = builder.value.register_value_producer(
371
- self.excess_mortality_rate_paf_pipeline_name,
372
- source=lambda idx: [paf(idx)],
373
- preferred_combiner=list_combiner,
374
- preferred_post_processor=union_post_processor,
349
+ self.base_excess_mortality_rate = self.get_base_excess_mortality_rate(
350
+ builder, excess_mortality_data
375
351
  )
352
+ self.excess_mortality_rate = self.get_excess_mortality_rate_pipeline(builder)
353
+ self.joint_paf = self.get_joint_paf(builder)
354
+
376
355
  builder.value.register_value_modifier(
377
356
  "mortality_rate",
378
357
  modifier=self.adjust_mortality_rate,
379
358
  requires_values=[self.excess_mortality_rate_pipeline_name],
380
359
  )
381
360
 
382
- self.randomness_prevalence = builder.randomness.get_stream(
383
- f"{self.state_id}_prevalent_cases"
384
- )
361
+ self.randomness_prevalence = self.get_randomness_prevalence(builder)
385
362
 
386
363
  #################
387
364
  # Setup methods #
@@ -393,12 +370,55 @@ class DiseaseState(BaseDiseaseState):
393
370
  else:
394
371
  return builder.data.load(f"{self.cause_type}.{self.state_id}.prevalence")
395
372
 
373
+ def get_prevalence(
374
+ self, builder: Builder, prevalence_data: LookupTableData
375
+ ) -> LookupTable:
376
+ """Builds a LookupTable for the prevalence of this state.
377
+
378
+ Parameters
379
+ ----------
380
+ builder
381
+ Interface to access simulation managers.
382
+ prevalence_data
383
+ The data to use to build the LookupTable.
384
+
385
+ Returns
386
+ -------
387
+ LookupTable
388
+ The LookupTable for the prevalence of this state.
389
+ """
390
+ return builder.lookup.build_table(
391
+ prevalence_data, key_columns=["sex"], parameter_columns=["age", "year"]
392
+ )
393
+
396
394
  def load_birth_prevalence_data(self, builder: Builder) -> LookupTableData:
397
395
  if "birth_prevalence" in self._get_data_functions:
398
396
  return self._get_data_functions["birth_prevalence"](builder, self.state_id)
399
397
  else:
400
398
  return 0
401
399
 
400
+ def get_birth_prevalence(
401
+ self, builder: Builder, birth_prevalence_data: LookupTableData
402
+ ) -> LookupTable:
403
+ """
404
+ Builds a LookupTable for the birth prevalence of this state.
405
+
406
+ Parameters
407
+ ----------
408
+ builder
409
+ Interface to access simulation managers.
410
+ birth_prevalence_data
411
+ The data to use to build the LookupTable.
412
+
413
+ Returns
414
+ -------
415
+ LookupTable
416
+ The LookupTable for the birth prevalence of this state.
417
+ """
418
+ return builder.lookup.build_table(
419
+ birth_prevalence_data, key_columns=["sex"], parameter_columns=["year"]
420
+ )
421
+
402
422
  def load_dwell_time_data(self, builder: Builder) -> LookupTableData:
403
423
  if "dwell_time" in self._get_data_functions:
404
424
  dwell_time = self._get_data_functions["dwell_time"](builder, self.state_id)
@@ -414,6 +434,17 @@ class DiseaseState(BaseDiseaseState):
414
434
 
415
435
  return dwell_time
416
436
 
437
+ def get_dwell_time_pipeline(
438
+ self, builder: Builder, dwell_time_data: LookupTableData
439
+ ) -> Pipeline:
440
+ return builder.value.register_value_producer(
441
+ f"{self.state_id}.dwell_time",
442
+ source=builder.lookup.build_table(
443
+ dwell_time_data, key_columns=["sex"], parameter_columns=["age", "year"]
444
+ ),
445
+ requires_columns=["age", "sex"],
446
+ )
447
+
417
448
  def load_disability_weight_data(self, builder: Builder) -> LookupTableData:
418
449
  if "disability_weight" in self._get_data_functions:
419
450
  disability_weight = self._get_data_functions["disability_weight"](
@@ -429,6 +460,35 @@ class DiseaseState(BaseDiseaseState):
429
460
 
430
461
  return disability_weight
431
462
 
463
+ def get_base_disability_weight(
464
+ self, builder: Builder, disability_weight_data: LookupTableData
465
+ ) -> LookupTable:
466
+ """
467
+ Builds a LookupTable for the base disability weight of this state.
468
+
469
+ Parameters
470
+ ----------
471
+ builder
472
+ Interface to access simulation managers.
473
+ disability_weight_data
474
+ The data to use to build the LookupTable.
475
+
476
+ Returns
477
+ -------
478
+ LookupTable
479
+ The LookupTable for the disability weight of this state.
480
+ """
481
+ return builder.lookup.build_table(
482
+ disability_weight_data, key_columns=["sex"], parameter_columns=["age", "year"]
483
+ )
484
+
485
+ def get_disability_weight_pipeline(self, builder: Builder) -> Pipeline:
486
+ return builder.value.register_value_producer(
487
+ f"{self.state_id}.disability_weight",
488
+ source=self.compute_disability_weight,
489
+ requires_columns=["age", "sex", "alive", self.model],
490
+ )
491
+
432
492
  def load_excess_mortality_rate_data(self, builder: Builder) -> LookupTableData:
433
493
  if "excess_mortality_rate" in self._get_data_functions:
434
494
  return self._get_data_functions["excess_mortality_rate"](builder, self.state_id)
@@ -439,6 +499,48 @@ class DiseaseState(BaseDiseaseState):
439
499
  f"{self.cause_type}.{self.state_id}.excess_mortality_rate"
440
500
  )
441
501
 
502
+ def get_base_excess_mortality_rate(
503
+ self, builder: Builder, excess_mortality_data: LookupTableData
504
+ ) -> LookupTable:
505
+ """
506
+ Builds a LookupTable for the base excess mortality rate of this state.
507
+
508
+ Parameters
509
+ ----------
510
+ builder
511
+ Interface to access simulation managers.
512
+ excess_mortality_data
513
+ The data to use to build the LookupTable.
514
+
515
+ Returns
516
+ -------
517
+ LookupTable
518
+ The LookupTable for the base excess mortality rate of this state.
519
+ """
520
+ return builder.lookup.build_table(
521
+ excess_mortality_data, key_columns=["sex"], parameter_columns=["age", "year"]
522
+ )
523
+
524
+ def get_excess_mortality_rate_pipeline(self, builder: Builder) -> Pipeline:
525
+ return builder.value.register_rate_producer(
526
+ self.excess_mortality_rate_pipeline_name,
527
+ source=self.compute_excess_mortality_rate,
528
+ requires_columns=["age", "sex", "alive", self.model],
529
+ requires_values=[self.excess_mortality_rate_paf_pipeline_name],
530
+ )
531
+
532
+ def get_joint_paf(self, builder: Builder) -> Pipeline:
533
+ paf = builder.lookup.build_table(0)
534
+ return builder.value.register_value_producer(
535
+ self.excess_mortality_rate_paf_pipeline_name,
536
+ source=lambda idx: [paf(idx)],
537
+ preferred_combiner=list_combiner,
538
+ preferred_post_processor=union_post_processor,
539
+ )
540
+
541
+ def get_randomness_prevalence(self, builder: Builder) -> RandomnessStream:
542
+ return builder.randomness.get_stream(f"{self.state_id}_prevalent_cases")
543
+
442
544
  ##################
443
545
  # Public methods #
444
546
  ##################
@@ -128,6 +128,19 @@ class Mortality(Component):
128
128
 
129
129
  # noinspection PyMethodMayBeStatic
130
130
  def get_all_cause_mortality_rate(self, builder: Builder) -> Union[LookupTable, Pipeline]:
131
+ """
132
+ Load all cause mortality rate data and build a lookup table or pipeline.
133
+
134
+ Parameters
135
+ ----------
136
+ builder
137
+ Interface to access simulation managers.
138
+
139
+ Returns
140
+ -------
141
+ Union[LookupTable, Pipeline]
142
+ A lookup table or pipeline returning the all cause mortality rate.
143
+ """
131
144
  acmr_data = builder.data.load("cause.all_causes.cause_specific_mortality_rate")
132
145
  return builder.lookup.build_table(
133
146
  acmr_data, key_columns=["sex"], parameter_columns=["age", "year"]
@@ -135,6 +148,19 @@ class Mortality(Component):
135
148
 
136
149
  # noinspection PyMethodMayBeStatic
137
150
  def get_life_expectancy(self, builder: Builder) -> Union[LookupTable, Pipeline]:
151
+ """
152
+ Load life expectancy data and build a lookup table or pipeline.
153
+
154
+ Parameters
155
+ ----------
156
+ builder
157
+ Interface to access simulation managers.
158
+
159
+ Returns
160
+ -------
161
+ Union[LookupTable, Pipeline]
162
+ A lookup table or pipeline returning the life expectancy.
163
+ """
138
164
  life_expectancy_data = builder.data.load(
139
165
  "population.theoretical_minimum_risk_life_expectancy"
140
166
  )
@@ -142,6 +168,20 @@ class Mortality(Component):
142
168
 
143
169
  # noinspection PyMethodMayBeStatic
144
170
  def get_raw_unmodeled_csmr(self, builder: Builder) -> Union[LookupTable, Pipeline]:
171
+ """
172
+ Load unmodeled cause specific mortality rate data and build a lookup
173
+ table or pipeline.
174
+
175
+ Parameters
176
+ ----------
177
+ builder
178
+ Interface to access simulation managers.
179
+
180
+ Returns
181
+ -------
182
+ Union[LookupTable, Pipeline]
183
+ A lookup table or pipeline returning the unmodeled csmr.
184
+ """
145
185
  unmodeled_causes = builder.configuration.unmodeled_causes
146
186
  raw_csmr = 0.0
147
187
  for idx, cause in enumerate(unmodeled_causes):
@@ -121,12 +121,40 @@ class RiskEffect(Component):
121
121
  return builder.value.get_value(self.exposure_pipeline_name)
122
122
 
123
123
  def get_relative_risk_source(self, builder: Builder) -> LookupTable:
124
+ """
125
+ Get the relative risk source for this risk effect model.
126
+
127
+ Parameters
128
+ ----------
129
+ builder
130
+ Interface to access simulation managers.
131
+
132
+ Returns
133
+ -------
134
+ LookupTable
135
+ A lookup table containing the relative risk data for this risk
136
+ effect model.
137
+ """
124
138
  relative_risk_data = get_relative_risk_data(builder, self.risk, self.target)
125
139
  return builder.lookup.build_table(
126
140
  relative_risk_data, key_columns=["sex"], parameter_columns=["age", "year"]
127
141
  )
128
142
 
129
143
  def get_population_attributable_fraction_source(self, builder: Builder) -> LookupTable:
144
+ """
145
+ Get the population attributable fraction source for this risk effect model.
146
+
147
+ Parameters
148
+ ----------
149
+ builder
150
+ Interface to access simulation managers.
151
+
152
+ Returns
153
+ -------
154
+ LookupTable
155
+ A lookup table containing the population attributable fraction data
156
+ for this risk effect model.
157
+ """
130
158
  paf_data = get_population_attributable_fraction_data(builder, self.risk, self.target)
131
159
  return builder.lookup.build_table(
132
160
  paf_data, key_columns=["sex"], parameter_columns=["age", "year"]
@@ -127,6 +127,20 @@ class LinearScaleUp(Component):
127
127
  return get_endpoint("start"), get_endpoint("end")
128
128
 
129
129
  def get_scale_up_values(self, builder: Builder) -> Tuple[LookupTable, LookupTable]:
130
+ """
131
+ Get the values at the start and end of the scale-up period.
132
+
133
+ Parameters
134
+ ----------
135
+ builder
136
+ Interface to access simulation managers.
137
+
138
+ Returns
139
+ -------
140
+ LookupTable
141
+ A tuple of lookup tables returning the values at the start and end
142
+ of the scale-up period.
143
+ """
130
144
  scale_up_config = builder.configuration[self.configuration_key]["value"]
131
145
 
132
146
  def get_endpoint_value(endpoint_type: str) -> LookupTable:
@@ -172,6 +186,23 @@ class LinearScaleUp(Component):
172
186
  def get_endpoint_value_from_data(
173
187
  self, builder: Builder, endpoint_type: str
174
188
  ) -> LookupTable:
189
+ """
190
+ Get the value at the start or end of the scale-up period from data.
191
+
192
+ Parameters
193
+ ----------
194
+ builder
195
+ Interface to access simulation managers.
196
+ endpoint_type
197
+ The type of endpoint to get the value for. Allowed values are
198
+ "start" and "end".
199
+
200
+ Returns
201
+ -------
202
+ LookupTable
203
+ A lookup table returning the value at the start or end of the
204
+ scale-up period.
205
+ """
175
206
  if endpoint_type == "start":
176
207
  endpoint_data = builder.data.load(f"{self.treatment}.exposure")
177
208
  elif endpoint_type == "end":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vivarium-public-health
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: Components for modelling diseases, risks, and interventions with ``vivarium``
5
5
  Home-page: https://github.com/ihmeuw/vivarium_public_health
6
6
  Author: The vivarium developers
@@ -1,7 +1,7 @@
1
1
  import numpy as np
2
2
  import pandas as pd
3
3
  import pytest
4
- from vivarium import InteractiveContext
4
+ from vivarium import Component, InteractiveContext
5
5
  from vivarium.framework.state_machine import Transition
6
6
  from vivarium.framework.utilities import from_yearly
7
7
  from vivarium.testing_utilities import TestPopulation, build_table, metadata
@@ -188,7 +188,7 @@ def test_prevalence_single_state_with_migration(
188
188
  assert np.isclose(
189
189
  get_test_prevalence(simulation, "sick"), test_prevalence_level, 0.01
190
190
  ), error_message
191
- simulation._clock.step_forward()
191
+ simulation.step()
192
192
  assert np.isclose(
193
193
  get_test_prevalence(simulation, "sick"), test_prevalence_level, 0.01
194
194
  ), error_message
@@ -199,7 +199,7 @@ def test_prevalence_single_state_with_migration(
199
199
  assert np.isclose(
200
200
  get_test_prevalence(simulation, "sick"), test_prevalence_level, 0.01
201
201
  ), error_message
202
- simulation._clock.step_forward()
202
+ simulation.step()
203
203
  simulation.simulant_creator(
204
204
  50000,
205
205
  population_configuration={"age_start": 0, "age_end": 5, "sim_state": "time_step"},
@@ -358,11 +358,7 @@ def test_risk_deletion(base_config, base_plugins, disease):
358
358
 
359
359
  model = DiseaseModel(disease, initial_state=healthy, states=[healthy, sick])
360
360
 
361
- class PafModifier:
362
- @property
363
- def name(self):
364
- return "paf_modifier"
365
-
361
+ class PafModifier(Component):
366
362
  def setup(self, builder):
367
363
  builder.value.register_value_modifier(
368
364
  "sick.incidence_rate.paf",
@@ -370,7 +366,7 @@ def test_risk_deletion(base_config, base_plugins, disease):
370
366
  build_table(paf, year_start, year_end),
371
367
  key_columns=("sex",),
372
368
  parameter_columns=["age", "year"],
373
- value_columns=None,
369
+ value_columns=(),
374
370
  ),
375
371
  )
376
372
 
@@ -436,7 +432,7 @@ def test_prevalence_birth_prevalence_initial_assignment(base_config, base_plugin
436
432
  assert np.isclose(get_test_prevalence(simulation, "with_condition"), 1)
437
433
 
438
434
  # birth prevalence should be used for assigning initial status to newly-borns on time steps
439
- simulation._clock.step_forward()
435
+ simulation.step()
440
436
  simulation.simulant_creator(
441
437
  pop_size,
442
438
  population_configuration={"age_start": 0, "age_end": 0, "sim_state": "time_step"},
@@ -444,7 +440,7 @@ def test_prevalence_birth_prevalence_initial_assignment(base_config, base_plugin
444
440
  assert np.isclose(get_test_prevalence(simulation, "with_condition"), 0.75, 0.01)
445
441
 
446
442
  # and prevalence should be used for ages not start = end = 0
447
- simulation._clock.step_forward()
443
+ simulation.step()
448
444
  simulation.simulant_creator(
449
445
  pop_size,
450
446
  population_configuration={"age_start": 0, "age_end": 5, "sim_state": "time_step"},
@@ -473,7 +469,7 @@ def test_no_birth_prevalence_initial_assignment(base_config, base_plugins, disea
473
469
  assert np.isclose(get_test_prevalence(simulation, "with_condition"), 1)
474
470
 
475
471
  # with no birth prevalence provided, it should default to 0 for ages start = end = 0
476
- simulation._clock.step_forward()
472
+ simulation.step()
477
473
  simulation.simulant_creator(
478
474
  1000,
479
475
  population_configuration={"age_start": 0, "age_end": 0, "sim_state": "time_step"},
@@ -481,7 +477,7 @@ def test_no_birth_prevalence_initial_assignment(base_config, base_plugins, disea
481
477
  assert np.isclose(get_test_prevalence(simulation, "with_condition"), 0.5, 0.01)
482
478
 
483
479
  # and default to prevalence for ages not start = end = 0
484
- simulation._clock.step_forward()
480
+ simulation.step()
485
481
  simulation.simulant_creator(
486
482
  1000,
487
483
  population_configuration={"age_start": 0, "age_end": 5, "sim_state": "time_step"},
@@ -1,31 +0,0 @@
1
- name: deploy
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- jobs:
8
- deploy:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v3
12
- - name: Set up Python
13
- uses: actions/setup-python@v4
14
- with:
15
- python-version: '3.11'
16
- - name: Install dependencies
17
- run: |
18
- python --version
19
- python -m pip install --upgrade pip
20
- pip install setuptools wheel twine
21
- - name: Test
22
- run: |
23
- pip install .[test]
24
- pytest --runslow ./tests
25
- - name: Build and publish
26
- env:
27
- TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28
- TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29
- run: |
30
- python setup.py sdist bdist_wheel
31
- twine upload dist/*
@@ -1 +0,0 @@
1
- __version__ = "2.1.0"