vivarium-public-health 3.1.1__tar.gz → 3.1.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/CHANGELOG.rst +5 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/PKG-INFO +1 -1
- vivarium_public_health-3.1.2/src/vivarium_public_health/_version.py +1 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/disease/model.py +12 -20
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/disease/special_disease.py +5 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/disease/state.py +18 -17
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/disease/transition.py +9 -8
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/delay.py +5 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/disease.py +5 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/intervention.py +8 -8
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/magic_wand_components.py +3 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/observer.py +4 -6
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/population.py +4 -6
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/plugins/parser.py +18 -19
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/population/add_new_birth_cohorts.py +3 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/population/base_population.py +8 -10
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/population/data_transformations.py +4 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/population/mortality.py +6 -6
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/disability.py +1 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/disease.py +5 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/mortality.py +3 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/observer.py +7 -7
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/risk.py +3 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/base_risk.py +4 -4
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/distributions.py +15 -15
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/effect.py +10 -10
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/implementations/low_birth_weight_and_short_gestation.py +17 -16
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/treatment/magic_wand.py +3 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/treatment/scale_up.py +6 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/utilities.py +4 -5
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health.egg-info/PKG-INFO +1 -1
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/conftest.py +1 -1
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/mock_artifact.py +0 -2
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/plugins/test_parser.py +12 -12
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/population/test_mortality.py +1 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/conftest.py +1 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/test_base_risk.py +6 -6
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/test_effect.py +3 -3
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/test_utilities.py +4 -4
- vivarium_public_health-3.1.1/src/vivarium_public_health/_version.py +0 -1
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.bandit +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.flake8 +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.gitattributes +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.github/CODEOWNERS +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.github/pull_request_template.md +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.github/workflows/build.yml +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.github/workflows/deploy.yml +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.gitignore +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.pylintrc +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.readthedocs.yml +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/.zenodo.json +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/CODE_OF_CONDUCT.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/CONTRIBUTING.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/Jenkinsfile +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/LICENSE.txt +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/MANIFEST.in +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/Makefile +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/README.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/Makefile +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/nitpick-exceptions +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/_static/style.css +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/_templates/layout.html +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/disease/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/disease/model.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/disease/models.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/disease/special_disease.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/disease/state.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/disease/transition.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/delay.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/disease.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/intervention.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/magic_wand_components.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/observer.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/mslt/population.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/plugins/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/plugins/parser.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/population/add_new_birth_cohorts.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/population/base_population.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/population/data_transformations.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/population/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/population/mortality.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/disability.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/disease.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/mortality.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/observer.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/risk.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/simple_cause.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/results/stratification.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/base_risk.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/data_transformations.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/distributions.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/effect.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/implementations/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/implementations/low_birth_weight_and_short_gestation.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/risks/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/treatment/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/treatment/magic_wand.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/treatment/scale_up.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/treatment/therapeutic_inertia.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/api_reference/utilities.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/conf.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/tutorials/index.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/docs/source/tutorials/risk_exposure.rst +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/pyproject.toml +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/setup.cfg +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/setup.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/__about__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/disease/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/disease/models.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/mslt/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/plugins/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/population/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/columns.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/simple_cause.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/results/stratification.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/data_transformations.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/risks/implementations/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/treatment/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health/treatment/therapeutic_inertia.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health.egg-info/SOURCES.txt +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health.egg-info/dependency_links.txt +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health.egg-info/not-zip-safe +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health.egg-info/requires.txt +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/src/vivarium_public_health.egg-info/top_level.txt +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/disease/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/disease/test_disease.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/disease/test_special_disease.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/plugins/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/population/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/population/conftest.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/population/test_add_new_birth_cohort.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/population/test_base_population.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/population/test_data_transformations.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/test_categorical_risk_observer.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/test_disability.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/test_disability_observer.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/test_disease_observer.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/test_mortality_observer.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/results/test_stratification.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/test_data_transformations.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/test_distributions.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/risks/test_low_birth_weight_and_short_gestation.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/treatment/__init__.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tests/treatment/test_scale_up.py +0 -0
- {vivarium_public_health-3.1.1 → vivarium_public_health-3.1.2}/tox.ini +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: vivarium_public_health
|
3
|
-
Version: 3.1.
|
3
|
+
Version: 3.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
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "3.1.2"
|
@@ -9,8 +9,8 @@ transitions at simulation initialization and during transitions.
|
|
9
9
|
|
10
10
|
"""
|
11
11
|
import warnings
|
12
|
-
from collections.abc import Iterable
|
13
|
-
from typing import Any
|
12
|
+
from collections.abc import Callable, Iterable
|
13
|
+
from typing import Any
|
14
14
|
|
15
15
|
import numpy as np
|
16
16
|
import pandas as pd
|
@@ -35,7 +35,7 @@ class DiseaseModel(Machine):
|
|
35
35
|
##############
|
36
36
|
|
37
37
|
@property
|
38
|
-
def configuration_defaults(self) ->
|
38
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
39
39
|
return {
|
40
40
|
f"{self.name}": {
|
41
41
|
"data_sources": {
|
@@ -45,15 +45,15 @@ class DiseaseModel(Machine):
|
|
45
45
|
}
|
46
46
|
|
47
47
|
@property
|
48
|
-
def columns_created(self) ->
|
48
|
+
def columns_created(self) -> list[str]:
|
49
49
|
return [self.state_column]
|
50
50
|
|
51
51
|
@property
|
52
|
-
def columns_required(self) ->
|
52
|
+
def columns_required(self) -> list[str] | None:
|
53
53
|
return ["age", "sex"]
|
54
54
|
|
55
55
|
@property
|
56
|
-
def initialization_requirements(self) ->
|
56
|
+
def initialization_requirements(self) -> dict[str, list[str]]:
|
57
57
|
return {
|
58
58
|
"requires_columns": ["age", "sex"],
|
59
59
|
"requires_values": [],
|
@@ -61,11 +61,11 @@ class DiseaseModel(Machine):
|
|
61
61
|
}
|
62
62
|
|
63
63
|
@property
|
64
|
-
def state_names(self) ->
|
64
|
+
def state_names(self) -> list[str]:
|
65
65
|
return [s.state_id for s in self.states]
|
66
66
|
|
67
67
|
@property
|
68
|
-
def transition_names(self) ->
|
68
|
+
def transition_names(self) -> list[TransitionString]:
|
69
69
|
return [
|
70
70
|
state_name for state in self.states for state_name in state.get_transition_names()
|
71
71
|
]
|
@@ -77,8 +77,8 @@ class DiseaseModel(Machine):
|
|
77
77
|
def __init__(
|
78
78
|
self,
|
79
79
|
cause: str,
|
80
|
-
initial_state:
|
81
|
-
get_data_functions:
|
80
|
+
initial_state: BaseDiseaseState | None = None,
|
81
|
+
get_data_functions: dict[str, Callable] | None = None,
|
82
82
|
cause_type: str = "cause",
|
83
83
|
states: Iterable[BaseDiseaseState] = (),
|
84
84
|
residual_state: BaseDiseaseState | None = None,
|
@@ -131,9 +131,7 @@ class DiseaseModel(Machine):
|
|
131
131
|
# Setup methods #
|
132
132
|
#################
|
133
133
|
|
134
|
-
def load_cause_specific_mortality_rate(
|
135
|
-
self, builder: Builder
|
136
|
-
) -> Union[float, pd.DataFrame]:
|
134
|
+
def load_cause_specific_mortality_rate(self, builder: Builder) -> float | pd.DataFrame:
|
137
135
|
if "cause_specific_mortality_rate" not in self._get_data_functions:
|
138
136
|
only_morbid = builder.data.load(f"cause.{self.cause}.restrictions")["yld_only"]
|
139
137
|
if only_morbid:
|
@@ -200,12 +198,6 @@ class DiseaseModel(Machine):
|
|
200
198
|
)
|
201
199
|
self.population_view.update(condition_column)
|
202
200
|
|
203
|
-
def on_time_step(self, event: Event) -> None:
|
204
|
-
self.transition(event.index, event.time)
|
205
|
-
|
206
|
-
def on_time_step_cleanup(self, event: Event) -> None:
|
207
|
-
self.cleanup(event.index, event.time)
|
208
|
-
|
209
201
|
##################################
|
210
202
|
# Pipeline sources and modifiers #
|
211
203
|
##################################
|
@@ -225,7 +217,7 @@ class DiseaseModel(Machine):
|
|
225
217
|
|
226
218
|
def get_state_weights(
|
227
219
|
self, pop_index: pd.Index, prevalence_type: str
|
228
|
-
) ->
|
220
|
+
) -> tuple[list[str], np.ndarray | None]:
|
229
221
|
states = [state for state in self.states if state.lookup_tables.get(prevalence_type)]
|
230
222
|
|
231
223
|
if not states:
|
@@ -10,7 +10,7 @@ This module contains frequently used, but non-standard disease models.
|
|
10
10
|
import re
|
11
11
|
from collections import namedtuple
|
12
12
|
from operator import gt, lt
|
13
|
-
from typing import Any
|
13
|
+
from typing import Any
|
14
14
|
|
15
15
|
import pandas as pd
|
16
16
|
from vivarium import Component
|
@@ -95,7 +95,7 @@ class RiskAttributableDisease(Component):
|
|
95
95
|
return f"risk_attributable_disease.{self.cause.name}"
|
96
96
|
|
97
97
|
@property
|
98
|
-
def configuration_defaults(self) ->
|
98
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
99
99
|
return {
|
100
100
|
self.name: {
|
101
101
|
"data_sources": {
|
@@ -111,7 +111,7 @@ class RiskAttributableDisease(Component):
|
|
111
111
|
}
|
112
112
|
|
113
113
|
@property
|
114
|
-
def columns_created(self) ->
|
114
|
+
def columns_created(self) -> list[str]:
|
115
115
|
return [
|
116
116
|
self.cause.name,
|
117
117
|
self.diseased_event_time_column,
|
@@ -119,11 +119,11 @@ class RiskAttributableDisease(Component):
|
|
119
119
|
]
|
120
120
|
|
121
121
|
@property
|
122
|
-
def columns_required(self) ->
|
122
|
+
def columns_required(self) -> list[str] | None:
|
123
123
|
return ["alive"]
|
124
124
|
|
125
125
|
@property
|
126
|
-
def initialization_requirements(self) ->
|
126
|
+
def initialization_requirements(self) -> dict[str, list[str]]:
|
127
127
|
return {
|
128
128
|
"requires_columns": [],
|
129
129
|
"requires_values": [f"{self.risk.name}.exposure"],
|
@@ -7,7 +7,8 @@ This module contains tools to manage standard disease states.
|
|
7
7
|
|
8
8
|
"""
|
9
9
|
|
10
|
-
from
|
10
|
+
from collections.abc import Callable
|
11
|
+
from typing import Any
|
11
12
|
|
12
13
|
import numpy as np
|
13
14
|
import pandas as pd
|
@@ -36,11 +37,11 @@ class BaseDiseaseState(State):
|
|
36
37
|
return [self.event_time_column, self.event_count_column]
|
37
38
|
|
38
39
|
@property
|
39
|
-
def columns_required(self) ->
|
40
|
+
def columns_required(self) -> list[str] | None:
|
40
41
|
return [self.model, "alive"]
|
41
42
|
|
42
43
|
@property
|
43
|
-
def initialization_requirements(self) ->
|
44
|
+
def initialization_requirements(self) -> dict[str, list[str]]:
|
44
45
|
return {
|
45
46
|
"requires_columns": [self.model],
|
46
47
|
"requires_values": [],
|
@@ -55,7 +56,7 @@ class BaseDiseaseState(State):
|
|
55
56
|
self,
|
56
57
|
state_id: str,
|
57
58
|
allow_self_transition: bool = False,
|
58
|
-
side_effect_function:
|
59
|
+
side_effect_function: Callable | None = None,
|
59
60
|
cause_type: str = "cause",
|
60
61
|
):
|
61
62
|
super().__init__(state_id, allow_self_transition) # becomes state_id
|
@@ -83,7 +84,7 @@ class BaseDiseaseState(State):
|
|
83
84
|
# Helper methods #
|
84
85
|
##################
|
85
86
|
|
86
|
-
def get_initialization_parameters(self) ->
|
87
|
+
def get_initialization_parameters(self) -> dict[str, Any]:
|
87
88
|
"""Exclude side effect function and cause type from name and __repr__."""
|
88
89
|
initialization_parameters = super().get_initialization_parameters()
|
89
90
|
for key in ["side_effect_function", "cause_type"]:
|
@@ -118,7 +119,7 @@ class BaseDiseaseState(State):
|
|
118
119
|
# Public methods #
|
119
120
|
##################
|
120
121
|
|
121
|
-
def get_transition_names(self) ->
|
122
|
+
def get_transition_names(self) -> list[str]:
|
122
123
|
transitions = []
|
123
124
|
for trans in self.transition_set.transitions:
|
124
125
|
init_state = trans.input_state.name.split(".")[1]
|
@@ -129,7 +130,7 @@ class BaseDiseaseState(State):
|
|
129
130
|
def add_rate_transition(
|
130
131
|
self,
|
131
132
|
output: "BaseDiseaseState",
|
132
|
-
get_data_functions:
|
133
|
+
get_data_functions: dict[str, Callable] = None,
|
133
134
|
triggered=Trigger.NOT_TRIGGERED,
|
134
135
|
) -> RateTransition:
|
135
136
|
"""Builds a RateTransition from this state to the given state.
|
@@ -156,7 +157,7 @@ class BaseDiseaseState(State):
|
|
156
157
|
def add_proportion_transition(
|
157
158
|
self,
|
158
159
|
output: "BaseDiseaseState",
|
159
|
-
get_data_functions:
|
160
|
+
get_data_functions: dict[str, Callable] | None = None,
|
160
161
|
triggered=Trigger.NOT_TRIGGERED,
|
161
162
|
) -> ProportionTransition:
|
162
163
|
"""Builds a ProportionTransition from this state to the given state.
|
@@ -198,7 +199,7 @@ class NonDiseasedState(BaseDiseaseState):
|
|
198
199
|
self,
|
199
200
|
state_id: str,
|
200
201
|
allow_self_transition: bool = False,
|
201
|
-
side_effect_function:
|
202
|
+
side_effect_function: Callable | None = None,
|
202
203
|
cause_type: str = "cause",
|
203
204
|
name_prefix: str = "",
|
204
205
|
):
|
@@ -218,7 +219,7 @@ class NonDiseasedState(BaseDiseaseState):
|
|
218
219
|
def add_rate_transition(
|
219
220
|
self,
|
220
221
|
output: BaseDiseaseState,
|
221
|
-
get_data_functions:
|
222
|
+
get_data_functions: dict[str, Callable] = None,
|
222
223
|
**kwargs,
|
223
224
|
) -> RateTransition:
|
224
225
|
if get_data_functions is None:
|
@@ -241,7 +242,7 @@ class SusceptibleState(NonDiseasedState):
|
|
241
242
|
self,
|
242
243
|
state_id: str,
|
243
244
|
allow_self_transition: bool = False,
|
244
|
-
side_effect_function:
|
245
|
+
side_effect_function: Callable | None = None,
|
245
246
|
cause_type: str = "cause",
|
246
247
|
):
|
247
248
|
super().__init__(
|
@@ -258,7 +259,7 @@ class RecoveredState(NonDiseasedState):
|
|
258
259
|
self,
|
259
260
|
state_id: str,
|
260
261
|
allow_self_transition: bool = False,
|
261
|
-
side_effect_function:
|
262
|
+
side_effect_function: Callable | None = None,
|
262
263
|
cause_type: str = "cause",
|
263
264
|
):
|
264
265
|
super().__init__(
|
@@ -278,7 +279,7 @@ class DiseaseState(BaseDiseaseState):
|
|
278
279
|
##############
|
279
280
|
|
280
281
|
@property
|
281
|
-
def configuration_defaults(self) ->
|
282
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
282
283
|
return {
|
283
284
|
f"{self.name}": {
|
284
285
|
"data_sources": {
|
@@ -299,10 +300,10 @@ class DiseaseState(BaseDiseaseState):
|
|
299
300
|
self,
|
300
301
|
state_id: str,
|
301
302
|
allow_self_transition: bool = False,
|
302
|
-
side_effect_function:
|
303
|
+
side_effect_function: Callable | None = None,
|
303
304
|
cause_type: str = "cause",
|
304
|
-
get_data_functions:
|
305
|
-
cleanup_function:
|
305
|
+
get_data_functions: dict[str, Callable] | None = None,
|
306
|
+
cleanup_function: Callable | None = None,
|
306
307
|
):
|
307
308
|
"""
|
308
309
|
Parameters
|
@@ -472,7 +473,7 @@ class DiseaseState(BaseDiseaseState):
|
|
472
473
|
def add_rate_transition(
|
473
474
|
self,
|
474
475
|
output: BaseDiseaseState,
|
475
|
-
get_data_functions:
|
476
|
+
get_data_functions: dict[str, Callable] = None,
|
476
477
|
**kwargs,
|
477
478
|
) -> RateTransition:
|
478
479
|
if get_data_functions is None:
|
@@ -7,7 +7,8 @@ This module contains tools to model transitions between disease states.
|
|
7
7
|
|
8
8
|
"""
|
9
9
|
|
10
|
-
from
|
10
|
+
from collections.abc import Callable
|
11
|
+
from typing import TYPE_CHECKING, Any
|
11
12
|
|
12
13
|
import pandas as pd
|
13
14
|
from vivarium.framework.engine import Builder
|
@@ -39,7 +40,7 @@ class RateTransition(Transition):
|
|
39
40
|
##############
|
40
41
|
|
41
42
|
@property
|
42
|
-
def configuration_defaults(self) ->
|
43
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
43
44
|
return {
|
44
45
|
f"{self.name}": {
|
45
46
|
"data_sources": {
|
@@ -49,7 +50,7 @@ class RateTransition(Transition):
|
|
49
50
|
}
|
50
51
|
|
51
52
|
@property
|
52
|
-
def columns_required(self) ->
|
53
|
+
def columns_required(self) -> list[str] | None:
|
53
54
|
return ["alive"]
|
54
55
|
|
55
56
|
@property
|
@@ -77,7 +78,7 @@ class RateTransition(Transition):
|
|
77
78
|
self,
|
78
79
|
input_state: "BaseDiseaseState",
|
79
80
|
output_state: "BaseDiseaseState",
|
80
|
-
get_data_functions:
|
81
|
+
get_data_functions: dict[str, Callable] = None,
|
81
82
|
triggered=Trigger.NOT_TRIGGERED,
|
82
83
|
):
|
83
84
|
super().__init__(
|
@@ -108,7 +109,7 @@ class RateTransition(Transition):
|
|
108
109
|
# Setup methods #
|
109
110
|
#################
|
110
111
|
|
111
|
-
def load_transition_rate(self, builder: Builder) ->
|
112
|
+
def load_transition_rate(self, builder: Builder) -> float | pd.DataFrame:
|
112
113
|
if "incidence_rate" in self._get_data_functions:
|
113
114
|
rate_data = self._get_data_functions["incidence_rate"](
|
114
115
|
builder, self.output_state.state_id
|
@@ -152,7 +153,7 @@ class ProportionTransition(Transition):
|
|
152
153
|
##############
|
153
154
|
|
154
155
|
@property
|
155
|
-
def configuration_defaults(self) ->
|
156
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
156
157
|
return {
|
157
158
|
f"{self.name}": {
|
158
159
|
"data_sources": {
|
@@ -169,7 +170,7 @@ class ProportionTransition(Transition):
|
|
169
170
|
self,
|
170
171
|
input_state: "BaseDiseaseState",
|
171
172
|
output_state: "BaseDiseaseState",
|
172
|
-
get_data_functions:
|
173
|
+
get_data_functions: dict[str, Callable] = None,
|
173
174
|
triggered=Trigger.NOT_TRIGGERED,
|
174
175
|
):
|
175
176
|
super().__init__(
|
@@ -183,7 +184,7 @@ class ProportionTransition(Transition):
|
|
183
184
|
# Setup methods #
|
184
185
|
#################
|
185
186
|
|
186
|
-
def load_proportion(self, builder: Builder) ->
|
187
|
+
def load_proportion(self, builder: Builder) -> float | pd.DataFrame:
|
187
188
|
if "proportion" not in self._get_data_functions:
|
188
189
|
raise ValueError("Must supply a proportion function")
|
189
190
|
return self._get_data_functions["proportion"](builder, self.output_state.state_id)
|
@@ -8,7 +8,7 @@ lifetable simulation.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from typing import Any
|
11
|
+
from typing import Any
|
12
12
|
|
13
13
|
import numpy as np
|
14
14
|
import pandas as pd
|
@@ -93,7 +93,7 @@ class DelayedRisk(Component):
|
|
93
93
|
##############
|
94
94
|
|
95
95
|
@property
|
96
|
-
def configuration_defaults(self) ->
|
96
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
97
97
|
return {
|
98
98
|
self.risk: {
|
99
99
|
"constant_prevalence": False,
|
@@ -103,15 +103,15 @@ class DelayedRisk(Component):
|
|
103
103
|
}
|
104
104
|
|
105
105
|
@property
|
106
|
-
def columns_created(self) ->
|
106
|
+
def columns_created(self) -> list[str]:
|
107
107
|
return self._bin_names
|
108
108
|
|
109
109
|
@property
|
110
|
-
def columns_required(self) ->
|
110
|
+
def columns_required(self) -> list[str] | None:
|
111
111
|
return ["age", "sex", "population"]
|
112
112
|
|
113
113
|
@property
|
114
|
-
def initialization_requirements(self) ->
|
114
|
+
def initialization_requirements(self) -> dict[str, list[str]]:
|
115
115
|
return {
|
116
116
|
"requires_columns": ["age", "sex", "population"],
|
117
117
|
"requires_values": [],
|
@@ -8,7 +8,7 @@ simulations.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from typing import Any
|
11
|
+
from typing import Any
|
12
12
|
|
13
13
|
import numpy as np
|
14
14
|
import pandas as pd
|
@@ -143,7 +143,7 @@ class Disease(Component):
|
|
143
143
|
##############
|
144
144
|
|
145
145
|
@property
|
146
|
-
def configuration_defaults(self) ->
|
146
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
147
147
|
return {
|
148
148
|
self.disease: {
|
149
149
|
"simplified_no_remission_equations": False,
|
@@ -151,7 +151,7 @@ class Disease(Component):
|
|
151
151
|
}
|
152
152
|
|
153
153
|
@property
|
154
|
-
def columns_created(self) ->
|
154
|
+
def columns_created(self) -> list[str]:
|
155
155
|
columns = []
|
156
156
|
for scenario in ["", "_intervention"]:
|
157
157
|
for rate in ["_S", "_C"]:
|
@@ -160,11 +160,11 @@ class Disease(Component):
|
|
160
160
|
return columns
|
161
161
|
|
162
162
|
@property
|
163
|
-
def columns_required(self) ->
|
163
|
+
def columns_required(self) -> list[str] | None:
|
164
164
|
return ["age", "sex"]
|
165
165
|
|
166
166
|
@property
|
167
|
-
def initialization_requirements(self) ->
|
167
|
+
def initialization_requirements(self) -> dict[str, list[str]]:
|
168
168
|
return {
|
169
169
|
"requires_columns": ["age", "sex"],
|
170
170
|
"requires_values": [],
|
@@ -8,7 +8,7 @@ simulations.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from typing import Any
|
11
|
+
from typing import Any
|
12
12
|
|
13
13
|
from vivarium import Component
|
14
14
|
from vivarium.framework.engine import Builder
|
@@ -22,7 +22,7 @@ class ModifyAllCauseMortality(Component):
|
|
22
22
|
##############
|
23
23
|
|
24
24
|
@property
|
25
|
-
def configuration_defaults(self) ->
|
25
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
26
26
|
return {
|
27
27
|
"intervention": {
|
28
28
|
self.intervention: {
|
@@ -62,7 +62,7 @@ class ModifyDiseaseRate(Component):
|
|
62
62
|
##############
|
63
63
|
|
64
64
|
@property
|
65
|
-
def configuration_defaults(self) ->
|
65
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
66
66
|
return {
|
67
67
|
"intervention": {
|
68
68
|
self.intervention: {
|
@@ -144,7 +144,7 @@ class ModifyAcuteDiseaseIncidence(Component):
|
|
144
144
|
##############
|
145
145
|
|
146
146
|
@property
|
147
|
-
def configuration_defaults(self) ->
|
147
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
148
148
|
return {
|
149
149
|
"intervention": {
|
150
150
|
self.intervention: {
|
@@ -187,7 +187,7 @@ class ModifyAcuteDiseaseMorbidity(Component):
|
|
187
187
|
##############
|
188
188
|
|
189
189
|
@property
|
190
|
-
def configuration_defaults(self) ->
|
190
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
191
191
|
return {
|
192
192
|
"intervention": {
|
193
193
|
self.intervention: {
|
@@ -228,7 +228,7 @@ class ModifyAcuteDiseaseMortality(Component):
|
|
228
228
|
##############
|
229
229
|
|
230
230
|
@property
|
231
|
-
def configuration_defaults(self) ->
|
231
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
232
232
|
return {
|
233
233
|
"intervention": {
|
234
234
|
self.intervention: {
|
@@ -269,7 +269,7 @@ class TobaccoFreeGeneration(Component):
|
|
269
269
|
##############
|
270
270
|
|
271
271
|
@property
|
272
|
-
def configuration_defaults(self) ->
|
272
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
273
273
|
return {
|
274
274
|
"tobacco_free_generation": {
|
275
275
|
"year": 2020,
|
@@ -310,7 +310,7 @@ class TobaccoEradication(Component):
|
|
310
310
|
##############
|
311
311
|
|
312
312
|
@property
|
313
|
-
def configuration_defaults(self) ->
|
313
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
314
314
|
return {
|
315
315
|
"tobacco_eradication": {
|
316
316
|
"year": 2020,
|
@@ -8,7 +8,7 @@ multi-state lifetable simulations.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from typing import Any
|
11
|
+
from typing import Any
|
12
12
|
|
13
13
|
from vivarium import Component
|
14
14
|
from vivarium.framework.engine import Builder
|
@@ -73,7 +73,7 @@ class ModifyAcuteDiseaseYLD(Component):
|
|
73
73
|
##############
|
74
74
|
|
75
75
|
@property
|
76
|
-
def configuration_defaults(self) ->
|
76
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
77
77
|
return {
|
78
78
|
"intervention": {
|
79
79
|
self.disease: {
|
@@ -112,7 +112,7 @@ class ModifyAcuteDiseaseMortality(Component):
|
|
112
112
|
##############
|
113
113
|
|
114
114
|
@property
|
115
|
-
def configuration_defaults(self) ->
|
115
|
+
def configuration_defaults(self) -> dict[str, Any]:
|
116
116
|
return {
|
117
117
|
"intervention": {
|
118
118
|
self.disease: {
|
@@ -8,8 +8,6 @@ multi-state lifetable simulations.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from typing import List, Optional
|
12
|
-
|
13
11
|
import pandas as pd
|
14
12
|
from vivarium import Component
|
15
13
|
from vivarium.framework.engine import Builder
|
@@ -76,7 +74,7 @@ class MorbidityMortality(Component):
|
|
76
74
|
##############
|
77
75
|
|
78
76
|
@property
|
79
|
-
def columns_required(self) ->
|
77
|
+
def columns_required(self) -> list[str] | None:
|
80
78
|
return [
|
81
79
|
"age",
|
82
80
|
"sex",
|
@@ -224,7 +222,7 @@ class Disease(Component):
|
|
224
222
|
##############
|
225
223
|
|
226
224
|
@property
|
227
|
-
def columns_required(self) ->
|
225
|
+
def columns_required(self) -> list[str] | None:
|
228
226
|
return [
|
229
227
|
"age",
|
230
228
|
"sex",
|
@@ -238,7 +236,7 @@ class Disease(Component):
|
|
238
236
|
# Lifecycle methods #
|
239
237
|
#####################
|
240
238
|
|
241
|
-
def __init__(self, disease: str, output_suffix:
|
239
|
+
def __init__(self, disease: str, output_suffix: str | None = None):
|
242
240
|
super().__init__()
|
243
241
|
self.disease = disease
|
244
242
|
if output_suffix is None:
|
@@ -335,7 +333,7 @@ class TobaccoPrevalence(Component):
|
|
335
333
|
##############
|
336
334
|
|
337
335
|
@property
|
338
|
-
def columns_required(self) ->
|
336
|
+
def columns_required(self) -> list[str] | None:
|
339
337
|
return ["age", "sex", "bau_population", "population"] + self._bin_names
|
340
338
|
|
341
339
|
#####################
|
@@ -8,8 +8,6 @@ multi-state lifetable simulations.
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
-
from typing import List, Optional
|
12
|
-
|
13
11
|
import numpy as np
|
14
12
|
import pandas as pd
|
15
13
|
from vivarium import Component
|
@@ -50,7 +48,7 @@ class BasePopulation(Component):
|
|
50
48
|
##############
|
51
49
|
|
52
50
|
@property
|
53
|
-
def columns_created(self) ->
|
51
|
+
def columns_created(self) -> list[str]:
|
54
52
|
return [
|
55
53
|
"age",
|
56
54
|
"sex",
|
@@ -71,7 +69,7 @@ class BasePopulation(Component):
|
|
71
69
|
]
|
72
70
|
|
73
71
|
@property
|
74
|
-
def columns_required(self) ->
|
72
|
+
def columns_required(self) -> list[str] | None:
|
75
73
|
return ["tracked"]
|
76
74
|
|
77
75
|
#####################
|
@@ -122,7 +120,7 @@ class Mortality(Component):
|
|
122
120
|
##############
|
123
121
|
|
124
122
|
@property
|
125
|
-
def columns_required(self) ->
|
123
|
+
def columns_required(self) -> list[str] | None:
|
126
124
|
return [
|
127
125
|
"population",
|
128
126
|
"bau_population",
|
@@ -190,7 +188,7 @@ class Disability(Component):
|
|
190
188
|
##############
|
191
189
|
|
192
190
|
@property
|
193
|
-
def columns_required(self) ->
|
191
|
+
def columns_required(self) -> list[str] | None:
|
194
192
|
return [
|
195
193
|
"bau_yld_rate",
|
196
194
|
"yld_rate",
|