@@ -564,9 +564,14 @@ class HealthSystem(Module):
564
564
" the dynamic_HR_scaling_factor"
565
565
),
566
566
567
- 'include_task_shifting' : Parameter (
568
- Types .BOOL , "Decide whether to allow for task-shifting in mode 2"
569
- ),
567
+ 'global_task_shifting_mode' : Parameter (
568
+ Types .STRING , "Name of global task-shifting mode adopted" ),
569
+
570
+ 'global_task_shifting' : Parameter (
571
+ Types .DICT , "Global task-shifting policy adopted by the health care system. It includes a list of the officers"
572
+ " eligible for task shifting. For each of those officers, it specifies which officers"
573
+ " can take over the officer's tasks, and a factor explaining how the originally scheduled time "
574
+ " should be scaled if performed by a different officer." ),
570
575
571
576
'tclose_overwrite' : Parameter (
572
577
Types .INT , "Decide whether to overwrite tclose variables assigned by disease modules" ),
@@ -603,7 +608,7 @@ def __init__(
603
608
beds_availability : Optional [str ] = None ,
604
609
randomise_queue : bool = True ,
605
610
ignore_priority : bool = False ,
606
- include_task_shifting : bool = False ,
611
+ global_task_shifting_mode : Optional [ str ] = None ,
607
612
policy_name : Optional [str ] = None ,
608
613
capabilities_coefficient : Optional [float ] = None ,
609
614
use_funded_or_actual_staffing : Optional [str ] = None ,
@@ -665,14 +670,6 @@ def __init__(
665
670
assert not (ignore_priority and policy_name is not None ), (
666
671
'Cannot adopt a priority policy if the priority will be then ignored'
667
672
)
668
-
669
- # Global task-shifting options. The key in the dictionary refers to the officer
670
- # eligible for task shifting, while the values refer to the officers that can take
671
- # over the officer's tasks. The numbers refer to the factor by which appt time will
672
- # have to be scaled if task is performed by alternative officer.
673
- self .global_task_shifting = {
674
- 'Pharmacy' : (['Nursing_and_Midwifery' , 'Clinical' ], [1.5 ,1 ]),
675
- }
676
673
677
674
self .disable = disable
678
675
self .disable_and_reject_all = disable_and_reject_all
@@ -689,8 +686,6 @@ def __init__(
689
686
690
687
self .ignore_priority = ignore_priority
691
688
692
- self .include_task_shifting = include_task_shifting
693
-
694
689
# This default value will be overwritten if assumed policy is not None
695
690
self .lowest_priority_considered = 2
696
691
@@ -701,6 +696,8 @@ def __init__(
701
696
'VerticalProgrammes' , 'ClinicallyVulnerable' , 'EHP_III' ,
702
697
'LCOA_EHP' ]
703
698
self .arg_policy_name = policy_name
699
+
700
+ self .arg_global_task_shifting_mode = global_task_shifting_mode
704
701
705
702
self .tclose_overwrite = None
706
703
self .tclose_days_offset_overwrite = None
@@ -833,6 +830,11 @@ def read_parameters(self, data_folder):
833
830
self .parameters ['priority_rank' ] = pd .read_excel (path_to_resourcefiles_for_healthsystem / 'priority_policies' /
834
831
'ResourceFile_PriorityRanking_ALLPOLICIES.xlsx' ,
835
832
sheet_name = None )
833
+
834
+ self .parameters ['global_task_shifting' ] = pd .read_excel (path_to_resourcefiles_for_healthsystem / 'human_resources' /
835
+ 'task_shifting' / 'ResourceFile_GlobalTaskShifting.xlsx' ,
836
+ sheet_name = None )
837
+
836
838
837
839
self .parameters ['const_HR_scaling_table' ]: Dict = pd .read_excel (
838
840
path_to_resourcefiles_for_healthsystem /
@@ -887,6 +889,9 @@ def pre_initialise_population(self):
887
889
888
890
# Set up framework for considering a priority policy
889
891
self .setup_priority_policy ()
892
+
893
+ # Set up framework for considering a global task-shifting policy
894
+ self .setup_global_task_shifting (self .parameters ['global_task_shifting_mode' ])
890
895
891
896
892
897
def initialise_population (self , population ):
@@ -988,6 +993,37 @@ def setup_priority_policy(self):
988
993
self .list_fasttrack .append (('hv_diagnosed' , 'FT_if_Hivdiagnosed' ))
989
994
if 'Tb' in self .sim .modules :
990
995
self .list_fasttrack .append (('tb_diagnosed' , 'FT_if_tbdiagnosed' ))
996
+
997
+ def setup_global_task_shifting (self ,mode ):
998
+
999
+ # Select the global task shifting mode to be considered
1000
+ self .global_task_shifting_mode = self .get_global_task_shifting_mode_initial ()
1001
+
1002
+ # Load relevant sheet from resource file
1003
+ df = self .parameters ['global_task_shifting' ][self .global_task_shifting_mode ]
1004
+
1005
+ self .global_task_shifting = {}
1006
+
1007
+ # Iterate through the rows of the DataFrame and populate the dictionary
1008
+ for index , row in df .iterrows ():
1009
+ officer = row ['Officer' ]
1010
+ alternative_officers = row ['Alternative_officer' ].split (',' )
1011
+ time_factor_str = str (row ['Time_factor' ])
1012
+
1013
+ # Split the string into a list of floats
1014
+ time_factors = [float (factor ) for factor in time_factor_str .split (',' )]
1015
+
1016
+ # Create the entry in the dictionary
1017
+ self .global_task_shifting [officer ] = (alternative_officers , time_factors )
1018
+
1019
+ if len (self .global_task_shifting ) == 0 :
1020
+ self .include_task_shifting = False
1021
+ else :
1022
+ self .include_task_shifting = True
1023
+
1024
+ # Print the resulting dictionary
1025
+ print ("self.global_task_shifting =" , self .global_task_shifting )
1026
+
991
1027
992
1028
def process_human_resources_files (self , use_funded_or_actual_staffing : str ):
993
1029
"""Create the data-structures needed from the information read into the parameters."""
@@ -1324,6 +1360,14 @@ def get_priority_policy_initial(self) -> str:
1324
1360
return self .parameters ['policy_name' ] \
1325
1361
if self .arg_policy_name is None \
1326
1362
else self .arg_policy_name
1363
+
1364
+ def get_global_task_shifting_mode_initial (self ) -> str :
1365
+ """Returns `priority_policy`. (Should be equal to what is specified by the parameter, but
1366
+ overwrite with what was provided in argument if an argument was specified -- provided for backward
1367
+ compatibility/debugging.)"""
1368
+ return self .parameters ['global_task_shifting_mode' ] \
1369
+ if self .arg_global_task_shifting_mode is None \
1370
+ else self .arg_global_task_shifting_mode
1327
1371
1328
1372
def load_priority_policy (self , policy ):
1329
1373
@@ -2922,7 +2966,6 @@ class HealthSystemChangeParameters(Event, PopulationScopeEventMixin):
2922
2966
"""Event that causes certain internal parameters of the HealthSystem to be changed; specifically:
2923
2967
* `mode_appt_constraints`
2924
2968
* `ignore_priority`
2925
- * `include_task_shifting`
2926
2969
* `capabilities_coefficient`
2927
2970
* `cons_availability`
2928
2971
* `beds_availability`
@@ -2939,9 +2982,6 @@ def apply(self, population):
2939
2982
2940
2983
if 'ignore_priority' in self ._parameters :
2941
2984
self .module .ignore_priority = self ._parameters ['ignore_priority' ]
2942
-
2943
- if 'include_task_shifting' in self ._parameters :
2944
- self .module .include_task_shifting = self ._parameters ['include_task_shifting' ]
2945
2985
2946
2986
if 'capabilities_coefficient' in self ._parameters :
2947
2987
self .module .capabilities_coefficient = self ._parameters ['capabilities_coefficient' ]
0 commit comments