refactoring
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
import shutil
|
||||||
|
from IOUtils import IOUtils
|
||||||
|
|
||||||
|
def saveDrugDescriptionsForPathologies(drugDescrByPathology, directory):
|
||||||
|
shutil.rmtree(directory, ignore_errors = True)
|
||||||
|
filenameByPathology = {}
|
||||||
|
i = 0
|
||||||
|
for pathology, drugDescr in drugDescrByPathology.items():
|
||||||
|
i += 1
|
||||||
|
filenameByPathology[pathology] = f'{i}'
|
||||||
|
drugDescr['PATHOLOGY'] = pathology
|
||||||
|
IOUtils.saveDictAsJson(drugDescr, f'{directory}/{i}.json')
|
||||||
|
return filenameByPathology
|
||||||
@@ -623,6 +623,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import pandas as pd\n",
|
"import pandas as pd\n",
|
||||||
"import os\n",
|
"import os\n",
|
||||||
|
"from DrugsForPathologies.DrugDescriptionsForPathologiesPersister import saveDrugDescriptionsForPathologies\n",
|
||||||
"from DrugsForPathologies.HtmlUpdater import updateHtmlFile as updateDrugsForPathologiesHtmlFile\n"
|
"from DrugsForPathologies.HtmlUpdater import updateHtmlFile as updateDrugsForPathologiesHtmlFile\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -685,28 +686,6 @@
|
|||||||
"drugs4Pathologies[drugs4Pathologies['PATHOLOGY'] == 'bone cancer']"
|
"drugs4Pathologies[drugs4Pathologies['PATHOLOGY'] == 'bone cancer']"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "4444d234",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import shutil\n",
|
|
||||||
"from IOUtils import IOUtils\n",
|
|
||||||
"\n",
|
|
||||||
"def saveDrugDescriptionsForPathologies(drugDescrByPathology, directory):\n",
|
|
||||||
" shutil.rmtree(directory, ignore_errors = True)\n",
|
|
||||||
" filenameByPathology = {}\n",
|
|
||||||
" i = 0\n",
|
|
||||||
" for pathology, drugDescr in drugDescrByPathology.items():\n",
|
|
||||||
" i += 1\n",
|
|
||||||
" filenameByPathology[pathology] = f'{i}'\n",
|
|
||||||
" drugDescr['PATHOLOGY'] = pathology\n",
|
|
||||||
" IOUtils.saveDictAsJson(drugDescr, f'{directory}/{i}.json')\n",
|
|
||||||
" return filenameByPathology \n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
|||||||
Reference in New Issue
Block a user