-
Notifications
You must be signed in to change notification settings - Fork 11
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
Including scaling (const_HR_scaling
) in assumed daily capabilities
#1241
Merged
Merged
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3bf122c
Include absenteeism considerations in assumed daily capabilities
marghe-molaro 77cc4aa
Remove files added by mistake and include formatting changes
marghe-molaro 19817d5
Style fixes
marghe-molaro 45a9bfb
Merge branch 'master' into molaro/include-absenteeism-option
tbhallett 0c00b4d
move absenteeism folder into human_resources folder
tbhallett 8730667
add test
tbhallett 57ad260
change type of parameter to be categorical
tbhallett 0619b7f
add detail to defn of property
tbhallett e641c8a
update path to resourcefile
tbhallett 63ad5e0
remove unused comment
tbhallett c7335e8
factorize to put logic in its own little function; and do the scaling…
tbhallett 3ce85fb
move check up (so that it occurs before the address). but could also …
tbhallett 1d4d0b9
Reset parameter to be of type string. (Making it a categorical seems …
tbhallett ea1eac6
Generalise rescaling of HR resources at the start of the simulation t…
marghe-molaro 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
4 changes: 2 additions & 2 deletions
4
resources/healthsystem/ResourceFile_HealthSystem_parameters.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
resources/healthsystem/absenteeism/HHFA_amended_ResourceFile_patient_facing_time.xlsx
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
resources/healthsystem/absenteeism/ResourceFile_Absenteeism.xlsx
Git LFS file not shown
48 changes: 48 additions & 0 deletions
48
...hsystem/human_resources/formatting_absenteeism_factors_from_health_facility_assessment.py
This file contains 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,48 @@ | ||
import pandas as pd | ||
|
||
dict = { "1a" : "L1a_Av_Mins_Per_Day", "1b":"L1b_Av_Mins_Per_Day", "2":"L2_Av_Mins_Per_Day", "0":"L0_Av_Mins_Per_Day", "3": "L3_Av_Mins_Per_Day", "4": "L4_Av_Mins_Per_Day", "5": "L5_Av_Mins_Per_Day"} | ||
|
||
# Specify the file paths | ||
file_path1 = "resources/healthsystem/human_resources/actual/ResourceFile_Daily_Capabilities.csv" | ||
file_path2 = "resources/healthsystem/human_resources/definitions/ResourceFile_Officer_Types_Table.csv" | ||
file_path3 = "resources/healthsystem/absenteeism/HHFA_amended_ResourceFile_patient_facing_time.xlsx" | ||
|
||
# Load Excel files into DataFrames | ||
daily_capabilities = pd.read_csv(file_path1) | ||
officer_types = pd.read_csv(file_path2) | ||
survey_daily_capabilities = pd.read_excel(file_path3, sheet_name="Scenario 2") | ||
|
||
# Clean survey_daily_capabilities by replacing officer codes with category, and calculating mean within category | ||
merged_df = pd.merge(survey_daily_capabilities, officer_types, on="Officer_Type_Code", how="left") | ||
survey_daily_capabilities["Officer_Category"] = merged_df["Officer_Category"] | ||
del survey_daily_capabilities["Officer_Type_Code"] | ||
del survey_daily_capabilities["Total_Av_Working_Days"] | ||
survey_daily_capabilities = survey_daily_capabilities.groupby("Officer_Category").mean().reset_index() | ||
|
||
# Obtain average mins per day | ||
daily_capabilities["Av_mins_per_day"] = (daily_capabilities["Total_Mins_Per_Day"]/daily_capabilities["Staff_Count"]).fillna(0) | ||
|
||
# Obtain officers types | ||
officers = daily_capabilities["Officer_Category"].drop_duplicates() | ||
|
||
# Obtain mean daily capabilities for given facility level and officer category across all facilities | ||
summarise_daily_capabilities = pd.DataFrame(columns=survey_daily_capabilities.columns) | ||
summarise_daily_capabilities["Officer_Category"] = survey_daily_capabilities["Officer_Category"] | ||
|
||
for level in ["0", "1a", "1b", "2"]: | ||
dc_at_level = daily_capabilities[daily_capabilities["Facility_Level"]==level] | ||
for officer in officers: | ||
dc_at_level_officer = dc_at_level[dc_at_level["Officer_Category"]==officer] | ||
mean_val = dc_at_level_officer["Av_mins_per_day"].mean() | ||
summarise_daily_capabilities.loc[summarise_daily_capabilities["Officer_Category"] == officer, dict[level]] = mean_val | ||
|
||
survey_daily_capabilities = survey_daily_capabilities.set_index("Officer_Category") | ||
summarise_daily_capabilities = summarise_daily_capabilities.set_index("Officer_Category") | ||
|
||
# If not data is available, assume scaling factor of 1 | ||
absenteeism_factor = (survey_daily_capabilities/summarise_daily_capabilities).fillna(1.) | ||
|
||
# Output absenteeism file | ||
absenteeism_factor.to_excel("absenteeism_factor.xlsx") | ||
|
||
print(absenteeism_factor) |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the data produced has some values greater than 1.0 (I think this speaks to systematic biases between HHFA and the official and CHAI data.) Should we cap at 1.0? If we allow this assumption to inflate the Min Time Available, it could be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I had mentioned in my initial description of this PR that there is this issue ("NOTE: Currently, the capabilities obtained from the 2018/2019 Malawi Harmonised Health Facility Assessment survey appear to exceed those assumed in our “actual” scenario in a number of cases (e.g. DCSA). Further discussion will be required before this mode can be included.") We're discussing with Wiktoria on the 14/02 to review this.
The reason I didn't include any >1.0 caps is in case we might want to use the same framework to look at boosting of capacities as well as absenteeism effects. E.g. if we wanted to look at capability expansion of specific cadres we would just need to set these factors to be > 1 where relevant. (Admittedly, if we were to do this it would be good to rename variables for consistency). If you think these should be dealt with separately then I agree the >1 cap would be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine! I get it, and sorry for missing your notes.
So maybe the solution is to use a more agnostic naming for this feature (e.g. "officer_minutes_scaler"), that would naturally and obviously accommodate those different options.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that sounds good - sorry should have named it so from the beginning.