@ -1,2 +1,4 @@ | |||
covid-19* | |||
.vscode | |||
.vscode | |||
test.py | |||
output | |||
creds.py |
@ -0,0 +1,46 @@ | |||
import flask | |||
from flask import request, jsonify | |||
import psycopg2 | |||
import json | |||
app = flask.Flask(__name__) | |||
app.config["DEBUG"] = True | |||
import creds | |||
# Assign secrets to variables, should look into making this | |||
# a function. Plan to move this to Vault from creds file. | |||
dbhost = creds.dblogin['host'] | |||
database = creds.dblogin['db'] | |||
username = creds.dblogin['username'] | |||
password = creds.dblogin['password'] | |||
port = creds.dblogin['port'] | |||
@app.route('/', methods=['GET']) | |||
def home(): | |||
# TODO: Look into putting all this into a template or something. | |||
return """<h1>Public API offered by the team at Seattle Matrix</h1> <p>This \ | |||
site is a collection of api's from various public sources collected \ | |||
by the team at <a href="https://seattlematrix.org" target="_blank">SeattleMatrix.org</a>.</p> Current Data: \ | |||
</br><a href="https://api.seattlematrix.org/v1/kingcounty/covid-19/zipcode/all" target="_blank">King County, WA Covid-19 By ZipCode</a> - Current Dates: 20200810, 20200824, 20200831 | |||
""" | |||
# A route to return all of the available records for King County COVID-19 | |||
@app.route('/v1/kingcounty/covid-19/zipcode/all', methods=['GET']) | |||
def api_zipcode_all(): | |||
""" This route returns all the data in the king_county_covid19_zip | |||
table. This data is currently manually updated. | |||
""" | |||
conn = psycopg2.connect(f"host={dbhost} dbname={database} user={username} password={password} port={port} sslmode='require'") | |||
cur = conn.cursor() | |||
cur.execute("select row_to_json(king_county_covid19_zip) from king_county_covid19_zip;") | |||
rows = cur.fetchall() | |||
# FIXME: returning row throws an error and jsonify returns double nested | |||
# json result need to figure this out. | |||
return jsonify(rows) | |||
if __name__ == "__main__": | |||
app.run(host='0.0.0.0') | |||
# TODO: Create route for filtering on zipcode and date | |||
# TODO: Put all above into function for covid-19 data | |||
# TODO: Look into making a Class for db connection |
@ -1,19 +0,0 @@ | |||
import psycopg2 | |||
conn = psycopg2.connect("host='localhost' dbname='king_county_wa' user='postgres' password='postgres'" ) | |||
cur = conn.cursor() | |||
cur.execute(""" | |||
CREATE TABLE covid19_zip( | |||
zipcode varchar(5), | |||
population int4, | |||
tests int4, | |||
test_Rate varchar(10), | |||
positives int4, | |||
positive_rate varchar(10), | |||
hospitalizations int4, | |||
hospitalization_rate varchar(10), | |||
deaths int4, | |||
death_rate varchar(10) | |||
) | |||
""") | |||
conn.commit() |
@ -0,0 +1,12 @@ | |||
""" save this file as creds.py and update with your | |||
db information. I will be updating app to use Vault | |||
for secrets soon. | |||
""" | |||
dblogin = { | |||
'host' : 'localhost', | |||
'port' : '5432', | |||
'username' : 'username', | |||
'password' : 'password', | |||
'db' : 'db' | |||
} |
@ -0,0 +1,30 @@ | |||
import psycopg2 | |||
import creds | |||
# assign secrets to variables | |||
dbhost = creds.dblogin['host'] | |||
database = creds.dblogin['db'] | |||
username = creds.dblogin['username'] | |||
password = creds.dblogin['password'] | |||
port = creds.dblogin['port'] | |||
conn = psycopg2.connect(f"host={dbhost} dbname={database} user={username} password={password} port={port} sslmode='require'") | |||
cur = conn.cursor() | |||
cur.execute(""" | |||
CREATE TABLE king_county_covid19_zip( | |||
id SERIAL PRIMARY KEY, | |||
date_added DATE NOT NULL DEFAULT CURRENT_DATE, | |||
date_data DATE, | |||
zipcode TEXT, | |||
population INTEGER, | |||
tests INTEGER, | |||
test_rate TEXT, | |||
positives INTEGER, | |||
positive_rate TEXT, | |||
hospitalizations INTEGER, | |||
hospitalization_rate TEXT, | |||
deaths INTEGER, | |||
death_rate TEXT) | |||
""") | |||
conn.commit() |
@ -0,0 +1,33 @@ | |||
import psycopg2 | |||
import csv | |||
from datetime import datetime | |||
import creds | |||
# assign secrets to variables | |||
dbhost = creds.dblogin['host'] | |||
database = creds.dblogin['db'] | |||
username = creds.dblogin['username'] | |||
password = creds.dblogin['password'] | |||
port = creds.dblogin['port'] | |||
conn = psycopg2.connect(f"host={dbhost} dbname={database} user={username} password={password} port={port} sslmode='require'") | |||
cur = conn.cursor() | |||
# take the source data csv and upload to the database. | |||
# using date variable to choose file | |||
data_date = "20200831" | |||
source_file = "./source_data/covid-19_" +data_date+"_zip.csv" | |||
with open(source_file, 'r') as f: | |||
reader = csv.reader(f) | |||
next(reader) # Skip the header row. | |||
for row in reader: | |||
cur.execute( | |||
"INSERT INTO king_county_covid19_zip(date_data, zipcode, population, tests, test_rate, \ | |||
positives, positive_rate, hospitalizations, hospitalization_rate, deaths, death_rate) \ | |||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", | |||
(data_date,row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]) | |||
) | |||
conn.commit() |
@ -0,0 +1,85 @@ | |||
Location_Name,Population,Tests,Test_Rate,Positives,Positive_Rate,Hospitalizations,Hospitalization_Rate,Deaths,Death_Rate | |||
00000,2226300,337664, 15167.05,16749, 752.32,2043, 91.77,676, 30.36 | |||
98001,35948,4161, 115.75,373, 10.38,39, 1.08,7, 0.19 | |||
98002,35106,4772, 135.93,566, 16.12,61, 1.74,11, 0.31 | |||
98003,49587,6762, 136.37,805, 16.23,79, 1.59,15, 0.30 | |||
98004,34755,5310, 152.78,211, 6.07,32, 0.92,11, 0.32 | |||
98005,20154,2292, 113.72,103, 5.11,15, 0.74,0, 0.00 | |||
98006,38904,4420, 113.61,129, 3.32,14, 0.36,4, 0.10 | |||
98007,28612,2473, 86.43,155, 5.42,26, 0.91,10, 0.35 | |||
98008,26113,2883, 110.40,195, 7.47,33, 1.26,17, 0.65 | |||
98010,5549,579, 104.34,29, 5.23,1, 0.18,1, 0.18 | |||
98011,34504,3401, 98.57,144, 4.17,25, 0.72,11, 0.32 | |||
98014,7630,759, 99.48,13, 1.70,3, 0.39,0, 0.00 | |||
98019,12209,1160, 95.01,33, 2.70,0, 0.00,0, 0.00 | |||
98022,22792,2278, 99.95,134, 5.88,31, 1.36,25, 1.10 | |||
98023,50842,5855, 115.16,494, 9.72,45, 0.89,6, 0.12 | |||
98024,6000,638, 106.33,14, 2.33,1, 0.17,0, 0.00 | |||
98027,30108,4035, 134.02,192, 6.38,43, 1.43,25, 0.83 | |||
98028,23193,3082, 132.88,132, 5.69,27, 1.16,9, 0.39 | |||
98029,29254,3716, 127.03,100, 3.42,11, 0.38,11, 0.38 | |||
98030,36849,4558, 123.69,550, 14.93,63, 1.71,24, 0.65 | |||
98031,39076,5230, 133.84,484, 12.39,52, 1.33,16, 0.41 | |||
98032,36699,5155, 140.47,532, 14.50,40, 1.09,9, 0.25 | |||
98033,38814,5408, 139.33,201, 5.18,24, 0.62,7, 0.18 | |||
98034,44252,5859, 132.40,387, 8.75,102, 2.30,55, 1.24 | |||
98038,35227,3769, 106.99,151, 4.29,11, 0.31,4, 0.11 | |||
98039,3247,539, 166.00,28, 8.62,2, 0.62,0, 0.00 | |||
98040,24470,4735, 193.50,156, 6.38,15, 0.61,5, 0.20 | |||
98042,48838,5162, 105.70,365, 7.47,35, 0.72,5, 0.10 | |||
98045,15333,2082, 135.79,45, 2.93,2, 0.13,1, 0.07 | |||
98047,6704,718, 107.10,88, 13.13,13, 1.94,2, 0.30 | |||
98051,3735,437, 117.00,21, 5.62,2, 0.54,1, 0.27 | |||
98052,69882,7333, 104.93,316, 4.52,72, 1.03,49, 0.70 | |||
98053,22484,2058, 91.53,57, 2.54,11, 0.49,6, 0.27 | |||
98055,24945,3040, 121.87,198, 7.94,32, 1.28,15, 0.60 | |||
98056,36346,4413, 121.42,290, 7.98,33, 0.91,5, 0.14 | |||
98057,13268,2303, 173.58,176, 13.26,18, 1.36,9, 0.68 | |||
98058,44805,5352, 119.45,316, 7.05,43, 0.96,13, 0.29 | |||
98059,39897,4387, 109.96,206, 5.16,26, 0.65,5, 0.13 | |||
98065,15789,1926, 121.98,70, 4.43,2, 0.13,0, 0.00 | |||
98070,10788,1480, 137.19,12, 1.11,1, 0.09,0, 0.00 | |||
98072,24584,2602, 105.84,102, 4.15,17, 0.69,4, 0.16 | |||
98074,28881,2886, 99.93,69, 2.39,3, 0.10,4, 0.14 | |||
98075,24330,2660, 109.33,111, 4.56,7, 0.29,1, 0.04 | |||
98077,14416,1396, 96.84,37, 2.57,4, 0.28,2, 0.14 | |||
98092,47868,4421, 92.36,407, 8.50,52, 1.09,7, 0.15 | |||
98101,16247,3652, 224.78,126, 7.76,20, 1.23,11, 0.68 | |||
98102,26690,6409, 240.13,121, 4.53,8, 0.30,1, 0.04 | |||
98103,53528,12164, 227.25,223, 4.17,27, 0.50,14, 0.26 | |||
98104,18339,4260, 232.29,213, 11.61,35, 1.91,9, 0.49 | |||
98105,54923,9215, 167.78,299, 5.44,12, 0.22,1, 0.02 | |||
98106,25898,4458, 172.14,273, 10.54,37, 1.43,3, 0.12 | |||
98107,29219,6263, 214.35,107, 3.66,8, 0.27,3, 0.10 | |||
98108,25264,4365, 172.78,272, 10.77,22, 0.87,7, 0.28 | |||
98109,34939,6142, 175.79,206, 5.90,38, 1.09,19, 0.54 | |||
98112,24026,6163, 256.51,104, 4.33,12, 0.50,2, 0.08 | |||
98115,53109,10897, 205.18,226, 4.26,23, 0.43,8, 0.15 | |||
98116,26979,5259, 194.93,121, 4.48,5, 0.19,2, 0.07 | |||
98117,34314,7602, 221.54,156, 4.55,25, 0.73,7, 0.20 | |||
98118,49108,9111, 185.53,541, 11.02,61, 1.24,11, 0.22 | |||
98119,26126,4711, 180.32,74, 2.83,5, 0.19,0, 0.00 | |||
98121,22274,3182, 142.86,64, 2.87,4, 0.18,2, 0.09 | |||
98122,44306,9896, 223.36,218, 4.92,15, 0.34,5, 0.11 | |||
98125,43312,7493, 173.00,257, 5.93,32, 0.74,8, 0.18 | |||
98126,24341,4639, 190.58,151, 6.20,29, 1.19,14, 0.58 | |||
98133,49594,8508, 171.55,412, 8.31,61, 1.23,30, 0.60 | |||
98134,675,363, 537.78,16, 23.70,3, 4.44,0, 0.00 | |||
98136,16216,3317, 204.55,67, 4.13,5, 0.31,2, 0.12 | |||
98144,32523,7663, 235.62,338, 10.39,53, 1.63,19, 0.58 | |||
98146,29292,4231, 144.44,322, 10.99,35, 1.19,9, 0.31 | |||
98148,10823,1381, 127.60,118, 10.90,18, 1.66,3, 0.28 | |||
98155,34534,5910, 171.14,268, 7.76,46, 1.33,25, 0.72 | |||
98164,157,3303, 21038.22,5, 31.85,0, 0.00,0, 0.00 | |||
98166,21840,3197, 146.38,175, 8.01,26, 1.19,4, 0.18 | |||
98168,36076,5271, 146.11,591, 16.38,45, 1.25,9, 0.25 | |||
98177,20330,3730, 183.47,140, 6.89,29, 1.43,21, 1.03 | |||
98178,26649,4040, 151.60,260, 9.76,27, 1.01,6, 0.23 | |||
98188,25097,4057, 161.65,366, 14.58,38, 1.51,6, 0.24 | |||
98195,0,32, .,2, .,0, .,0, . | |||
98198,36960,5063, 136.99,485, 13.12,44, 1.19,6, 0.16 | |||
98199,21488,3852, 179.26,57, 2.65,4, 0.19,1, 0.05 | |||
98224,310,14, 45.16,1, 3.23,0, 0.00,0, 0.00 | |||
98288,374,39, 104.28,0, 0.00,0, 0.00,0, 0.00 | |||
98354,7419,60, 8.09,6, 0.81,1, 0.13,1, 0.13 | |||
98422,21107,4, 0.19,3, 0.14,1, 0.05,0, 0.00 |
@ -0,0 +1,85 @@ | |||
Location_Name,Population,Tests,Test_Rate,Positives,Positive_Rate,Hospitalizations,Hospitalization_Rate,Deaths,Death_Rate | |||
00000,2226300,343578, 15432.69,18824, 845.53,2182, 98.01,711, 31.94 | |||
98001,35948,5107, 142.07,435, 12.10,43, 1.20,7, 0.19 | |||
98002,35106,6236, 177.63,649, 18.49,71, 2.02,13, 0.37 | |||
98003,49587,8287, 167.12,971, 19.58,91, 1.84,19, 0.38 | |||
98004,34755,6552, 188.52,232, 6.68,32, 0.92,11, 0.32 | |||
98005,20154,2810, 139.43,121, 6.00,16, 0.79,0, 0.00 | |||
98006,38904,5409, 139.03,148, 3.80,14, 0.36,4, 0.10 | |||
98007,28612,3027, 105.79,175, 6.12,27, 0.94,11, 0.38 | |||
98008,26113,3517, 134.68,220, 8.42,39, 1.49,16, 0.61 | |||
98010,5549,729, 131.38,31, 5.59,1, 0.18,1, 0.18 | |||
98011,34504,4135, 119.84,161, 4.67,27, 0.78,12, 0.35 | |||
98014,7630,976, 127.92,21, 2.75,3, 0.39,0, 0.00 | |||
98019,12209,1449, 118.68,37, 3.03,0, 0.00,1, 0.08 | |||
98022,22792,2778, 121.88,145, 6.36,32, 1.40,25, 1.10 | |||
98023,50842,7271, 143.01,570, 11.21,52, 1.02,8, 0.16 | |||
98024,6000,803, 133.83,20, 3.33,1, 0.17,0, 0.00 | |||
98027,30108,4958, 164.67,221, 7.34,45, 1.49,25, 0.83 | |||
98028,23193,3735, 161.04,143, 6.17,28, 1.21,9, 0.39 | |||
98029,29254,4538, 155.12,107, 3.66,12, 0.41,12, 0.41 | |||
98030,36849,5599, 151.94,648, 17.59,65, 1.76,23, 0.62 | |||
98031,39076,6335, 162.12,560, 14.33,57, 1.46,16, 0.41 | |||
98032,36699,6304, 171.78,639, 17.41,45, 1.23,11, 0.30 | |||
98033,38814,6632, 170.87,218, 5.62,23, 0.59,7, 0.18 | |||
98034,44252,7018, 158.59,408, 9.22,102, 2.30,56, 1.27 | |||
98038,35227,4774, 135.52,163, 4.63,12, 0.34,4, 0.11 | |||
98039,3247,730, 224.82,31, 9.55,2, 0.62,0, 0.00 | |||
98040,24470,5861, 239.52,163, 6.66,16, 0.65,5, 0.20 | |||
98042,48838,6422, 131.50,420, 8.60,38, 0.78,5, 0.10 | |||
98045,15333,2595, 169.24,55, 3.59,2, 0.13,1, 0.07 | |||
98047,6704,851, 126.94,105, 15.66,13, 1.94,2, 0.30 | |||
98051,3735,517, 138.42,25, 6.69,2, 0.54,1, 0.27 | |||
98052,69882,8974, 128.42,345, 4.94,72, 1.03,49, 0.70 | |||
98053,22484,2504, 111.37,63, 2.80,12, 0.53,6, 0.27 | |||
98055,24945,3684, 147.68,213, 8.54,32, 1.28,15, 0.60 | |||
98056,36346,5378, 147.97,334, 9.19,36, 0.99,7, 0.19 | |||
98057,13268,2855, 215.18,199, 15.00,21, 1.58,9, 0.68 | |||
98058,44805,6486, 144.76,363, 8.10,44, 0.98,13, 0.29 | |||
98059,39897,5409, 135.57,232, 5.81,27, 0.68,5, 0.13 | |||
98065,15789,2466, 156.18,81, 5.13,2, 0.13,0, 0.00 | |||
98070,10788,1794, 166.30,14, 1.30,1, 0.09,0, 0.00 | |||
98072,24584,3115, 126.71,116, 4.72,18, 0.73,4, 0.16 | |||
98074,28881,3568, 123.54,75, 2.60,3, 0.10,4, 0.14 | |||
98075,24330,3366, 138.35,126, 5.18,8, 0.33,4, 0.16 | |||
98077,14416,1719, 119.24,45, 3.12,4, 0.28,2, 0.14 | |||
98092,47868,5553, 116.01,466, 9.74,59, 1.23,9, 0.19 | |||
98101,16247,4793, 295.01,141, 8.68,21, 1.29,9, 0.55 | |||
98102,26690,8073, 302.47,133, 4.98,8, 0.30,1, 0.04 | |||
98103,53528,15186, 283.70,247, 4.61,27, 0.50,16, 0.30 | |||
98104,18339,5144, 280.50,253, 13.80,43, 2.34,11, 0.60 | |||
98105,54923,11452, 208.51,316, 5.75,12, 0.22,1, 0.02 | |||
98106,25898,5464, 210.98,294, 11.35,35, 1.35,4, 0.15 | |||
98107,29219,7717, 264.11,111, 3.80,8, 0.27,4, 0.14 | |||
98108,25264,5518, 218.41,301, 11.91,27, 1.07,7, 0.28 | |||
98109,34939,7818, 223.76,226, 6.47,39, 1.12,19, 0.54 | |||
98112,24026,7792, 324.32,114, 4.74,13, 0.54,3, 0.12 | |||
98115,53109,13558, 255.29,245, 4.61,24, 0.45,9, 0.17 | |||
98116,26979,6469, 239.78,139, 5.15,8, 0.30,2, 0.07 | |||
98117,34314,9956, 290.14,176, 5.13,25, 0.73,7, 0.20 | |||
98118,49108,11377, 231.67,595, 12.12,62, 1.26,11, 0.22 | |||
98119,26126,5935, 227.17,86, 3.29,6, 0.23,1, 0.04 | |||
98121,22274,3890, 174.64,73, 3.28,4, 0.18,2, 0.09 | |||
98122,44306,12558, 283.44,241, 5.44,17, 0.38,6, 0.14 | |||
98125,43312,9000, 207.79,282, 6.51,36, 0.83,9, 0.21 | |||
98126,24341,5647, 232.00,159, 6.53,30, 1.23,14, 0.58 | |||
98133,49594,10272, 207.12,439, 8.85,64, 1.29,30, 0.60 | |||
98134,675,414, 613.33,17, 25.19,3, 4.44,0, 0.00 | |||
98136,16216,4165, 256.85,78, 4.81,6, 0.37,3, 0.19 | |||
98144,32523,9509, 292.38,358, 11.01,58, 1.78,20, 0.61 | |||
98146,29292,5057, 172.64,352, 12.02,41, 1.40,12, 0.41 | |||
98148,10823,1677, 154.95,131, 12.10,18, 1.66,3, 0.28 | |||
98155,34534,6970, 201.83,286, 8.28,47, 1.36,24, 0.69 | |||
98164,157,3972, 25299.36,9, 57.32,0, 0.00,1, 6.37 | |||
98166,21840,3947, 180.72,196, 8.97,27, 1.24,4, 0.18 | |||
98168,36076,6291, 174.38,644, 17.85,49, 1.36,7, 0.19 | |||
98177,20330,4526, 222.63,143, 7.03,31, 1.52,21, 1.03 | |||
98178,26649,4931, 185.04,308, 11.56,28, 1.05,7, 0.26 | |||
98188,25097,5094, 202.97,428, 17.05,41, 1.63,7, 0.28 | |||
98195,0,40, .,4, .,0, .,0, . | |||
98198,36960,6225, 168.43,523, 14.15,49, 1.33,6, 0.16 | |||
98199,21488,4913, 228.64,61, 2.84,3, 0.14,1, 0.05 | |||
98224,310,16, 51.61,1, 3.23,0, 0.00,0, 0.00 | |||
98288,374,46, 122.99,0, 0.00,0, 0.00,0, 0.00 | |||
98354,7419,65, 8.76,6, 0.81,1, 0.13,2, 0.27 | |||
98422,21107,7, 0.33,4, 0.19,2, 0.09,0, 0.00 |
@ -0,0 +1,85 @@ | |||
Location_Name,Population,Tests,Test_Rate,Positives,Positive_Rate,Hospitalizations,Hospitalization_Rate,Deaths,Death_Rate | |||
00000,2226300,361435, 16234.78,19665, 883.30,2229, 100.12,720, 32.34 | |||
98001,35948,4520, 125.74,460, 12.80,46, 1.28,8, 0.22 | |||
98002,35106,5255, 149.69,669, 19.06,69, 1.97,12, 0.34 | |||
98003,49587,7308, 147.38,1043, 21.03,100, 2.02,24, 0.48 | |||
98004,34755,5554, 159.80,235, 6.76,30, 0.86,9, 0.26 | |||
98005,20154,2432, 120.67,129, 6.40,17, 0.84,0, 0.00 | |||
98006,38904,4763, 122.43,155, 3.98,14, 0.36,4, 0.10 | |||
98007,28612,2748, 96.04,182, 6.36,27, 0.94,12, 0.42 | |||
98008,26113,3115, 119.29,224, 8.58,39, 1.49,16, 0.61 | |||
98010,5549,642, 115.70,33, 5.95,1, 0.18,1, 0.18 | |||
98011,34504,3565, 103.32,161, 4.67,27, 0.78,12, 0.35 | |||
98014,7630,890, 116.64,24, 3.15,5, 0.66,0, 0.00 | |||
98019,12209,1273, 104.27,41, 3.36,0, 0.00,1, 0.08 | |||
98022,22792,2447, 107.36,153, 6.71,32, 1.40,26, 1.14 | |||
98023,50842,6359, 125.07,612, 12.04,53, 1.04,7, 0.14 | |||
98024,6000,707, 117.83,20, 3.33,1, 0.17,0, 0.00 | |||
98027,30108,4348, 144.41,227, 7.54,44, 1.46,25, 0.83 | |||
98028,23193,3164, 136.42,143, 6.17,28, 1.21,9, 0.39 | |||
98029,29254,3840, 131.26,111, 3.79,12, 0.41,12, 0.41 | |||
98030,36849,4936, 133.95,668, 18.13,66, 1.79,24, 0.65 | |||
98031,39076,5606, 143.46,580, 14.84,57, 1.46,16, 0.41 | |||
98032,36699,5614, 152.97,680, 18.53,51, 1.39,11, 0.30 | |||
98033,38814,5620, 144.79,238, 6.13,26, 0.67,7, 0.18 | |||
98034,44252,5933, 134.07,420, 9.49,103, 2.33,56, 1.27 | |||
98038,35227,4230, 120.08,179, 5.08,14, 0.40,4, 0.11 | |||
98039,3247,603, 185.71,32, 9.86,2, 0.62,0, 0.00 | |||
98040,24470,4975, 203.31,169, 6.91,16, 0.65,5, 0.20 | |||
98042,48838,5691, 116.53,441, 9.03,42, 0.86,6, 0.12 | |||
98045,15333,2224, 145.05,58, 3.78,2, 0.13,1, 0.07 | |||
98047,6704,787, 117.39,108, 16.11,13, 1.94,2, 0.30 | |||
98051,3735,445, 119.14,29, 7.76,2, 0.54,1, 0.27 | |||
98052,69882,7834, 112.10,351, 5.02,73, 1.04,49, 0.70 | |||
98053,22484,2143, 95.31,64, 2.85,11, 0.49,6, 0.27 | |||
98055,24945,3268, 131.01,232, 9.30,36, 1.44,15, 0.60 | |||
98056,36346,4790, 131.79,346, 9.52,34, 0.94,7, 0.19 | |||
98057,13268,2501, 188.50,200, 15.07,18, 1.36,10, 0.75 | |||
98058,44805,5698, 127.17,378, 8.44,43, 0.96,12, 0.27 | |||
98059,39897,4834, 121.16,249, 6.24,28, 0.70,5, 0.13 | |||
98065,15789,2151, 136.23,85, 5.38,2, 0.13,0, 0.00 | |||
98070,10788,1601, 148.41,14, 1.30,1, 0.09,0, 0.00 | |||
98072,24584,2678, 108.93,125, 5.08,21, 0.85,5, 0.20 | |||
98074,28881,3130, 108.38,77, 2.67,3, 0.10,4, 0.14 | |||
98075,24330,2909, 119.56,130, 5.34,8, 0.33,4, 0.16 | |||
98077,14416,1487, 103.15,52, 3.61,3, 0.21,1, 0.07 | |||
98092,47868,4920, 102.78,493, 10.30,61, 1.27,8, 0.17 | |||
98101,16247,3758, 231.30,159, 9.79,26, 1.60,10, 0.62 | |||
98102,26690,6381, 239.08,139, 5.21,7, 0.26,1, 0.04 | |||
98103,53528,12339, 230.51,253, 4.73,27, 0.50,15, 0.28 | |||
98104,18339,4123, 224.82,260, 14.18,42, 2.29,10, 0.55 | |||
98105,54923,8786, 159.97,323, 5.88,12, 0.22,1, 0.02 | |||
98106,25898,4705, 181.67,302, 11.66,37, 1.43,4, 0.15 | |||
98107,29219,6353, 217.43,115, 3.94,10, 0.34,5, 0.17 | |||
98108,25264,4725, 187.03,324, 12.82,27, 1.07,8, 0.32 | |||
98109,34939,6640, 190.05,235, 6.73,38, 1.09,20, 0.57 | |||
98112,24026,6258, 260.47,113, 4.70,12, 0.50,2, 0.08 | |||
98115,53109,11395, 214.56,247, 4.65,22, 0.41,9, 0.17 | |||
98116,26979,5445, 201.82,143, 5.30,8, 0.30,3, 0.11 | |||
98117,34314,7835, 228.33,175, 5.10,24, 0.70,7, 0.20 | |||
98118,49108,9626, 196.02,614, 12.50,65, 1.32,11, 0.22 | |||
98119,26126,5032, 192.61,87, 3.33,6, 0.23,1, 0.04 | |||
98121,22274,3300, 148.15,75, 3.37,4, 0.18,2, 0.09 | |||
98122,44306,9942, 224.39,252, 5.69,16, 0.36,6, 0.14 | |||
98125,43312,7696, 177.69,289, 6.67,37, 0.85,8, 0.18 | |||
98126,24341,4694, 192.84,163, 6.70,29, 1.19,14, 0.58 | |||
98133,49594,8793, 177.30,446, 8.99,62, 1.25,33, 0.67 | |||
98134,675,291, 431.11,13, 19.26,3, 4.44,0, 0.00 | |||
98136,16216,3389, 208.99,84, 5.18,7, 0.43,3, 0.19 | |||
98144,32523,7710, 237.06,371, 11.41,59, 1.81,19, 0.58 | |||
98146,29292,4525, 154.48,417, 14.24,44, 1.50,12, 0.41 | |||
98148,10823,1493, 137.95,134, 12.38,19, 1.76,3, 0.28 | |||
98155,34534,6038, 174.84,299, 8.66,48, 1.39,25, 0.72 | |||
98164,157,3169, 20184.71,0, 0.00,0, 0.00,0, 0.00 | |||
98166,21840,3430, 157.05,203, 9.29,27, 1.24,4, 0.18 | |||
98168,36076,5565, 154.26,655, 18.16,49, 1.36,7, 0.19 | |||
98177,20330,3916, 192.62,145, 7.13,30, 1.48,22, 1.08 | |||
98178,26649,4280, 160.61,325, 12.20,28, 1.05,7, 0.26 | |||
98188,25097,3887, 154.88,460, 18.33,43, 1.71,7, 0.28 | |||
98195,0,38, .,4, .,0, .,0, . | |||
98198,36960,5321, 143.97,550, 14.88,50, 1.35,6, 0.16 | |||
98199,21488,4230, 196.85,64, 2.98,3, 0.14,1, 0.05 | |||
98224,310,14, 45.16,1, 3.23,0, 0.00,0, 0.00 | |||
98288,374,34, 90.91,0, 0.00,0, 0.00,0, 0.00 | |||
98354,7419,59, 7.95,5, 0.67,1, 0.13,2, 0.27 | |||
98422,21107,6, 0.28,3, 0.14,1, 0.05,0, 0.00 |
@ -1,17 +0,0 @@ | |||
import psycopg2 | |||
import csv | |||
conn = psycopg2.connect("host='localhost' dbname='king_county_wa' user='postgres' password='postgres'" ) | |||
cur = conn.cursor() | |||
with open('covid-19_zip.csv', 'r') as f: | |||
reader = csv.reader(f) | |||
next(reader) # Skip the header row. | |||
for row in reader: | |||
#print(row) | |||
cur.execute( | |||
"INSERT INTO covid19_zip VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", row | |||
) | |||
conn.commit() | |||
cur.execute('SELECT * FROM covid19_zip') |