Skip to content

Commit 6e34a09

Browse files
authored
Merge pull request #11 from boettiger-lab/feat/update_app
fixing state filter in charts
2 parents cb17402 + e60c96a commit 6e34a09

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

app/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
legend, position, bg_color, fontsize, shape_type, controls = get_legend(paint, leafmap_choice)
6666
# get all the ids that correspond to the filter
6767
gdf = filter_data(tpl_table, state_choice, county_choice, year_range)
68-
gdf_landvote = filter_data(landvote_table, state_choice, county_choice, year_range)
68+
gdf_landvote = filter_data(landvote_table, state_codes[state_choice], county_choice, year_range)
6969
unique_ids = gdf.select('fid').distinct().execute()['fid'].to_list()
7070

7171
##### Chatbot stuff
@@ -291,6 +291,8 @@ def run_sql(query, llm_choice):
291291

292292
st.markdown('#')
293293

294+
295+
294296
col1, col2 = st.columns(2)
295297
with col1:
296298
gdf_tpl = group_data(gdf, 'Acquisition Cost')

app/variables.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,61 @@
5656
"West Virginia", "Wisconsin", "Wyoming"
5757
)
5858

59+
state_codes = {
60+
"Alabama": "AL",
61+
"Alaska": "AK",
62+
"Arizona": "AZ",
63+
"Arkansas": "AR",
64+
"California": "CA",
65+
"Colorado": "CO",
66+
"Connecticut": "CT",
67+
"Delaware": "DE",
68+
"Florida": "FL",
69+
"Georgia": "GA",
70+
"Hawaii": "HI",
71+
"Idaho": "ID",
72+
"Illinois": "IL",
73+
"Indiana": "IN",
74+
"Iowa": "IA",
75+
"Kansas": "KS",
76+
"Kentucky": "KY",
77+
"Louisiana": "LA",
78+
"Maine": "ME",
79+
"Maryland": "MD",
80+
"Massachusetts": "MA",
81+
"Michigan": "MI",
82+
"Minnesota": "MN",
83+
"Mississippi": "MS",
84+
"Missouri": "MO",
85+
"Montana": "MT",
86+
"Nebraska": "NE",
87+
"Nevada": "NV",
88+
"New Hampshire": "NH",
89+
"New Jersey": "NJ",
90+
"New Mexico": "NM",
91+
"New York": "NY",
92+
"North Carolina": "NC",
93+
"North Dakota": "ND",
94+
"Ohio": "OH",
95+
"Oklahoma": "OK",
96+
"Oregon": "OR",
97+
"Pennsylvania": "PA",
98+
"Puerto Rico": "PR",
99+
"Rhode Island": "RI",
100+
"South Carolina": "SC",
101+
"South Dakota": "SD",
102+
"Tennessee": "TN",
103+
"Texas": "TX",
104+
"Utah": "UT",
105+
"Vermont": "VT",
106+
"Virginia": "VA",
107+
"Washington": "WA",
108+
"West Virginia": "WV",
109+
"Wisconsin": "WI",
110+
"Wyoming": "WY",
111+
}
112+
113+
59114
# Define color hex codes
60115
darkblue = "#00008B"
61116
blue = "#0096FF"

0 commit comments

Comments
 (0)