Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
add utility functions
Browse files- src/utils.py +20 -13
src/utils.py
CHANGED
@@ -12,19 +12,26 @@ def parse_gg_sheet(url):
|
|
12 |
df = pd.read_csv(url, on_bad_lines="warn")
|
13 |
return df
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
#
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
def add_latlng_col(df, process_column):
|
30 |
"""Add a latlng column to the dataframe"""
|
|
|
12 |
df = pd.read_csv(url, on_bad_lines="warn")
|
13 |
return df
|
14 |
|
15 |
+
|
16 |
+
def is_request_in_list(request, selection_list):
|
17 |
+
if isinstance(request, float): # Check if the input is a float (like NaN)
|
18 |
+
return False
|
19 |
+
if "," in request:
|
20 |
+
all_requests = [r.strip() for r in request.split(",")]
|
21 |
+
else:
|
22 |
+
all_requests = [request]
|
23 |
+
return any([r in selection_list for r in all_requests])
|
24 |
+
|
25 |
+
|
26 |
+
def marker_request(request):
|
27 |
+
# in case of multiple requests we use the first one for the marker's icon
|
28 |
+
# requests are already sorted by priority from the form
|
29 |
+
try:
|
30 |
+
displayed_request = request.split(',')[0]
|
31 |
+
except:
|
32 |
+
displayed_request = request
|
33 |
+
return displayed_request
|
34 |
+
|
35 |
|
36 |
def add_latlng_col(df, process_column):
|
37 |
"""Add a latlng column to the dataframe"""
|