Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and khaledk2 committed Oct 13, 2023
1 parent 3ec6f37 commit 54a5d1d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 49 deletions.
94 changes: 47 additions & 47 deletions examples/two_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,93 +11,92 @@
base_url = "http://idr-testing.openmicroscopy.org/searchengine//api/v1/"
logging.basicConfig(stream=sys.stdout, level=logging.INFO)

'''
"""
**Query 1**
Organism Part Small intestine OR Duodenum
Pathology Adenocarcinoma (all) ==> contains (adenocarcinoma)
Gene Symbol PDX1
'''
query_1={
"""
query_1 = {
"query_details": {
"and_filters": [
{
"name": "Gene Symbol",
"value": "PDX1",
"operator": "equals",
"resource": "image"
"resource": "image",
},
{
"name": "Pathology",
"value": "adenocarcinoma",
"operator": "contains",
"resource": "image"
}
],
"or_filters": [[
{
"name": "Organism Part",
"value": "Duodenum",
"operator": "equals",
"resource": "image"
"resource": "image",
},
{
"name": "Organism Part",
"value": "Small intestine",
"operator": "equals",
"resource": "image"
}

]

],
"case_sensitive": False
"or_filters": [
[
{
"name": "Organism Part",
"value": "Duodenum",
"operator": "equals",
"resource": "image",
},
{
"name": "Organism Part",
"value": "Small intestine",
"operator": "equals",
"resource": "image",
},
]
],
"case_sensitive": False,
}
}

'''
"""
**Query 2**
Organism Part Small intestine OR Duodenum
Pathology normal nos ==> normal tissue, nos
Gene Symbol PDX1
'''
query_2={
"""
query_2 = {
"query_details": {
"and_filters": [
{
"name": "Gene Symbol",
"value": "PDX1",
"operator": "equals",
"resource": "image"
"resource": "image",
},
{
"name": "Pathology",
"value": "normal tissue, nos",
"operator": "equals",
"resource": "image"
}
],
"or_filters": [[
{
"name": "Organism Part",
"value": "Duodenum",
"operator": "equals",
"resource": "image"
"resource": "image",
},
{
"name": "Organism Part",
"value": "Small intestine",
"operator": "equals",
"resource": "image"
}

]

],
"case_sensitive": False
"or_filters": [
[
{
"name": "Organism Part",
"value": "Duodenum",
"operator": "equals",
"resource": "image",
},
{
"name": "Organism Part",
"value": "Small intestine",
"operator": "equals",
"resource": "image",
},
]
],
"case_sensitive": False,
}
}


def query_the_search_ending(query):
received_results_data = []
query_data = {"query": query}
Expand Down Expand Up @@ -179,8 +178,9 @@ def query_the_search_ending(query):
logging.info("Total received results: %s" % len(received_results_data))
return received_results_data


logging.info("Sending the first query:")
results_1 = query_the_search_ending(query_1 )
results_1 = query_the_search_ending(query_1)
logging.info("=========================")
logging.info("Sending the second query:")
results_2 = query_the_search_ending(query_2)
2 changes: 0 additions & 2 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


def copy_tools_subfolder():

"""
Copy the maintenance_scripts folder to the searchengine folder
"""
Expand Down Expand Up @@ -98,7 +97,6 @@ def analyse_log_file(file_name, resourses):

def check_filters(conds, resourses):
for cond in conds:

if cond.get("resource") in resourses:
names_values = resourses[cond.get("resource")]
else:
Expand Down

0 comments on commit 54a5d1d

Please sign in to comment.