Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
18e86d5
1
Parent(s):
ca1ead1
show requests not in 5categories
Browse files- app.py +1 -1
- src/utils.py +9 -2
app.py
CHANGED
@@ -264,7 +264,7 @@ for i, option in enumerate(options):
|
|
264 |
df["id"] = df.index
|
265 |
# keep rows with at least one request in selected_options
|
266 |
filtered_df = df[df["ما هي احتياجاتك؟ (أضفها إذا لم يتم ذكرها)"].apply(
|
267 |
-
lambda x: is_request_in_list(x, selected_options)
|
268 |
)]
|
269 |
|
270 |
|
|
|
264 |
df["id"] = df.index
|
265 |
# keep rows with at least one request in selected_options
|
266 |
filtered_df = df[df["ما هي احتياجاتك؟ (أضفها إذا لم يتم ذكرها)"].apply(
|
267 |
+
lambda x: is_request_in_list(x, selected_options, options)
|
268 |
)]
|
269 |
|
270 |
|
src/utils.py
CHANGED
@@ -13,15 +13,22 @@ def parse_gg_sheet(url):
|
|
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
|
|
|
13 |
return df
|
14 |
|
15 |
|
16 |
+
def is_request_in_list(request, selection_list, options):
|
17 |
if isinstance(request, float): # Check if the input is a float (like NaN)
|
18 |
return False
|
19 |
+
|
20 |
if "," in request:
|
21 |
all_requests = [r.strip() for r in request.split(",")]
|
22 |
else:
|
23 |
all_requests = [request]
|
|
|
24 |
|
25 |
+
# If at least one of the requests is not in the options or in the selection list, return True
|
26 |
+
for r in all_requests:
|
27 |
+
if r not in options:
|
28 |
+
return True
|
29 |
+
if r in selection_list:
|
30 |
+
return True
|
31 |
+
return False
|
32 |
|
33 |
def marker_request(request):
|
34 |
# in case of multiple requests we use the first one for the marker's icon
|