Skip to content

Commit 6905214

Browse files
Capabilities expansion scenarios (#1304)
* Include first set of HR scaling scenarios to consider * First version of scenario file, without perfect consumables from 2018 * Add additional scenarios * Final scenarios * Initially only consider first set of runs. Only do 2 runs per scenario, pop at 100000 * Style fixe * Add consumables switcher * Correct default parameters to have no effect in master, and slightly changed name to better reflect parameters that are being changed. * Correct year in which mode switch takes place * Add cons switch to scenario file * Style fix * typo: acceptable value is 'default' not 'Default' * elaborate comments for new parameters * black formatting --------- Co-authored-by: Tim Hallett <[email protected]>
1 parent b9da890 commit 6905214

File tree

4 files changed

+207
-7
lines changed

4 files changed

+207
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:0c73ab0899a29f032dd90629c01f64fddb903510f8ff789b81335f9e5fb97adc
3-
size 495
2+
oid sha256:e2e47086a381ec30c0c4229278fe4567f01ca0f24b52808b542667ae50cb816f
3+
size 585
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:75ac6ae6b873d2b6e95090da64da98c5646e21a6c485ee6a10d5b8bc0e352950
3-
size 10780
2+
oid sha256:5caca2d50dc998c2512bc4a401507b4b137fe8868fef4892e73221bbdb06c090
3+
size 24582
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
"""This Scenario file run the model under different assumptions for the HealthSystem Mode in order to estimate the
2+
impact that is achieved under each (relative to there being no health system).
3+
4+
Run on the batch system using:
5+
```
6+
tlo batch-submit src/scripts/healthsystem/impact_of_policy/scenario_impact_of_policy.py
7+
```
8+
9+
or locally using:
10+
```
11+
tlo scenario-run src/scripts/healthsystem/impact_of_policy/scenario_impact_of_policy.py
12+
```
13+
14+
"""
15+
from pathlib import Path
16+
from typing import Dict
17+
18+
import pandas as pd
19+
20+
from tlo import Date, logging
21+
from tlo.analysis.utils import get_parameters_for_status_quo, mix_scenarios
22+
from tlo.methods.fullmodel import fullmodel
23+
from tlo.methods.scenario_switcher import ScenarioSwitcher
24+
from tlo.scenario import BaseScenario
25+
26+
27+
class ImpactOfHealthSystemMode(BaseScenario):
28+
def __init__(self):
29+
super().__init__()
30+
self.seed = 0
31+
self.start_date = Date(2010, 1, 1)
32+
self.end_date = self.start_date + pd.DateOffset(years=31) #CHECK
33+
self.pop_size = 100_000
34+
self._scenarios = self._get_scenarios()
35+
self.number_of_draws = len(self._scenarios)
36+
self.runs_per_draw = 2
37+
38+
def log_configuration(self):
39+
return {
40+
'filename': 'effect_of_policy',
41+
'directory': Path('./outputs'), # <- (specified only for local running)
42+
'custom_levels': {
43+
'*': logging.WARNING,
44+
'tlo.methods.demography': logging.INFO,
45+
'tlo.methods.demography.detail': logging.WARNING,
46+
'tlo.methods.healthburden': logging.INFO,
47+
'tlo.methods.healthsystem.summary': logging.INFO,
48+
}
49+
}
50+
51+
def modules(self):
52+
return fullmodel(resourcefilepath=self.resources) + [ScenarioSwitcher(resourcefilepath=self.resources)]
53+
54+
def draw_parameters(self, draw_number, rng):
55+
if draw_number < self.number_of_draws:
56+
return list(self._scenarios.values())[draw_number]
57+
else:
58+
return
59+
60+
# case 1: gfHE = -0.030, factor = 1.01074
61+
# case 2: gfHE = -0.020, factor = 1.02116
62+
# case 3: gfHE = -0.015, factor = 1.02637
63+
# case 4: gfHE = 0.015, factor = 1.05763
64+
# case 5: gfHE = 0.020, factor = 1.06284
65+
# case 6: gfHE = 0.030, factor = 1.07326
66+
67+
def _get_scenarios(self) -> Dict[str, Dict]:
68+
"""Return the Dict with values for the parameters that are changed, keyed by a name for the scenario.
69+
"""
70+
return {
71+
"No growth":
72+
mix_scenarios(
73+
get_parameters_for_status_quo(),
74+
{
75+
# MUST ADD SWITCH TO PERFECT CONSUMABLE AVAILABILITY IN 2018
76+
"HealthSystem": {
77+
"yearly_HR_scaling_mode": "no_scaling",
78+
"year_mode_switch": 2019,
79+
"mode_appt_constraints_postSwitch": 2,
80+
"policy_name": "Naive",
81+
"tclose_overwrite": 1,
82+
"tclose_days_offset_overwrite": 7,
83+
"use_funded_or_actual_staffing": "actual",
84+
"year_cons_availability_switch": 2019,
85+
"cons_availability_postSwitch": "all",
86+
},
87+
}
88+
),
89+
90+
"GDP growth":
91+
mix_scenarios(
92+
get_parameters_for_status_quo(),
93+
{
94+
"HealthSystem": {
95+
"yearly_HR_scaling_mode": "GDP_growth",
96+
"year_mode_switch": 2019,
97+
"mode_appt_constraints_postSwitch": 2,
98+
"policy_name": "Naive",
99+
"tclose_overwrite": 1,
100+
"tclose_days_offset_overwrite": 7,
101+
"use_funded_or_actual_staffing": "actual",
102+
"year_cons_availability_switch": 2019,
103+
"cons_availability_postSwitch": "all",
104+
},
105+
}
106+
),
107+
108+
"GDP growth fHE growth case 1":
109+
mix_scenarios(
110+
get_parameters_for_status_quo(),
111+
{
112+
"HealthSystem": {
113+
"yearly_HR_scaling_mode": "GDP_growth_fHE_case1",
114+
"year_mode_switch": 2019,
115+
"mode_appt_constraints_postSwitch": 2,
116+
"policy_name": "Naive",
117+
"tclose_overwrite": 1,
118+
"tclose_days_offset_overwrite": 7,
119+
"use_funded_or_actual_staffing": "actual",
120+
"year_cons_availability_switch": 2019,
121+
"cons_availability_postSwitch": "all",
122+
},
123+
}
124+
),
125+
126+
"GDP growth fHE growth case 3":
127+
mix_scenarios(
128+
get_parameters_for_status_quo(),
129+
{
130+
"HealthSystem": {
131+
"yearly_HR_scaling_mode": "GDP_growth_fHE_case3",
132+
"year_mode_switch": 2019,
133+
"mode_appt_constraints_postSwitch": 2,
134+
"policy_name": "Naive",
135+
"tclose_overwrite": 1,
136+
"tclose_days_offset_overwrite": 7,
137+
"use_funded_or_actual_staffing": "actual",
138+
"year_cons_availability_switch": 2019,
139+
"cons_availability_postSwitch": "all",
140+
},
141+
}
142+
),
143+
144+
"GDP growth fHE growth case 4":
145+
mix_scenarios(
146+
get_parameters_for_status_quo(),
147+
{
148+
"HealthSystem": {
149+
"yearly_HR_scaling_mode": "GDP_growth_fHE_case4",
150+
"year_mode_switch": 2019,
151+
"mode_appt_constraints_postSwitch": 2,
152+
"policy_name": "Naive",
153+
"tclose_overwrite": 1,
154+
"tclose_days_offset_overwrite": 7,
155+
"use_funded_or_actual_staffing": "actual",
156+
"year_cons_availability_switch": 2019,
157+
"cons_availability_postSwitch": "all",
158+
},
159+
}
160+
),
161+
162+
"GDP growth fHE growth case 6":
163+
mix_scenarios(
164+
get_parameters_for_status_quo(),
165+
{
166+
"HealthSystem": {
167+
"yearly_HR_scaling_mode": "GDP_growth_fHE_case6",
168+
"year_mode_switch": 2019,
169+
"mode_appt_constraints_postSwitch": 2,
170+
"policy_name": "Naive",
171+
"tclose_overwrite": 1,
172+
"tclose_days_offset_overwrite": 7,
173+
"use_funded_or_actual_staffing": "actual",
174+
"year_cons_availability_switch": 2019,
175+
"cons_availability_postSwitch": "all",
176+
},
177+
}
178+
),
179+
}
180+
181+
if __name__ == '__main__':
182+
from tlo.cli import scenario_run
183+
184+
scenario_run([__file__])

src/tlo/methods/healthsystem.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ class HealthSystem(Module):
202202
'policy_name': Parameter(
203203
Types.STRING, "Name of priority policy adopted"),
204204
'year_mode_switch': Parameter(
205-
Types.INT, "Year in which mode switch in enforced"),
206-
205+
Types.INT, "Year in which mode switch is enforced"),
206+
'year_cons_availability_switch': Parameter(
207+
Types.INT, "Year in which consumable availability switch is enforced. The change happens"
208+
"on 1st January of that year.)"),
207209
'priority_rank': Parameter(
208210
Types.DICT, "Data on the priority ranking of each of the Treatment_IDs to be adopted by "
209211
" the queueing system under different policies, where the lower the number the higher"
@@ -288,7 +290,10 @@ class HealthSystem(Module):
288290
' to the module initialiser.',
289291
),
290292
'mode_appt_constraints_postSwitch': Parameter(
291-
Types.INT, 'Mode considered after a mode switch in year_mode_switch.')
293+
Types.INT, 'Mode considered after a mode switch in year_mode_switch.'),
294+
'cons_availability_postSwitch': Parameter(
295+
Types.STRING, 'Consumables availability after switch in `year_cons_availability_switch`. Acceptable values'
296+
'are the same as those for Parameter `cons_availability`.')
292297
}
293298

294299
PROPERTIES = {
@@ -653,6 +658,17 @@ def initialise_simulation(self, sim):
653658
sim.schedule_event(HealthSystemChangeMode(self),
654659
Date(self.parameters["year_mode_switch"], 1, 1))
655660

661+
# Schedule a consumables availability switch
662+
sim.schedule_event(
663+
HealthSystemChangeParameters(
664+
self,
665+
parameters={
666+
'cons_availability': self.parameters['cons_availability_postSwitch']
667+
}
668+
),
669+
Date(self.parameters["year_cons_availability_switch"], 1, 1)
670+
)
671+
656672
# Schedule a one-off rescaling of _daily_capabilities broken down by officer type and level.
657673
# This occurs on 1st January of the year specified in the parameters.
658674
sim.schedule_event(ConstantRescalingHRCapabilities(self),

0 commit comments

Comments
 (0)