-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathscenario_impact_of_policy.py
83 lines (69 loc) · 2.8 KB
/
scenario_impact_of_policy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""This Scenario file run the model under different assumptions for the HealthSystem Mode in order to estimate the
impact that is achieved under each (relative to there being no health system).
Run on the batch system using:
```
tlo batch-submit src/scripts/healthsystem/impact_of_policy/scenario_impact_of_policy.py
```
or locally using:
```
tlo scenario-run src/scripts/healthsystem/impact_of_policy/scenario_impact_of_policy.py
```
"""
from pathlib import Path
from typing import Dict
import pandas as pd
from tlo import Date, logging
from tlo.analysis.utils import get_parameters_for_status_quo, mix_scenarios
from tlo.methods.fullmodel import fullmodel
from tlo.scenario import BaseScenario
class ImpactOfHealthSystemMode(BaseScenario):
def __init__(self):
super().__init__()
self.seed = 0
self.start_date = Date(2010, 1, 1)
self.end_date = self.start_date + pd.DateOffset(years=5)
self.pop_size = 75_000
self._scenarios = self._get_scenarios()
self.number_of_draws = len(self._scenarios)
self.runs_per_draw = 1
def log_configuration(self):
return {
'filename': 'effect_of_each_treatment',
'directory': Path('./outputs'), # <- (specified only for local running)
'custom_levels': {
'*': logging.WARNING,
'tlo.methods.demography': logging.INFO,
'tlo.methods.demography.detail': logging.WARNING,
'tlo.methods.healthburden': logging.INFO,
'tlo.methods.healthsystem.summary': logging.INFO,
}
}
def modules(self):
return fullmodel(resourcefilepath=self.resources)
def draw_parameters(self, draw_number, rng):
if draw_number < self.number_of_draws:
return list(self._scenarios.values())[draw_number]
else:
return
def _get_scenarios(self) -> Dict[str, Dict]:
"""Return the Dict with values for the parameters that are changed, keyed by a name for the scenario.
"""
return {
"Vertical Programmes Status Quo cons Longer tclose":
mix_scenarios(
get_parameters_for_status_quo(),
{
'HealthSystem': {
'cons_availability': "default",
"use_funded_or_actual_staffing": "actual",
'year_policy_switch': 2011,
'mode_appt_constraints_postSwitch': 2,
"policy_name_post_switch": "VerticalProgrammes",
'tclose_overwrite': 1,
'tclose_days_offset_overwrite': 10,
},
}),
}
if __name__ == '__main__':
from tlo.cli import scenario_run
scenario_run([__file__])