From 1f5a9a657e45b652686c085d25e9333bda3d189c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20L=C3=B3pez-Doriga?= Date: Fri, 17 May 2024 12:31:34 +0200 Subject: [PATCH] fixing extract filtering terms --- beacon/db/extract_filtering_terms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/beacon/db/extract_filtering_terms.py b/beacon/db/extract_filtering_terms.py index d13d9584..adcc8347 100644 --- a/beacon/db/extract_filtering_terms.py +++ b/beacon/db/extract_filtering_terms.py @@ -251,6 +251,8 @@ def find_ontology_terms_used(collection_name: str) -> List[Dict]: if term not in terms_ids: terms_ids.append(term) i += 10000 + if i > 30000: + break print(i) else: xs = client.beacon.get_collection(collection_name).find().skip(0).limit(10000) @@ -401,7 +403,8 @@ def merge_terms(): 'scopes': array_of_scopes }) client.beacon.filtering_terms.delete_many({"id": repeated_id}) - client.beacon.filtering_terms.insert_many(new_terms) + if new_terms != []: + client.beacon.filtering_terms.insert_many(new_terms)