47
47
48
48
49
49
# 1. HR cost
50
- '''
51
- Notes:
52
- 1. Ignore squeeze factor, i.e. the actual capability used is costed
53
- 2. ? capabilities_coefficient
54
- '''
55
50
# 1.1 Overall HR Cost
56
51
# Annual salary by officer type and facility level
57
52
workbook = pd .read_excel ((resourcefilepath / "ResourceFile_Costing.xlsx" ),
68
63
salary_df = pd .merge (hr_annual_salary , aggregate_frac_time_used_by_officer_type , on = ['OfficerType_FacilityLevel' ])
69
64
salary_df ['Total_salary_by_cadre_and_level' ] = salary_df ['Salary_USD' ] * salary_df ['Value' ]
70
65
scenario_cost = pd .DataFrame ()
71
- scenario_cost ['HR' ] = salary_df ['Total_salary_by_cadre_and_level' ].sum () # Need to fix this!
66
+ scenario_cost ['HR' ] = salary_df ['Total_salary_by_cadre_and_level' ].sum ()
67
+
68
+ # Plot salary costs by cadre and facility level
69
+ # Group by cadre and level
70
+ total_salary_by_cadre = salary_df .groupby ('Officer_Category' )['Total_salary_by_cadre_and_level' ].sum ()
71
+ total_salary_by_level = salary_df .groupby ('Facility_Level' )['Total_salary_by_cadre_and_level' ].sum ()
72
+
73
+ # If the folder doesn't exist, create it
74
+ costing_outputs_folder = Path ('./outputs/costing' )
75
+ if not os .path .exists (costing_outputs_folder ):
76
+ os .makedirs (costing_outputs_folder )
77
+
78
+ # Plot by cadre
79
+ total_salary_by_cadre .plot (kind = 'bar' )
80
+ plt .xlabel ('Officer_category' )
81
+ plt .ylabel ('Total Salary' )
82
+ plt .title ('Total Salary by Cadre' )
83
+ plt .savefig (costing_outputs_folder / 'total_salary_by_cadre.png' )
84
+
85
+ # Plot by level
86
+ total_salary_by_level .plot (kind = 'bar' )
87
+ plt .xlabel ('Facility_Level' )
88
+ plt .ylabel ('Total Salary' )
89
+ plt .title ('Total Salary by Facility_Level' )
90
+ plt .savefig (costing_outputs_folder / 'total_salary_by_level.png' )
91
+
92
+ # TODO Disaggregate by district using 'Frac_Time_Used_By_Facility_ID'
93
+ # TODO Disaggregate by Treatment_ID - will need this for cost-effectiveness estimates - current log does not provide this
94
+
95
+
96
+
97
+ '''
98
+ # Scratch pad
72
99
73
100
log['tlo.methods.healthsystem']['Capacity']['Frac_Time_Used_By_Facility_ID'] # for district disaggregation
74
- log ['tlo.methods.healthsystem' ]['Capacity' ]['Frac_Time_Used_By_OfficerType' ][0 ]
75
101
76
102
# Aggregate Daily capabilities to total used by cadre and facility level
77
- # Multiply these with the correct salary figure - need dictionary mapping (or read costing as a csv)
78
-
79
- # Bar plot of salary costs by cadre and facility level
80
103
81
104
# log['tlo.methods.healthsystem.summary']['Capacity']['Frac_Time_Used_By_OfficerType']
82
105
# 1.2 HR cost by Treatment_ID
83
106
# For HR cost by Treatment_ID, multiply total cost by Officer type by fraction of time used for treatment_ID
84
- log ['tlo.methods.healthsystem.summary' ]['HSI_Event' ]['TREATMENT_ID' ][ 0 ] # what does this represent? why are there 3 rows (2 scenarios)
107
+ log['tlo.methods.healthsystem.summary']['HSI_Event']['TREATMENT_ID'] # what does this represent? why are there 3 rows (2 scenarios)
85
108
# But what we need is the HR use by Treatment_ID - Leave this for later?
86
109
87
110
# log['tlo.scenario']
88
111
log['tlo.methods.healthsystem.summary']['HSI_Event']['Number_By_Appt_Type_Code']
89
112
90
113
91
-
92
-
93
-
94
-
95
114
df = pd.DataFrame(log['tlo.methods.healthsystem.summary'])
96
115
df.to_csv(outputfilepath / 'temp.csv')
97
116
@@ -112,3 +131,6 @@ def read_parameters(self, data_folder):
112
131
workbook = pd.read_excel((resourcefilepath / "ResourceFile_Costing.xlsx"),
113
132
sheet_name = None)
114
133
human_resources = workbook["human_resources"]
134
+
135
+ '''
136
+
0 commit comments