19
19
import numpy as np
20
20
import pandas as pd
21
21
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
+ )
26
26
27
27
resourcefilepath = Path ("./resources" )
28
28
path_for_new_resourcefiles = resourcefilepath / "healthsystem/consumables"
29
29
30
30
31
31
# 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 / \
35
33
"05 - Resources/Module-healthsystem/From Matthias Arnold/ORIGINAL_Intervention input.xlsx"
36
34
37
- workingfile_one_health = path_to_dropbox / \
35
+ workingfile_one_health = path_to_share / \
38
36
"07 - Data/OneHealth projection files/OneHealth commodities.xlsx"
39
37
40
38
157
155
158
156
wb = wb .merge (intv_codes , on = 'Intervention_Pkg' , how = 'left' , indicator = True )
159
157
assert (wb ['_merge' ] == 'both' ).all ()
160
- wb = wb .drop (columns = '_merge' )
158
+ wb = wb .drop (columns = ['_merge' ,'Expected_Units_Per_Case' ,
159
+ 'Unit_Cost' ])
161
160
162
161
# Assign a unique code for each individual consumable item
163
162
unique_items = pd .unique (wb ['Items' ])
172
171
'Intervention_Pkg' ,
173
172
'Intervention_Pkg_Code' ,
174
173
'Items' ,
175
- 'Item_Code' ,
176
- 'Expected_Units_Per_Case' ,
177
- 'Unit_Cost' ]]
174
+ 'Item_Code' ]]
178
175
179
176
assert not pd .isnull (wb ).any ().any ()
180
177
215
212
only_in_oh ['Intervention_Pkg' ] = 'Misc'
216
213
only_in_oh ['Intervention_Pkg_Code' ] = - 99
217
214
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' )
219
216
220
217
assert set (only_in_oh .columns ) == set (wb .columns )
221
218
@@ -249,19 +246,14 @@ def add_record(df: pd.DataFrame, record: Dict):
249
246
assert set (df .columns ) == set (record .keys ())
250
247
return pd .concat ([df , pd .DataFrame .from_records ([record ])], ignore_index = True )
251
248
252
-
253
-
254
249
cons = add_record (
255
250
cons ,
256
251
{
257
252
'Intervention_Cat' : "Added by JC" ,
258
253
'Intervention_Pkg' : "Misc" ,
259
254
'Intervention_Pkg_Code' : - 99 ,
260
255
'Items' : "Forceps, obstetric" ,
261
- 'Item_Code' : 2669 ,
262
- 'Expected_Units_Per_Case' : 1.0 ,
263
- 'Unit_Cost' : 1.0
264
- }
256
+ 'Item_Code' : 2669 }
265
257
)
266
258
267
259
cons = add_record (
@@ -271,10 +263,7 @@ def add_record(df: pd.DataFrame, record: Dict):
271
263
'Intervention_Pkg' : "Misc" ,
272
264
'Intervention_Pkg_Code' : - 99 ,
273
265
'Items' : "Vacuum, obstetric" ,
274
- 'Item_Code' : 2670 ,
275
- 'Expected_Units_Per_Case' : 1.0 ,
276
- 'Unit_Cost' : 1.0
277
- },
266
+ 'Item_Code' : 2670 },
278
267
)
279
268
280
269
cons = add_record (
@@ -284,10 +273,7 @@ def add_record(df: pd.DataFrame, record: Dict):
284
273
'Intervention_Pkg' : "Misc" ,
285
274
'Intervention_Pkg_Code' : - 99 ,
286
275
'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 },
291
277
)
292
278
293
279
cons = add_record (
@@ -297,10 +283,7 @@ def add_record(df: pd.DataFrame, record: Dict):
297
283
'Intervention_Pkg' : "Misc" ,
298
284
'Intervention_Pkg_Code' : - 99 ,
299
285
'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 },
304
287
)
305
288
306
289
cons = add_record (
@@ -310,10 +293,7 @@ def add_record(df: pd.DataFrame, record: Dict):
310
293
'Intervention_Pkg' : "Misc" ,
311
294
'Intervention_Pkg_Code' : - 99 ,
312
295
'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 },
317
297
)
318
298
319
299
cons = add_record (
@@ -323,10 +303,7 @@ def add_record(df: pd.DataFrame, record: Dict):
323
303
'Intervention_Pkg' : "Misc" ,
324
304
'Intervention_Pkg_Code' : - 99 ,
325
305
'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 },
330
307
)
331
308
332
309
cons = add_record (
@@ -336,10 +313,7 @@ def add_record(df: pd.DataFrame, record: Dict):
336
313
'Intervention_Pkg' : "Isoniazid preventative therapy for HIV+ no TB" ,
337
314
'Intervention_Pkg_Code' : 82 ,
338
315
'Items' : "Isoniazid/Rifapentine" ,
339
- 'Item_Code' : 2678 ,
340
- 'Expected_Units_Per_Case' : 1.0 ,
341
- 'Unit_Cost' : 1.0
342
- },
316
+ 'Item_Code' : 2678 },
343
317
)
344
318
345
319
cons = add_record (
@@ -349,9 +323,7 @@ def add_record(df: pd.DataFrame, record: Dict):
349
323
'Intervention_Pkg' : "Misc" ,
350
324
'Intervention_Pkg_Code' : - 99 ,
351
325
'Items' : "Cystoscope" ,
352
- 'Item_Code' : 285 ,
353
- 'Expected_Units_Per_Case' : 1.0 ,
354
- 'Unit_Cost' : np .nan },
326
+ 'Item_Code' : 285 },
355
327
)
356
328
357
329
cons = add_record (
@@ -360,9 +332,7 @@ def add_record(df: pd.DataFrame, record: Dict):
360
332
'Intervention_Pkg' : "Misc" ,
361
333
'Intervention_Pkg_Code' : - 99 ,
362
334
'Items' : "Endoscope" ,
363
- 'Item_Code' : 280 ,
364
- 'Expected_Units_Per_Case' : 1.0 ,
365
- 'Unit_Cost' : np .nan },
335
+ 'Item_Code' : 280 },
366
336
)
367
337
368
338
cons = add_record (
@@ -371,9 +341,7 @@ def add_record(df: pd.DataFrame, record: Dict):
371
341
'Intervention_Pkg' : "Misc" ,
372
342
'Intervention_Pkg_Code' : - 99 ,
373
343
'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 },
377
345
)
378
346
379
347
0 commit comments