refactoring
This commit is contained in:
@@ -81,45 +81,6 @@
|
||||
"## Download VAERS-Data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8f0bfb9c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import time\n",
|
||||
"\n",
|
||||
"class AndroidEmulator:\n",
|
||||
" \n",
|
||||
" @staticmethod\n",
|
||||
" def run(runnable):\n",
|
||||
" AndroidEmulator._start()\n",
|
||||
" result = runnable()\n",
|
||||
" AndroidEmulator._stop()\n",
|
||||
" return result\n",
|
||||
" \n",
|
||||
" @staticmethod\n",
|
||||
" def _start():\n",
|
||||
" os.system(\"/home/frankknoll/Android/Sdk/emulator/emulator -avd Pixel_2_API_30 -no-window &\")\n",
|
||||
" AndroidEmulator._waitUntilStarted()\n",
|
||||
" \n",
|
||||
" @staticmethod\n",
|
||||
" def _waitUntilStarted():\n",
|
||||
" while not AndroidEmulator._isStarted():\n",
|
||||
" time.sleep(1)\n",
|
||||
"\n",
|
||||
" @staticmethod\n",
|
||||
" def _isStarted():\n",
|
||||
" boot_completed = ! adb shell getprop sys.boot_completed\n",
|
||||
" return boot_completed[0] == '1'\n",
|
||||
"\n",
|
||||
" @staticmethod\n",
|
||||
" def _stop():\n",
|
||||
" ! adb emu kill"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -149,36 +110,6 @@
|
||||
" downloadVAERSFileAndUnzip('NonDomesticVAERSData.zip')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a271254b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from VaersDescrReader import VaersDescrReader\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "7b5d6df0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from VaersDescr2DataFrameConverter import VaersDescr2DataFrameConverter"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6b639196",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from DataFrameNormalizer import DataFrameNormalizer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -189,26 +120,6 @@
|
||||
"from DataFrameFilter import DataFrameFilter"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c40bd0f0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from CountryColumnAdder import CountryColumnAdder"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "3abe3384",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from SevereColumnAdder import SevereColumnAdder"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -293,29 +204,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def getVaersForYears(years):\n",
|
||||
" def addCountryColumn(dataFrame):\n",
|
||||
" dataFrame['COUNTRY'] = 'United States'\n",
|
||||
" return dataFrame\n",
|
||||
"\n",
|
||||
" return _getVaers(\n",
|
||||
" _getVaersDescrReader().readVaersDescrsForYears(years),\n",
|
||||
" addCountryColumn)\n",
|
||||
"\n",
|
||||
"def getNonDomesticVaers():\n",
|
||||
" return _getVaers(\n",
|
||||
" [_getVaersDescrReader().readNonDomesticVaersDescr()],\n",
|
||||
" CountryColumnAdder.addCountryColumn)\n",
|
||||
"\n",
|
||||
"def _getVaersDescrReader():\n",
|
||||
" return VaersDescrReader(dataDir = \"VAERS\")\n",
|
||||
"\n",
|
||||
"def _getVaers(vaersDescrs, addCountryColumn):\n",
|
||||
" dataFrame = VaersDescr2DataFrameConverter.createDataFrameFromDescrs(vaersDescrs)\n",
|
||||
" dataFrame = addCountryColumn(dataFrame)\n",
|
||||
" DataFrameNormalizer.normalize(dataFrame)\n",
|
||||
" dataFrame = SevereColumnAdder.addSevereColumn(dataFrame)\n",
|
||||
" return dataFrame"
|
||||
"from VaersReader import getVaersForYears, getNonDomesticVaers"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user