Skip to content

Commit

Permalink
fixed caseLevelData empty
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Mar 26, 2024
1 parent e45fc18 commit 267b10a
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions beacon/db/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ def cross_query(query: dict, scope: str, collection: str, request_parameters: di
for iditem in biosample_ids:
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = iditem['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
subquery['$or'].append(new_id)
except Exception:
def_list.append(new_id)
for id_item in iditem['caseLevelData']:
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)

LOG.debug(subquery)
mongo_collection=client.beacon.biosamples
Expand Down Expand Up @@ -101,13 +102,14 @@ def cross_query(query: dict, scope: str, collection: str, request_parameters: di
for iditem in biosample_ids:
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = iditem['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
for id_item in iditem['caseLevelData']:
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 def_list != []:
try:
query['$or'].def_list
Expand Down Expand Up @@ -142,13 +144,14 @@ def cross_query(query: dict, scope: str, collection: str, request_parameters: di
for iditem in biosample_ids:
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = iditem['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
for id_item in iditem['caseLevelData']:
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 def_list != []:
try:
query['$or'].def_list
Expand Down Expand Up @@ -332,13 +335,14 @@ def apply_filters(query: dict, filters: List[dict], collection: str, query_param
for iditem in biosample_ids:
if isinstance(iditem, dict):
if iditem != {}:
new_id={}
new_id[final_id] = iditem['caseLevelData'][original_id]
try:
#LOG.debug(new_id)
partial_query['$or'].append(new_id)
except Exception:
def_list.append(new_id)
for id_item in iditem['caseLevelData']:
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)
LOG.debug(partial_query)

mongo_collection=client.beacon.biosamples
Expand Down

0 comments on commit 267b10a

Please sign in to comment.