annikwag commited on
Commit
2b24fc7
·
verified ·
1 Parent(s): 40b7eec

Update appStore/region_utils.py

Browse files
Files changed (1) hide show
  1. appStore/region_utils.py +13 -2
appStore/region_utils.py CHANGED
@@ -34,11 +34,22 @@ def get_regions(region_df):
34
  return region_df, unique_sub_regions
35
 
36
  @st.cache_data
37
- def get_country_name_and_region_mapping(_client, collection_name, region_df, hybrid_search_fn, clean_country_code_fn, get_country_name_fn):
 
 
 
 
 
 
 
38
  """
39
  Build a mapping from country name -> code and code -> sub-region, by scanning the entire collection.
40
  """
41
- results = hybrid_search_fn(_client, "", collection_name)
 
 
 
 
42
  country_set = set()
43
  for res in results[0] + results[1]:
44
  country = res.payload.get('metadata', {}).get('country', "[]")
 
34
  return region_df, unique_sub_regions
35
 
36
  @st.cache_data
37
+ def get_country_name_and_region_mapping(
38
+ _client,
39
+ collection_name,
40
+ region_df,
41
+ _hybrid_search_fn,
42
+ _clean_country_code_fn,
43
+ _get_country_name_fn
44
+ ):
45
  """
46
  Build a mapping from country name -> code and code -> sub-region, by scanning the entire collection.
47
  """
48
+ # Note the underscores in the function parameters above.
49
+
50
+ # Inside the function, just call them as usual:
51
+ results = _hybrid_search_fn(_client, "", collection_name)
52
+
53
  country_set = set()
54
  for res in results[0] + results[1]:
55
  country = res.payload.get('metadata', {}).get('country', "[]")