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