diff --git a/src/HowBadIsMyBatch.ipynb b/src/HowBadIsMyBatch.ipynb index 399d9b1dc84..ac8d62b672d 100644 --- a/src/HowBadIsMyBatch.ipynb +++ b/src/HowBadIsMyBatch.ipynb @@ -627,6 +627,38 @@ "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", "execution_count": null, @@ -642,19 +674,6 @@ "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", "execution_count": null, @@ -662,7 +681,7 @@ "metadata": {}, "outputs": [], "source": [ - "drugDescrByPathology = drugs4Pathologies.groupby('PATHOLOGY').apply(drugsTable2drugDescr)\n", + "drugDescrByPathology = getDrugDescrByPathology(drugs4Pathologies)\n", "drugDescrByPathology" ] }, @@ -686,22 +705,6 @@ "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", "execution_count": null, @@ -713,14 +716,6 @@ " drugDescrByPathology = drugDescrByPathology[:2],\n", " webAppBaseDir = os.path.normpath(os.getcwd() + '/../docs/DrugsForPathologies'))" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a2398b3a", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {