adding ADR column to vaccineDistributionByZipcode table
This commit is contained in:
15
src/ADRColumnAdder.py
Normal file
15
src/ADRColumnAdder.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pandas as pd
|
||||
|
||||
class ADRColumnAdder:
|
||||
|
||||
def __init__(self, ADR_by_Batchcode):
|
||||
self.ADR_by_Batchcode = ADR_by_Batchcode
|
||||
|
||||
def addADRColumn(self, vaccineDistributionByZipcode):
|
||||
return pd.merge(
|
||||
vaccineDistributionByZipcode,
|
||||
self.ADR_by_Batchcode,
|
||||
how = 'left',
|
||||
left_on = 'LOT_NUMBER',
|
||||
right_index = True,
|
||||
validate = 'many_to_one')
|
||||
5
src/ADR_by_Batchcode_Table_Factory.py
Normal file
5
src/ADR_by_Batchcode_Table_Factory.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from BatchCodeTableFactory import BatchCodeTableFactory
|
||||
|
||||
def create_ADR_by_Batchcode_Table_4USA(internationalVaersCovid19):
|
||||
batchCodeTable4USA = BatchCodeTableFactory(internationalVaersCovid19).createBatchCodeTableByCountry('United States')
|
||||
return batchCodeTable4USA[['Adverse Reaction Reports']]
|
||||
@@ -163,6 +163,89 @@
|
||||
" minADRsForLethality = 100,\n",
|
||||
" onCountryProcessed = display)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "2d93b511",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Vaccine Distribution by Zipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "cfcbad44",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vaccineDistributionByZipcode = pd.read_excel(\n",
|
||||
" io = 'tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823.xlsx',\n",
|
||||
" usecols = ['PROVIDER_NAME', 'ZIPCODE_SHP', 'LOT_NUMBER', 'DOSES_SHIPPED'])\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "59c745d2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from VaccineDistributionByZipcodeSimplifier import VaccineDistributionByZipcodeSimplifier\n",
|
||||
"\n",
|
||||
"vaccineDistributionByZipcode = VaccineDistributionByZipcodeSimplifier.sumDoses(vaccineDistributionByZipcode)\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f77505c6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from ADR_by_Batchcode_Table_Factory import create_ADR_by_Batchcode_Table_4USA\n",
|
||||
"\n",
|
||||
"ADR_by_Batchcode_Table_4USA = create_ADR_by_Batchcode_Table_4USA(internationalVaersCovid19)\n",
|
||||
"ADR_by_Batchcode_Table_4USA"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "99120c77",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from ADRColumnAdder import ADRColumnAdder\n",
|
||||
"\n",
|
||||
"vaccineDistributionByZipcode = ADRColumnAdder(ADR_by_Batchcode_Table_4USA).addADRColumn(vaccineDistributionByZipcode)\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f68c72d0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vaccineDistributionByZipcode.to_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_sumDoses.xlsx')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9b8f0b6e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from IOUtils import IOUtils\n",
|
||||
"\n",
|
||||
"IOUtils.saveDataFrameAsJson(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"vaccineDistributionByZipcode = pd.read_excel(\n",
|
||||
" io = 'tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823.xlsx',\n",
|
||||
" usecols = ['PROVIDER_NAME', 'ZIPCODE_SHP', 'LOT_NUMBER', 'DOSES_SHIPPED'])\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from VaccineDistributionByZipcodeSimplifier import VaccineDistributionByZipcodeSimplifier\n",
|
||||
"\n",
|
||||
"vaccineDistributionByZipcode = VaccineDistributionByZipcodeSimplifier.sumDoses(vaccineDistributionByZipcode)\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vaccineDistributionByZipcode.to_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_sumDoses.xlsx')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from IOUtils import IOUtils\n",
|
||||
"\n",
|
||||
"IOUtils.saveDataFrameAsJson(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "howbadismybatch-venv-kernel",
|
||||
"language": "python",
|
||||
"name": "howbadismybatch-venv-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.8"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user