-
Notifications
You must be signed in to change notification settings - Fork 4
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
possible inconsistencies in using get_blank_appt_footprint() #1401
Comments
Thanks @tdm32 I agree with this being misleading if people are just looking at counts of HSI Event occurrences. We could make a new logging key, which is for counts of appointment that incurred some HCW time (i.e. ran, and did not return a blank footprint). Would that help...? |
@sakshimohan also notes here
# Load outputs
results_folder = Path(outputspath / 'sakshi.mohan@york.ac.uk/impact_of_consumables_scenarios-2024-06-11T204007Z/')
log = load_pickled_dataframes(results_folder)
TARGET_PERIOD = (Date(2010, 1, 1), Date(2019, 12, 31))
def get_counts_of_hsi_by_treatment_id(_df):
"""Get the counts of the short TREATMENT_IDs occurring"""
_counts_by_treatment_id = _df \
.loc[pd.to_datetime(_df['date']).between(*TARGET_PERIOD), 'TREATMENT_ID'] \
.apply(pd.Series) \
.sum() \
.astype(int)
return _counts_by_treatment_id.groupby(level=0).sum()
counts_of_hsi_by_treatment_id = extract_results(
results_folder,
module='tlo.methods.healthsystem.summary',
key='HSI_Event',
custom_generate_series=get_counts_of_hsi_by_treatment_id,
do_scaling=True
)
def get_counts_of_hsis_by_level(_df):
flattened_data = []
for level, appt in _df['Number_By_Appt_Type_Code'].items():
for appt, count in appt.items():
flattened_data.append((level, appt, count))
flattened_data = pd.DataFrame(flattened_data, columns=['Facility_Level', 'Appointment_Type', 'HSI_count'])
flattened_data.set_index(['Facility_Level', 'Appointment_Type'], inplace = True)
return pd.Series(flattened_data.stack()).fillna(0).astype(int)
counts_of_hsi_by_level = extract_results(
results_folder,
module='tlo.methods.healthsystem.summary',
key='HSI_Event',
custom_generate_series=get_counts_of_hsis_by_level,
do_scaling=True
)
total_hsis_using_log_by_facility_level = counts_of_hsi_by_level.sum()[0]
total_hsis_using_log_by_treatmentID = counts_of_hsi_by_treatment_id.sum()[0]
print(f"Baseline scenario (5 runs): \n HSIs based on 'Number_By_Appt_Type_Code' {total_hsis_using_log_by_facility_level} "
f"\n HSIs based on 'TREATMENT_ID' {total_hsis_using_log_by_treatmentID}")
print(f"For run = 0, the total number HSIs as per 'Number_By_Appt_Type_Code_And_Level' key is {round(total_hsis_using_log_by_facility_level[0],2)},"
f"whereas the total number of HSIs as per the 'TREATMENT_ID' key is {round(total_hsis_using_log_by_treatmentID[0],2)}") @tbhallett responded:
|
Currently get_blank_appt_footprint() is used within some modules (HIV, TB etc) when a HSI has been scheduled but not resources are actually occupied, e.g. person is not eligible for test or is already on treatment. These HSIs are logged as having been delivered and therefore contribute to the total numbers of HSIs in outputs, even though no person-time / consumables are required.
When no resources are required, should a return statement be used so that this HSI is not logged? The current set-up may be skewing results where HSI numbers requested / delivered are used.
@tbhallett @marghe-molaro What do you think?
The text was updated successfully, but these errors were encountered: