add 2020 state color tag
This commit is contained in:
parent
e066e56765
commit
0a3bf8b862
2
COVID-19
2
COVID-19
@ -1 +1 @@
|
||||
Subproject commit 35d7831a80508b329a0dc03bac3365ea88db8fbb
|
||||
Subproject commit 012deac216900dd9c73c133b55e57e79a4617f2d
|
1501
dashboard.json
1501
dashboard.json
File diff suppressed because it is too large
Load Diff
80
ingest3.py
80
ingest3.py
@ -30,8 +30,8 @@ row_fields = {
|
||||
'Country_Region': str,
|
||||
'Total_Test_Results': f2int,
|
||||
'Case_Fatality_Ratio': float,
|
||||
'Cases_28_Days': int,
|
||||
'Deaths_28_Days': int,
|
||||
'Cases_28_Days': f2int,
|
||||
'Deaths_28_Days': f2int,
|
||||
}
|
||||
|
||||
# https://www.nytimes.com/elections/2016/results/president
|
||||
@ -102,11 +102,84 @@ states = {
|
||||
}
|
||||
}
|
||||
|
||||
# https://upload.wikimedia.org/wikipedia/commons/4/49/ElectoralCollege2020.svg
|
||||
states_2020 = {
|
||||
'red': {
|
||||
'Ohio',
|
||||
'Montana',
|
||||
'South Dakota',
|
||||
'Tennessee',
|
||||
'Nebraska',
|
||||
'North Dakota',
|
||||
'Mississippi',
|
||||
'Utah',
|
||||
'Alaska',
|
||||
'Idaho',
|
||||
'Arkansas',
|
||||
'Wyoming',
|
||||
'Alabama',
|
||||
'Indiana',
|
||||
'Kentucky',
|
||||
'Louisiana',
|
||||
'Kansas',
|
||||
'Florida',
|
||||
'Iowa',
|
||||
'Oklahoma',
|
||||
'Texas',
|
||||
'West Virginia',
|
||||
'South Carolina',
|
||||
'North Carolina',
|
||||
},
|
||||
'blue': {
|
||||
'Georgia',
|
||||
'Pennsylvania',
|
||||
'Missouri',
|
||||
'Arizona',
|
||||
'Wisconsin',
|
||||
'Michigan',
|
||||
'Minnesota',
|
||||
'New Mexico',
|
||||
'Oregon',
|
||||
'Nevada',
|
||||
'New Jersey',
|
||||
'Colorado',
|
||||
'Washington',
|
||||
'New Hampshire',
|
||||
'District of Columbia',
|
||||
'Maryland',
|
||||
'Virginia',
|
||||
'California',
|
||||
'Hawaii',
|
||||
'Massachusetts',
|
||||
'New York',
|
||||
'Rhode Island',
|
||||
'Vermont',
|
||||
'Connecticut',
|
||||
'Delaware',
|
||||
'Illinois',
|
||||
'Maine',
|
||||
},
|
||||
'other': {
|
||||
'American Samoa',
|
||||
'Guam',
|
||||
'Puerto Rico',
|
||||
'Diamond Princess',
|
||||
'Virgin Islands',
|
||||
'Grand Princess',
|
||||
'Northern Mariana Islands',
|
||||
}
|
||||
}
|
||||
|
||||
states_bycolor = {}
|
||||
for color, states in states.items():
|
||||
for state in states:
|
||||
states_bycolor[state] = color
|
||||
|
||||
states_bycolor_2020 = {}
|
||||
for color, states in states_2020.items():
|
||||
for state in states:
|
||||
states_bycolor_2020[state] = color
|
||||
|
||||
|
||||
def convert(func, inp):
|
||||
if inp == "":
|
||||
@ -139,7 +212,8 @@ def get_data_for_influx(fpath, assigned_date=None):
|
||||
"tags": {
|
||||
"state": row["Province_State"],
|
||||
"iso3": row["ISO3"],
|
||||
"color": states_bycolor[row["Province_State"]]
|
||||
"color": states_bycolor[row["Province_State"]],
|
||||
"color_2020": states_bycolor_2020[row["Province_State"]]
|
||||
},
|
||||
"time": assigned_date or row["Last_Update"],
|
||||
"fields": row
|
||||
|
Loading…
Reference in New Issue
Block a user