Skip to content

Commit

Permalink
bug fixed in biosample cross query
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Mar 26, 2024
1 parent c23d696 commit 8db90d4
Showing 1 changed file with 36 additions and 40 deletions.
76 changes: 36 additions & 40 deletions beacon/db/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ def cross_query(query: dict, scope: str, collection: str, request_parameters: di
original_id="biosampleId"
def_list=[]
for iditem in biosample_ids:
for id_item in iditem['caseLevelData']:
if isinstance(id_item, dict):
if id_item != {}:
new_id={}
new_id[final_id] = id_item[original_id]
try:
#LOG.debug(new_id)
subquery['$or'].append(new_id)
except Exception:
def_list.append(new_id)
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = id_item['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
subquery['$or'].append(new_id)
except Exception:
def_list.append(new_id)

LOG.debug(subquery)
mongo_collection=client.beacon.biosamples
Expand Down Expand Up @@ -100,16 +99,15 @@ def cross_query(query: dict, scope: str, collection: str, request_parameters: di
original_id="biosampleId"
def_list=[]
for iditem in biosample_ids:
for id_item in iditem['caseLevelData']:
if isinstance(id_item, dict):
if id_item != {}:
new_id={}
new_id[final_id] = id_item[original_id]
try:
#LOG.debug(new_id)
query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = id_item['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
if def_list != []:
try:
query['$or'].def_list
Expand Down Expand Up @@ -142,16 +140,15 @@ def cross_query(query: dict, scope: str, collection: str, request_parameters: di
original_id="biosampleId"
def_list=[]
for iditem in biosample_ids:
for id_item in iditem['caseLevelData']:
if isinstance(id_item, dict):
if id_item != {}:
new_id={}
new_id[final_id] = id_item[original_id]
try:
#LOG.debug(new_id)
query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = id_item['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
if def_list != []:
try:
query['$or'].def_list
Expand Down Expand Up @@ -333,16 +330,15 @@ def apply_filters(query: dict, filters: List[dict], collection: str, query_param
def_list=[]
partial_query['$or']=[]
for iditem in biosample_ids:
for id_item in iditem['caseLevelData']:
if isinstance(id_item, dict):
if id_item != {}:
new_id={}
new_id[final_id] = id_item[original_id]
try:
#LOG.debug(new_id)
partial_query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = id_item['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
partial_query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
LOG.debug(partial_query)

mongo_collection=client.beacon.biosamples
Expand Down

0 comments on commit 8db90d4

Please sign in to comment.