Skip to content

Commit

Permalink
Drop columns not needed from RF_items_and_packages
Browse files Browse the repository at this point in the history
- the units per case are now hard coded in the script
- the unit cost is in ResourceFile_costing.xlsx
  • Loading branch information
sakshimohan committed Sep 5, 2024
1 parent 4ab53e3 commit 09d8bb2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 54 deletions.
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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'])
Expand All @@ -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()

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -249,19 +246,14 @@ 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,
{
'Intervention_Cat': "Added by JC",
'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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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},
)


Expand Down

0 comments on commit 09d8bb2

Please sign in to comment.