annikwag commited on
Commit
cb75685
·
verified ·
1 Parent(s): bed79fa

Update appStore/prep_data.py

Browse files
Files changed (1) hide show
  1. appStore/prep_data.py +16 -0
appStore/prep_data.py CHANGED
@@ -48,3 +48,19 @@ def process_giz_worldwide():
48
  giz_df['source'] = 'GIZ_WORLDWIDE'
49
  return giz_df
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  giz_df['source'] = 'GIZ_WORLDWIDE'
49
  return giz_df
50
 
51
+ def remove_duplicates(results_list):
52
+ """
53
+ Return a new list of results with duplicates removed,
54
+ based on 'url' in metadata.
55
+ """
56
+ unique_results = []
57
+ seen_urls = set()
58
+
59
+ for r in results_list:
60
+ # Safely get the URL from metadata
61
+ url = r.payload['metadata'].get('url', None)
62
+ if url not in seen_urls:
63
+ seen_urls.add(url)
64
+ unique_results.append(r)
65
+
66
+ return unique_results