forked from ome/omero_search_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of data sources and fix examples
- Loading branch information
Showing
4 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import logging | ||
import json | ||
import requests | ||
|
||
from utils import base_url | ||
|
||
''' | ||
Call the search engine to determine the available data sources''' | ||
|
||
data_source_url = "{base_url}resources/data_sources/".format( | ||
base_url=base_url) | ||
|
||
logging.info(" getting the available data sources") | ||
resp = requests.get(url=data_source_url) | ||
data_sources = json.loads(resp.text) | ||
logging.info("There are %s data sources available, i.e. %s "%(len(data_sources), ', '.join(data_sources))) | ||
''' | ||
"The data source can be linked to queries to return search results from the specified data source. | ||
For example, the user can limit the search results to "bia" data source when querying the searchengine for "Organism" and "homo sapiens" | ||
''' | ||
|
||
key="Organism" | ||
value="homo sapiens" | ||
data_source="bia" | ||
search_url= "{base_url}resources/image/search/?key={key}&value={value}&data_source={data_source}".format( | ||
base_url=base_url, key=key, value=value, data_source=data_source) | ||
|
||
resp = requests.get(url=search_url) | ||
results = json.loads(resp.text) | ||
|
||
logging.info("The size of the returned results is %s" %results.get("results").get("size")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters