Jan Mühlnikel commited on
Commit
d55bb01
1 Parent(s): 784ae4f

updated filter functions

Browse files
functions/different_orga_filter.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+ def different_orga_filter(df, orga):
4
+ # FILTER COUNTRY
5
+ country_filtered_df = pd.DataFrame()
6
+ for c in country_code_list:
7
+ c_df = df[df["country"].str.contains(c, na=False)]
8
+ country_filtered_df = pd.concat([country_filtered_df, c_df], ignore_index=False)
9
+
10
+ df = country_filtered_df
11
+
12
+ return country_filtered_df
functions/filter_single.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from functions.semantic_search import search
3
+
4
+ def contains_code(crs_codes, code_list):
5
+ codes = str(crs_codes).split(';')
6
+ return any(code in code_list for code in codes)
7
+
8
+ def filter_projects(df, crs3_list, crs5_list, sdg_str, country_code_list, orga_code_list, query, model, embeddings, TOP_X_PROJECTS=30):
9
+ # Check if filters where not all should be selected are empty