Skip to content

Commit 7a9aa54

Browse files
authored
Merge pull request #472 from The-Strategy-Unit/remove-covid-adjustment
Remove covid adjustment
2 parents bab6974 + f3dcb70 commit 7a9aa54

File tree

6 files changed

+18
-54
lines changed

6 files changed

+18
-54
lines changed

src/nhp/model/activity_resampling.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,6 @@ def inequalities_adjustment(self):
161161

162162
return self._update(factor)
163163

164-
def covid_adjustment(self):
165-
"""Perform the covid adjustment."""
166-
params = self.run_params["covid_adjustment"][self._activity_type]
167-
factor = pd.Series(params, name="covid_adjustment")
168-
factor.index.names = ["group"]
169-
return self._update(factor)
170-
171164
def expat_adjustment(self):
172165
"""Perform the expatriation adjustment."""
173166
params = {

src/nhp/model/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ def generate_param_values(prm, valid_range):
256256
**{
257257
k: generate_param_values(params[k], v)
258258
for k, v in [
259-
("covid_adjustment", lambda x: x),
260259
("waiting_list_adjustment", inrange_0_5),
261260
("expat", inrange_0_1),
262261
("repat_local", inrange_1_5),

src/nhp/model/model_iteration.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def _run(self):
7373
.demographic_adjustment()
7474
.birth_adjustment()
7575
.health_status_adjustment()
76-
.covid_adjustment()
7776
.expat_adjustment()
7877
.repat_adjustment()
7978
.waiting_list_adjustment()

tests/unit/nhp/model/test_activity_resampling.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -174,27 +174,6 @@ def test_health_status_adjustmen_when_disabled(mock_activity_resampling):
174174
aa_mock.hsa.run.assert_not_called()
175175

176176

177-
def test_covid_adjustment(mocker, mock_activity_resampling):
178-
# arrange
179-
aa_mock = mock_activity_resampling
180-
aa_mock._model_iteration.model.model_type = "ip"
181-
aa_mock._model_iteration.run_params = {
182-
"covid_adjustment": {"ip": {"elective": 1, "non-elective": 2}}
183-
}
184-
185-
u_mock = mocker.patch(
186-
"nhp.model.activity_resampling.ActivityResampling._update",
187-
return_value="update",
188-
)
189-
190-
# act
191-
actual = aa_mock.covid_adjustment()
192-
193-
# assert
194-
assert actual == "update"
195-
assert u_mock.call_args[0][0].to_dict() == {"elective": 1, "non-elective": 2}
196-
197-
198177
def test_expat_adjustment_no_params(mocker, mock_activity_resampling):
199178
# arrange
200179
aa_mock = mock_activity_resampling

tests/unit/nhp/model/test_model.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def mock_model():
2828
"start_year": 2018,
2929
"end_year": 2020,
3030
"health_status_adjustment": [0.8, 1.0],
31-
"covid_adjustment": [1.0, 1.2],
3231
"waiting_list_adjustment": {
3332
"ip": {"100": 1, "120": 2},
3433
"op": {"100": 3, "120": 4},
@@ -90,15 +89,14 @@ def mock_run_params():
9089
"a": {"a_a": [1, 1, 2, 3], "a_b": [1, 4, 5, 6]},
9190
"b": {"b_a": [1, 7, 8, 9], "b_b": [1, 10, 11, 12]},
9291
},
93-
"covid_adjustment": [1, 13, 14, 15],
9492
"waiting_list_adjustment": {
9593
"ip": {"100": [1, 1, 1, 1], "120": [2, 2, 2, 2]},
9694
"op": {"100": [3, 3, 3, 3], "120": [4, 4, 4, 4]},
9795
},
98-
"expat": {"ip": {"elective": {"Other": [1, 16, 17, 18]}}},
99-
"repat_local": {"ip": {"elective": {"Other": [1, 19, 20, 21]}}},
100-
"repat_nonlocal": {"ip": {"elective": {"Other": [1, 22, 23, 24]}}},
101-
"baseline_adjustment": {"ip": {"elective": {"Other": [1, 25, 26, 27]}}},
96+
"expat": {"ip": {"elective": {"Other": [1, 13, 14, 15]}}},
97+
"repat_local": {"ip": {"elective": {"Other": [1, 16, 17, 18]}}},
98+
"repat_nonlocal": {"ip": {"elective": {"Other": [1, 19, 20, 21]}}},
99+
"baseline_adjustment": {"ip": {"elective": {"Other": [1, 22, 23, 24]}}},
102100
"inequalities": {
103101
"HRG1": {
104102
"1": [5.4321, 5.4321, 5.4321, 5.4321],
@@ -109,13 +107,13 @@ def mock_run_params():
109107
}
110108
},
111109
"activity_avoidance": {
112-
"ip": {"a_a": [1, 28, 29, 30], "a_b": [1, 31, 32, 33]},
113-
"op": {"a_a": [1, 34, 35, 36], "a_b": [1, 37, 38, 39]},
114-
"aae": {"a_a": [1, 40, 41, 42], "a_b": [1, 43, 44, 45]},
110+
"ip": {"a_a": [1, 25, 26, 27], "a_b": [1, 28, 29, 30]},
111+
"op": {"a_a": [1, 31, 32, 33], "a_b": [1, 34, 35, 36]},
112+
"aae": {"a_a": [1, 37, 38, 39], "a_b": [1, 40, 41, 42]},
115113
},
116114
"efficiencies": {
117-
"ip": {"b_a": [1, 46, 47, 48], "b_b": [1, 49, 50, 51]},
118-
"op": {"b_a": [1, 52, 53, 54], "b_b": [1, 55, 56, 57]},
115+
"ip": {"b_a": [1, 43, 44, 45], "b_b": [1, 46, 47, 48]},
116+
"op": {"b_a": [1, 49, 50, 51], "b_b": [1, 52, 53, 54]},
119117
},
120118
}
121119

@@ -445,7 +443,6 @@ def get_next_n(*args):
445443
"variant": "a",
446444
"health_status_adjustment": 1,
447445
"seed": 1,
448-
"covid_adjustment": 1,
449446
"non-demographic_adjustment": {
450447
"a": {"a_a": 1, "a_b": 1},
451448
"b": {"b_a": 1, "b_b": 1},
@@ -481,24 +478,23 @@ def get_next_n(*args):
481478
"a": {"a_a": 2, "a_b": 5},
482479
"b": {"b_a": 8, "b_b": 11},
483480
},
484-
"covid_adjustment": 14,
485481
"waiting_list_adjustment": {
486482
"ip": {"100": 1, "120": 2},
487483
"op": {"100": 3, "120": 4},
488484
},
489-
"expat": {"ip": {"elective": {"Other": 17}}},
490-
"repat_local": {"ip": {"elective": {"Other": 20}}},
491-
"repat_nonlocal": {"ip": {"elective": {"Other": 23}}},
492-
"baseline_adjustment": {"ip": {"elective": {"Other": 26}}},
485+
"expat": {"ip": {"elective": {"Other": 14}}},
486+
"repat_local": {"ip": {"elective": {"Other": 17}}},
487+
"repat_nonlocal": {"ip": {"elective": {"Other": 20}}},
488+
"baseline_adjustment": {"ip": {"elective": {"Other": 23}}},
493489
"inequalities": {"HRG1": {"1": 5.4321, "2": 4.321, "3": 3.21, "4": 2.21, "5": 1}},
494490
"activity_avoidance": {
495-
"ip": {"a_a": 29, "a_b": 32},
496-
"op": {"a_a": 35, "a_b": 38},
497-
"aae": {"a_a": 41, "a_b": 44},
491+
"ip": {"a_a": 26, "a_b": 29},
492+
"op": {"a_a": 32, "a_b": 35},
493+
"aae": {"a_a": 38, "a_b": 41},
498494
},
499495
"efficiencies": {
500-
"ip": {"b_a": 47, "b_b": 50},
501-
"op": {"b_a": 53, "b_b": 56},
496+
"ip": {"b_a": 44, "b_b": 47},
497+
"op": {"b_a": 50, "b_b": 53},
502498
},
503499
"year": 2020,
504500
},

tests/unit/nhp/model/test_model_iteration.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def test_run(mocker, mock_model_iteration):
116116
ar_mock.birth_adjustment.return_value = ar_mock
117117
ar_mock.health_status_adjustment.return_value = ar_mock
118118
ar_mock.inequalities_adjustment.return_value = ar_mock
119-
ar_mock.covid_adjustment.return_value = ar_mock
120119
ar_mock.expat_adjustment.return_value = ar_mock
121120
ar_mock.repat_adjustment.return_value = ar_mock
122121
ar_mock.waiting_list_adjustment.return_value = ar_mock
@@ -142,7 +141,6 @@ def test_run(mocker, mock_model_iteration):
142141
ar_mock.birth_adjustment.assert_called_once()
143142
ar_mock.health_status_adjustment.assert_called_once()
144143
ar_mock.inequalities_adjustment.assert_called_once()
145-
ar_mock.covid_adjustment.assert_called_once()
146144
ar_mock.expat_adjustment.assert_called_once()
147145
ar_mock.repat_adjustment.assert_called_once()
148146
ar_mock.waiting_list_adjustment.assert_called_once()

0 commit comments

Comments
 (0)