-
Notifications
You must be signed in to change notification settings - Fork 16
Nurse Shortages #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
PempheroM
wants to merge
30
commits into
master
Choose a base branch
from
pemphero/nurses_scenario
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+173
−0
Draft
Nurse Shortages #1749
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
07b12f5
scenario file
PempheroM cb095e3
Merge branch 'master' into pemphero/nurses_scenario
thewati 6617d49
changes_yearmode,hr scaling
PempheroM f586244
added default function
PempheroM 94a9b35
reformat
PempheroM 7f24781
Merge remote-tracking branch 'origin/pemphero/nurses_scenario' into p…
PempheroM ec05b17
remove unused input
PempheroM 97c63a9
Merge branch 'master' into pemphero/nurses_scenario
PempheroM 7994ed8
added files for improved and worse case scenarios
PempheroM 9cb86db
Merge remote-tracking branch 'origin/pemphero/nurses_scenario' into p…
PempheroM 40406ef
addressing comments
PempheroM 6657544
.
thewati 0a95a42
Merge remote-tracking branch 'origin/master'
thewati 6e84902
Merge remote-tracking branch 'origin/master'
thewati f6cd794
Merge remote-tracking branch 'origin/master'
thewati 660f2a0
Merge remote-tracking branch 'origin/master'
thewati 74e7486
Merge remote-tracking branch 'origin/master'
thewati e3d3c41
Merge remote-tracking branch 'origin/master'
thewati 992984a
Merge remote-tracking branch 'origin/master'
thewati 7ef22f1
Merge branch 'master' into pemphero/nurses_scenario
thewati 45174af
Merge remote-tracking branch 'origin/pemphero/nurses_scenario' into p…
thewati cc60285
setup analyses for qs
thewati 95f4020
isort
thewati 6d2ba99
change start and end years
thewati af3261e
Merge remote-tracking branch 'origin/master'
thewati 55f31fd
Merge branch 'master' into pemphero/nurses_scenario
thewati b789b7a
Merge branch 'master' into pemphero/nurses_scenario
tbhallett 9fa9a29
Merge branch 'master' into pemphero/nurses_scenario
tbhallett d5def29
TH suggestions
tbhallett beadfee
linting!
tbhallett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...s/scaling_capabilities/ResourceFile_HR_scaling_by_level_and_officer_type/custom_worse.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
...ling_capabilities/ResourceFile_HR_scaling_by_level_and_officer_type/improved_staffing.csv
Git LFS file not shown
167 changes: 167 additions & 0 deletions
167
src/scripts/nurses_analyses/nurses_scenario_analyses.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| """ | ||
| This scenario file sets up the scenarios for simulating the effects of nursing staffing levels. | ||
|
|
||
| Run on the batch system using: | ||
| ``` | ||
| tlo batch-submit src/scripts/nurses_analyses/nurses_scenario_analyses.py | ||
| ``` | ||
|
|
||
| or locally using: | ||
| ``` | ||
| tlo scenario-run src/scripts/nurses_analyses/nurses_scenario_analyses.py | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| """ | ||
|
|
||
| from pathlib import Path | ||
| from typing import Dict | ||
|
|
||
| from tlo import Date, logging | ||
| from tlo.analysis.utils import ( | ||
| get_parameters_for_hrh_historical_scaling_and_rescaling_for_mode2, | ||
| get_root_path, | ||
| mix_scenarios, | ||
| ) | ||
| from tlo.methods.fullmodel import fullmodel | ||
| from tlo.methods.scenario_switcher import ImprovedHealthSystemAndCareSeekingScenarioSwitcher | ||
| from tlo.scenario import BaseScenario | ||
|
|
||
|
|
||
| class StaffingScenario(BaseScenario): | ||
| def __init__(self): | ||
| super().__init__() | ||
| self.resources = get_root_path() / "resources" | ||
| self.seed = 0 | ||
| self.start_date = Date(2010, 1, 1) | ||
| self.end_date = Date(2035, 1, 1) | ||
| self.pop_size = 200 | ||
| self._scenarios = self._get_scenarios() | ||
| self.number_of_draws = len(self._scenarios) | ||
| self.runs_per_draw = 2 | ||
tbhallett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def log_configuration(self): | ||
| return { | ||
| 'filename': 'nurses_scenario_outputs', | ||
| '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() + [ | ||
| ImprovedHealthSystemAndCareSeekingScenarioSwitcher()] | ||
|
|
||
| def draw_parameters(self, draw_number, rng): | ||
| if draw_number < self.number_of_draws: | ||
| return list(self._scenarios.values())[draw_number] | ||
|
|
||
| def draw_name(self, draw_number) -> str: | ||
| """Store scenario name. | ||
| (This name can be retrieved by the plotting scripts to make the graphs be labelled nicely). | ||
| """ | ||
| if draw_number < self.number_of_draws: | ||
| return list(self._scenarios.keys())[draw_number] | ||
|
|
||
| @property | ||
| def _default_of_all_scenarios(self) -> Dict: | ||
| """Base set of parameters is the standard historical scaling and transition into Mode 2.""" | ||
| return get_parameters_for_hrh_historical_scaling_and_rescaling_for_mode2() | ||
|
|
||
| @property | ||
| def _default_of_all_max_healthsystem_scenarios(self) -> Dict: | ||
| """Improved Health System Performance: the same as the default for scenarios, but increases health system | ||
| function and healthcare seeking behaviour in 2027""" | ||
| return mix_scenarios( | ||
| self._default_of_all_scenarios, # <-- start with the same default set of parameters (to avoid repeating them) | ||
| { | ||
| 'ImprovedHealthSystemAndCareSeekingScenarioSwitcher': { | ||
| 'max_healthcare_seeking': [False, True], | ||
| 'max_healthsystem_function': [False, True], | ||
| 'year_of_switch': 2027, | ||
| }, | ||
| }, | ||
| ) | ||
|
|
||
| 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 { | ||
| "Baseline Nurses / Default Healthsystem Function": | ||
| mix_scenarios( | ||
| self._default_of_all_scenarios, | ||
| { | ||
| "HealthSystem": { | ||
| 'HR_scaling_by_level_and_officer_type_mode': "default", | ||
| "year_HR_scaling_by_level_and_officer_type": 2027, | ||
| }, | ||
| }, | ||
| ), | ||
|
|
||
| "Fewer Nurses / Default Healthsystem Function": | ||
| mix_scenarios( | ||
| self._default_of_all_scenarios, | ||
| { | ||
| "HealthSystem": { | ||
| 'HR_scaling_by_level_and_officer_type_mode': "custom_worse", | ||
| "year_HR_scaling_by_level_and_officer_type": 2027, | ||
| }, | ||
| }, | ||
| ), | ||
|
|
||
| "More Nurses / Default Healthsystem Function": | ||
| mix_scenarios( | ||
| self._default_of_all_scenarios, | ||
| { | ||
| "HealthSystem": { | ||
| 'HR_scaling_by_level_and_officer_type_mode': "improved_staffing", | ||
| "year_HR_scaling_by_level_and_officer_type": 2027, | ||
| }, | ||
| }, | ||
| ), | ||
|
|
||
| "Baseline Nurses / Improved Healthsystem Function": | ||
| mix_scenarios( | ||
| self._default_of_all_max_healthsystem_scenarios, | ||
| { | ||
| "HealthSystem": { | ||
| 'HR_scaling_by_level_and_officer_type_mode': "default", | ||
| "year_HR_scaling_by_level_and_officer_type": 2027, | ||
| }, | ||
| }, | ||
| ), | ||
|
|
||
| "Fewer Nurses / Improved Healthsystem Function": | ||
| mix_scenarios( | ||
| self._default_of_all_max_healthsystem_scenarios, | ||
| { | ||
| "HealthSystem": { | ||
| 'HR_scaling_by_level_and_officer_type_mode': "custom_worse", | ||
| "year_HR_scaling_by_level_and_officer_type": 2027, | ||
| }, | ||
| }, | ||
| ), | ||
|
|
||
| "More Nurses / Improved Healthsystem Function": | ||
| mix_scenarios( | ||
| self._default_of_all_max_healthsystem_scenarios, | ||
| { | ||
| "HealthSystem": { | ||
| 'HR_scaling_by_level_and_officer_type_mode': "improved_staffing", | ||
| "year_HR_scaling_by_level_and_officer_type": 2027, | ||
| }, | ||
| }, | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| from tlo.cli import scenario_run | ||
|
|
||
| scenario_run([__file__]) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.