| import pandas as pd |
| from functions.semantic_search import search |
|
|
| def contains_code(crs_codes, code_list): |
| codes = str(crs_codes).split(';') |
| return any(code in code_list for code in codes) |
|
|
| def filter_single(df, country_code_list, orga_code_list): |
| |
| if country_code_list != []: |
| country_filtered_df = pd.DataFrame() |
| for c in country_code_list: |
| c_df = df[df["country"].str.contains(c, na=False)] |
| country_filtered_df = pd.concat([country_filtered_df, c_df], ignore_index=False) |
| |
| df = country_filtered_df |
| |
| |
| if orga_code_list != []: |
| df = df[df['orga_abbreviation'].isin(orga_code_list)] |
| |
| return df |