Skip to content

Commit 09d8bb2

Browse files
author
sakshimohan
committed
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
1 parent 4ab53e3 commit 09d8bb2

File tree

2 files changed

+22
-54
lines changed

2 files changed

+22
-54
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:4106c2e3ae068d40b115857885b673bec3e1114be5183c0a4ae0366560e2a5c9
3-
size 249391
2+
oid sha256:596a1bc8d570f341da180fea6db1836c181f6a2a984a9c7f9b4990b78df8e689
3+
size 215244

src/scripts/data_file_processing/healthsystem/consumables/processing_data_from_one_health/generate_consumables_item_codes_and_packages.py

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@
1919
import numpy as np
2020
import pandas as pd
2121

22-
# Set local Dropbox source
23-
path_to_dropbox = Path( # <-- point to the TLO dropbox locally
24-
# '/Users/tbh03/Dropbox (SPH Imperial College)/Thanzi la Onse Theme 1 SHARE'
25-
'/Users/sm2511/Dropbox/Thanzi La Onse')
22+
# Set local shared folder source
23+
path_to_share = Path( # <-- point to the shared folder
24+
'/Users/sm2511/Library/CloudStorage/OneDrive-SharedLibraries-ImperialCollegeLondon/TLOModel - WP - Documents/'
25+
)
2626

2727
resourcefilepath = Path("./resources")
2828
path_for_new_resourcefiles = resourcefilepath / "healthsystem/consumables"
2929

3030

3131
# EHP Consumables list
32-
path_to_files_in_the_tlo_dropbox = path_to_dropbox / "05 - Resources/Module-healthsystem/consumables raw files/"
33-
34-
workingfile_ehp_consumables = path_to_dropbox / \
32+
workingfile_ehp_consumables = path_to_share / \
3533
"05 - Resources/Module-healthsystem/From Matthias Arnold/ORIGINAL_Intervention input.xlsx"
3634

37-
workingfile_one_health = path_to_dropbox / \
35+
workingfile_one_health = path_to_share / \
3836
"07 - Data/OneHealth projection files/OneHealth commodities.xlsx"
3937

4038

@@ -157,7 +155,8 @@
157155

158156
wb = wb.merge(intv_codes, on='Intervention_Pkg', how='left', indicator=True)
159157
assert (wb['_merge'] == 'both').all()
160-
wb = wb.drop(columns='_merge')
158+
wb = wb.drop(columns=['_merge','Expected_Units_Per_Case',
159+
'Unit_Cost'])
161160

162161
# Assign a unique code for each individual consumable item
163162
unique_items = pd.unique(wb['Items'])
@@ -172,9 +171,7 @@
172171
'Intervention_Pkg',
173172
'Intervention_Pkg_Code',
174173
'Items',
175-
'Item_Code',
176-
'Expected_Units_Per_Case',
177-
'Unit_Cost']]
174+
'Item_Code']]
178175

179176
assert not pd.isnull(wb).any().any()
180177

@@ -215,7 +212,7 @@
215212
only_in_oh['Intervention_Pkg'] = 'Misc'
216213
only_in_oh['Intervention_Pkg_Code'] = -99
217214
only_in_oh['Item_Code'] = np.arange(1000, 1000 + len(only_in_oh))
218-
only_in_oh['Expected_Units_Per_Case'] = 1.0
215+
only_in_oh = only_in_oh.drop(columns = 'Unit_Cost')
219216

220217
assert set(only_in_oh.columns) == set(wb.columns)
221218

@@ -249,19 +246,14 @@ def add_record(df: pd.DataFrame, record: Dict):
249246
assert set(df.columns) == set(record.keys())
250247
return pd.concat([df, pd.DataFrame.from_records([record])], ignore_index=True)
251248

252-
253-
254249
cons = add_record(
255250
cons,
256251
{
257252
'Intervention_Cat': "Added by JC",
258253
'Intervention_Pkg': "Misc",
259254
'Intervention_Pkg_Code': -99,
260255
'Items': "Forceps, obstetric",
261-
'Item_Code': 2669,
262-
'Expected_Units_Per_Case': 1.0,
263-
'Unit_Cost': 1.0
264-
}
256+
'Item_Code': 2669}
265257
)
266258

267259
cons = add_record(
@@ -271,10 +263,7 @@ def add_record(df: pd.DataFrame, record: Dict):
271263
'Intervention_Pkg': "Misc",
272264
'Intervention_Pkg_Code': -99,
273265
'Items': "Vacuum, obstetric",
274-
'Item_Code': 2670,
275-
'Expected_Units_Per_Case': 1.0,
276-
'Unit_Cost': 1.0
277-
},
266+
'Item_Code': 2670},
278267
)
279268

280269
cons = add_record(
@@ -284,10 +273,7 @@ def add_record(df: pd.DataFrame, record: Dict):
284273
'Intervention_Pkg': "Misc",
285274
'Intervention_Pkg_Code': -99,
286275
'Items': "First-line ART regimen: adult",
287-
'Item_Code': 2671,
288-
'Expected_Units_Per_Case': 1.0,
289-
'Unit_Cost': 1.0
290-
},
276+
'Item_Code': 2671},
291277
)
292278

293279
cons = add_record(
@@ -297,10 +283,7 @@ def add_record(df: pd.DataFrame, record: Dict):
297283
'Intervention_Pkg': "Misc",
298284
'Intervention_Pkg_Code': -99,
299285
'Items': "First line ART regimen: older child",
300-
'Item_Code': 2672,
301-
'Expected_Units_Per_Case': 1.0,
302-
'Unit_Cost': 1.0
303-
},
286+
'Item_Code': 2672},
304287
)
305288

306289
cons = add_record(
@@ -310,10 +293,7 @@ def add_record(df: pd.DataFrame, record: Dict):
310293
'Intervention_Pkg': "Misc",
311294
'Intervention_Pkg_Code': -99,
312295
'Items': "First line ART regimen: young child",
313-
'Item_Code': 2673,
314-
'Expected_Units_Per_Case': 1.0,
315-
'Unit_Cost': 1.0
316-
},
296+
'Item_Code': 2673},
317297
)
318298

319299
cons = add_record(
@@ -323,10 +303,7 @@ def add_record(df: pd.DataFrame, record: Dict):
323303
'Intervention_Pkg': "Misc",
324304
'Intervention_Pkg_Code': -99,
325305
'Items': "Pre-exposure prophlaxis for HIV",
326-
'Item_Code': 2674,
327-
'Expected_Units_Per_Case': 1.0,
328-
'Unit_Cost': 1.0
329-
},
306+
'Item_Code': 2674},
330307
)
331308

332309
cons = add_record(
@@ -336,10 +313,7 @@ def add_record(df: pd.DataFrame, record: Dict):
336313
'Intervention_Pkg': "Isoniazid preventative therapy for HIV+ no TB",
337314
'Intervention_Pkg_Code': 82,
338315
'Items': "Isoniazid/Rifapentine",
339-
'Item_Code': 2678,
340-
'Expected_Units_Per_Case': 1.0,
341-
'Unit_Cost': 1.0
342-
},
316+
'Item_Code': 2678},
343317
)
344318

345319
cons = add_record(
@@ -349,9 +323,7 @@ def add_record(df: pd.DataFrame, record: Dict):
349323
'Intervention_Pkg': "Misc",
350324
'Intervention_Pkg_Code': -99,
351325
'Items': "Cystoscope",
352-
'Item_Code': 285,
353-
'Expected_Units_Per_Case': 1.0,
354-
'Unit_Cost': np.nan},
326+
'Item_Code': 285},
355327
)
356328

357329
cons = add_record(
@@ -360,9 +332,7 @@ def add_record(df: pd.DataFrame, record: Dict):
360332
'Intervention_Pkg': "Misc",
361333
'Intervention_Pkg_Code': -99,
362334
'Items': "Endoscope",
363-
'Item_Code': 280,
364-
'Expected_Units_Per_Case': 1.0,
365-
'Unit_Cost': np.nan},
335+
'Item_Code': 280},
366336
)
367337

368338
cons = add_record(
@@ -371,9 +341,7 @@ def add_record(df: pd.DataFrame, record: Dict):
371341
'Intervention_Pkg': "Misc",
372342
'Intervention_Pkg_Code': -99,
373343
'Items': "Prostate specific antigen test",
374-
'Item_Code': 281,
375-
'Expected_Units_Per_Case': 1.0,
376-
'Unit_Cost': np.nan},
344+
'Item_Code': 281},
377345
)
378346

379347

0 commit comments

Comments
 (0)