From 09d8bb2b47da5dfc1377d649c1a23a2764e0940a Mon Sep 17 00:00:00 2001 From: sakshimohan Date: Thu, 5 Sep 2024 14:20:29 +0100 Subject: [PATCH] Drop columns not needed from RF_items_and_packages - the units per case are now hard coded in the script - the unit cost is in ResourceFile_costing.xlsx --- ...rceFile_Consumables_Items_and_Packages.csv | 4 +- ...ate_consumables_item_codes_and_packages.py | 72 ++++++------------- 2 files changed, 22 insertions(+), 54 deletions(-) diff --git a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv index 0ee403abb0..f3589757c7 100644 --- a/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv +++ b/resources/healthsystem/consumables/ResourceFile_Consumables_Items_and_Packages.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4106c2e3ae068d40b115857885b673bec3e1114be5183c0a4ae0366560e2a5c9 -size 249391 +oid sha256:596a1bc8d570f341da180fea6db1836c181f6a2a984a9c7f9b4990b78df8e689 +size 215244 diff --git a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py index 7ca04f763f..db6af01154 100644 --- a/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py +++ b/src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py @@ -19,22 +19,20 @@ import numpy as np import pandas as pd -# Set local Dropbox source -path_to_dropbox = Path( # <-- point to the TLO dropbox locally - # '/Users/tbh03/Dropbox (SPH Imperial College)/Thanzi la Onse Theme 1 SHARE' - '/Users/sm2511/Dropbox/Thanzi La Onse') +# Set local shared folder source +path_to_share = Path( # <-- point to the shared folder + '/Users/sm2511/Library/CloudStorage/OneDrive-SharedLibraries-ImperialCollegeLondon/TLOModel - WP - Documents/' +) resourcefilepath = Path("./resources") path_for_new_resourcefiles = resourcefilepath / "healthsystem/consumables" # EHP Consumables list -path_to_files_in_the_tlo_dropbox = path_to_dropbox / "05 - Resources/Module-healthsystem/consumables raw files/" - -workingfile_ehp_consumables = path_to_dropbox / \ +workingfile_ehp_consumables = path_to_share / \ "05 - Resources/Module-healthsystem/From Matthias Arnold/ORIGINAL_Intervention input.xlsx" -workingfile_one_health = path_to_dropbox / \ +workingfile_one_health = path_to_share / \ "07 - Data/OneHealth projection files/OneHealth commodities.xlsx" @@ -157,7 +155,8 @@ wb = wb.merge(intv_codes, on='Intervention_Pkg', how='left', indicator=True) assert (wb['_merge'] == 'both').all() -wb = wb.drop(columns='_merge') +wb = wb.drop(columns=['_merge','Expected_Units_Per_Case', + 'Unit_Cost']) # Assign a unique code for each individual consumable item unique_items = pd.unique(wb['Items']) @@ -172,9 +171,7 @@ 'Intervention_Pkg', 'Intervention_Pkg_Code', 'Items', - 'Item_Code', - 'Expected_Units_Per_Case', - 'Unit_Cost']] + 'Item_Code']] assert not pd.isnull(wb).any().any() @@ -215,7 +212,7 @@ only_in_oh['Intervention_Pkg'] = 'Misc' only_in_oh['Intervention_Pkg_Code'] = -99 only_in_oh['Item_Code'] = np.arange(1000, 1000 + len(only_in_oh)) -only_in_oh['Expected_Units_Per_Case'] = 1.0 +only_in_oh = only_in_oh.drop(columns = 'Unit_Cost') assert set(only_in_oh.columns) == set(wb.columns) @@ -249,8 +246,6 @@ def add_record(df: pd.DataFrame, record: Dict): assert set(df.columns) == set(record.keys()) return pd.concat([df, pd.DataFrame.from_records([record])], ignore_index=True) - - cons = add_record( cons, { @@ -258,10 +253,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "Forceps, obstetric", - 'Item_Code': 2669, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - } + 'Item_Code': 2669} ) cons = add_record( @@ -271,10 +263,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "Vacuum, obstetric", - 'Item_Code': 2670, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - }, + 'Item_Code': 2670}, ) cons = add_record( @@ -284,10 +273,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "First-line ART regimen: adult", - 'Item_Code': 2671, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - }, + 'Item_Code': 2671}, ) cons = add_record( @@ -297,10 +283,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "First line ART regimen: older child", - 'Item_Code': 2672, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - }, + 'Item_Code': 2672}, ) cons = add_record( @@ -310,10 +293,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "First line ART regimen: young child", - 'Item_Code': 2673, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - }, + 'Item_Code': 2673}, ) cons = add_record( @@ -323,10 +303,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "Pre-exposure prophlaxis for HIV", - 'Item_Code': 2674, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - }, + 'Item_Code': 2674}, ) cons = add_record( @@ -336,10 +313,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Isoniazid preventative therapy for HIV+ no TB", 'Intervention_Pkg_Code': 82, 'Items': "Isoniazid/Rifapentine", - 'Item_Code': 2678, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': 1.0 - }, + 'Item_Code': 2678}, ) cons = add_record( @@ -349,9 +323,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "Cystoscope", - 'Item_Code': 285, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': np.nan}, + 'Item_Code': 285}, ) cons = add_record( @@ -360,9 +332,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "Endoscope", - 'Item_Code': 280, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': np.nan}, + 'Item_Code': 280}, ) cons = add_record( @@ -371,9 +341,7 @@ def add_record(df: pd.DataFrame, record: Dict): 'Intervention_Pkg': "Misc", 'Intervention_Pkg_Code': -99, 'Items': "Prostate specific antigen test", - 'Item_Code': 281, - 'Expected_Units_Per_Case': 1.0, - 'Unit_Cost': np.nan}, + 'Item_Code': 281}, )