refactoring
This commit is contained in:
@@ -158,13 +158,11 @@
|
||||
"class SummationTableFactory:\n",
|
||||
"\n",
|
||||
" @staticmethod\n",
|
||||
" def createSummationTableHavingSevereReportsColumn(dataFrame):\n",
|
||||
" def createSummationTable(dataFrame):\n",
|
||||
" summationTable = dataFrame.agg({\n",
|
||||
" 'DIED': ['sum', 'size'],\n",
|
||||
" 'L_THREAT': 'sum',\n",
|
||||
" 'DISABLE': 'sum',\n",
|
||||
" 'HOSPITAL': 'sum',\n",
|
||||
" 'ER_VISIT': 'sum',\n",
|
||||
" 'SEVERE': 'sum'\n",
|
||||
" })\n",
|
||||
" SummationTableFactory._flattenColumns(summationTable)\n",
|
||||
@@ -177,7 +175,7 @@
|
||||
" })\n",
|
||||
" summationTable['Severe reports'] = summationTable['Severities'] / summationTable['Adverse Reaction Reports'] * 100\n",
|
||||
" summationTable['Lethality'] = summationTable['Deaths'] / summationTable['Adverse Reaction Reports'] * 100\n",
|
||||
" summationTable = summationTable[\n",
|
||||
" return summationTable[\n",
|
||||
" [\n",
|
||||
" 'Adverse Reaction Reports',\n",
|
||||
" 'Deaths',\n",
|
||||
@@ -186,7 +184,6 @@
|
||||
" 'Severe reports',\n",
|
||||
" 'Lethality'\n",
|
||||
" ]]\n",
|
||||
" return summationTable\n",
|
||||
"\n",
|
||||
" @staticmethod\n",
|
||||
" def _flattenColumns(dataFrame):\n",
|
||||
@@ -309,7 +306,7 @@
|
||||
" # FK-TODO: refactor\n",
|
||||
" def _createBatchCodeTableByCountry(self, country):\n",
|
||||
" if country is None:\n",
|
||||
" return SummationTableFactory.createSummationTableHavingSevereReportsColumn(self.dataFrame.groupby('VAX_LOT'))\n",
|
||||
" return SummationTableFactory.createSummationTable(self.dataFrame.groupby('VAX_LOT'))\n",
|
||||
"\n",
|
||||
" if self.countryBatchCodeTable is None:\n",
|
||||
" self.countryBatchCodeTable = self._getCountryBatchCodeTable()\n",
|
||||
@@ -317,7 +314,7 @@
|
||||
" return self._getCountry(self.countryBatchCodeTable, country)\n",
|
||||
"\n",
|
||||
" def _getCountryBatchCodeTable(self):\n",
|
||||
" return SummationTableFactory.createSummationTableHavingSevereReportsColumn(\n",
|
||||
" return SummationTableFactory.createSummationTable(\n",
|
||||
" self.dataFrame.groupby(\n",
|
||||
" [\n",
|
||||
" self.dataFrame['COUNTRY'],\n",
|
||||
|
||||
Reference in New Issue
Block a user