refactoring

This commit is contained in:
Frank Knoll
2024-07-27 18:38:27 +02:00
parent 854878a592
commit 4a837ed175

View File

@@ -627,6 +627,38 @@
"from DrugsForPathologies.HtmlUpdater import updateHtmlFile as updateDrugsForPathologiesHtmlFile\n" "from DrugsForPathologies.HtmlUpdater import updateHtmlFile as updateDrugsForPathologiesHtmlFile\n"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "3f60c4f1",
"metadata": {},
"outputs": [],
"source": [
"def getDrugDescrByPathology(drugs4Pathologies):\n",
" def drugsTable2drugDescr(drugsTable):\n",
" drugDescr = drugsTable.to_dict('list')\n",
" del drugDescr['PATHOLOGY']\n",
" return drugDescr\n",
" \n",
" return drugs4Pathologies.groupby('PATHOLOGY').apply(drugsTable2drugDescr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a092ecf7",
"metadata": {},
"outputs": [],
"source": [
"def saveDrugDescriptionsForPathologiesAndUpdateHtmlFile(drugDescrByPathology, webAppBaseDir):\n",
" filenameByPathology = saveDrugDescriptionsForPathologies(\n",
" drugDescrByPathology = drugDescrByPathology,\n",
" directory = os.path.normpath(webAppBaseDir + '/data/DrugDescriptionsForPathologies'))\n",
" updateDrugsForPathologiesHtmlFile(\n",
" filenameByPathology,\n",
" htmlFile = os.path.normpath(webAppBaseDir + '/index.html'))\n"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -642,19 +674,6 @@
"drugs4Pathologies" "drugs4Pathologies"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "492230af",
"metadata": {},
"outputs": [],
"source": [
"def drugsTable2drugDescr(drugsTable):\n",
" drugDescr = drugsTable.to_dict('list')\n",
" del drugDescr['PATHOLOGY']\n",
" return drugDescr"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -662,7 +681,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"drugDescrByPathology = drugs4Pathologies.groupby('PATHOLOGY').apply(drugsTable2drugDescr)\n", "drugDescrByPathology = getDrugDescrByPathology(drugs4Pathologies)\n",
"drugDescrByPathology" "drugDescrByPathology"
] ]
}, },
@@ -686,22 +705,6 @@
"drugs4Pathologies[drugs4Pathologies['PATHOLOGY'] == 'bone cancer']" "drugs4Pathologies[drugs4Pathologies['PATHOLOGY'] == 'bone cancer']"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "5535345f",
"metadata": {},
"outputs": [],
"source": [
"def saveDrugDescriptionsForPathologiesAndUpdateHtmlFile(drugDescrByPathology, webAppBaseDir):\n",
" filenameByPathology = saveDrugDescriptionsForPathologies(\n",
" drugDescrByPathology = drugDescrByPathology,\n",
" directory = os.path.normpath(webAppBaseDir + '/data/DrugDescriptionsForPathologies'))\n",
" updateDrugsForPathologiesHtmlFile(\n",
" filenameByPathology,\n",
" htmlFile = os.path.normpath(webAppBaseDir + '/index.html'))\n"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -713,14 +716,6 @@
" drugDescrByPathology = drugDescrByPathology[:2],\n", " drugDescrByPathology = drugDescrByPathology[:2],\n",
" webAppBaseDir = os.path.normpath(os.getcwd() + '/../docs/DrugsForPathologies'))" " webAppBaseDir = os.path.normpath(os.getcwd() + '/../docs/DrugsForPathologies'))"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a2398b3a",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {