starting VaccineDistributionByZipcode

This commit is contained in:
frankknoll
2023-03-08 21:41:56 +01:00
parent f5a260b0d2
commit c1c5df5d8d
6 changed files with 240 additions and 11 deletions

View File

@@ -42,9 +42,9 @@ def _createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, count
'Severe reports',
'Lethality'
]]
IOUtils.saveDataFrame(
IOUtils.saveDataFrameAsJson(
batchCodeTable,
'../docs/data/batchCodeTables/' + country)
'../docs/data/batchCodeTables/' + country + '.json')
onCountryProcessed(country)

View File

@@ -3,22 +3,16 @@ import json
class IOUtils:
@staticmethod
def saveDataFrame(dataFrame, file):
# IOUtils.saveDataFrameAsExcelFile(dataFrame, file)
# IOUtils.saveDataFrameAsHtml(dataFrame, file)
IOUtils.saveDataFrameAsJson(dataFrame, file)
@staticmethod
def saveDataFrameAsExcelFile(dataFrame, file):
IOUtils.ensurePath(file)
dataFrame.to_excel(file + '.xlsx')
dataFrame.to_excel(file)
@staticmethod
def saveDataFrameAsHtml(dataFrame, file):
IOUtils.ensurePath(file)
dataFrame.to_html(
file + '.html',
file,
index = False,
table_id = 'batchCodeTable',
classes = 'display',
@@ -29,7 +23,7 @@ class IOUtils:
def saveDataFrameAsJson(dataFrame, file):
IOUtils.ensurePath(file)
dataFrame.to_json(
file + '.json',
file,
orient = "split",
index = False)

View File

@@ -0,0 +1,103 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"vaccineDistributionByZipcode = pd.read_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_edited.xlsx')\n",
"vaccineDistributionByZipcode"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"len(vaccineDistributionByZipcode['PROVIDER_NAME'].unique())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"len(vaccineDistributionByZipcode['ZIPCODE_SHP'].unique())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode['AWARDEE'].unique()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode['STATE_SHP'].unique()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode[vaccineDistributionByZipcode['ZIPCODE_SHP'] == '37801']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IOUtils import IOUtils\n",
"\n",
"IOUtils.saveDataFrameAsJson(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"IOUtils.saveDataFrameAsHtml(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.html')"
]
}
],
"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
}