def post(self): """ Get Experiments by JSON object """ args = request.get_json() search_query = SearchQuery() search_query.set_params(args) search_result = self.gxdhtexperiment_service.summary_search(search_query) return search_result.serialize()
def get(self): """ Get Experiments by Parameters """ args = gxdhtexperiment_parser.parse_args() search_query = SearchQuery() search_query.set_params(args) search_result = self.gxdhtexperiment_service.summary_search(search_query) return search_result.serialize()
def _perform_query(self, args): search_query = SearchQuery() if not args: search_query.paginator = Paginator() search_query.paginator.page_size = 100 search_query.set_params(args) search_result = self.mgitype_service.search(search_query) return search_result.serialize()
def post(self): """ Search EMAPA terms """ search_query = SearchQuery() search_query.set_params(request.get_json()) search_results = self.vocterm_service.search_emapa_terms(search_query) return search_results.serialize()
def get(self): """ Search Users """ args = user_parser.parse_args() search_query = SearchQuery() search_query.set_params(args) search_results = self.user_service.search(search_query) return search_results.serialize()
class SearchQueryParamValidatorTest(unittest.TestCase): """ Test how SearchQuery validates query params """ def setUp(self): self.search_query = SearchQuery() # False cases def test_none(self): self.assertFalse( self.search_query._is_value_not_empty(None) ) def test_empty_string(self): self.assertFalse( self.search_query._is_value_not_empty("") ) def test_empty_list(self): self.assertFalse( self.search_query._is_value_not_empty([]) ) # True / valid cases def test_boolean_false(self): self.assertTrue( self.search_query._is_value_not_empty(False) ) def test_boolean_true(self): self.assertTrue( self.search_query._is_value_not_empty(True) ) def test_string(self): self.assertTrue( self.search_query._is_value_not_empty("value") ) def test_list(self): self.assertTrue( self.search_query._is_value_not_empty(["value"]) ) def test_list_with_empty_item(self): self.assertTrue( self.search_query._is_value_not_empty([""]) ) def test_list_with_none_item(self): self.assertTrue( self.search_query._is_value_not_empty([None]) )
def post(self): """ Search GxdIndexRecords """ search_query = SearchQuery() search_query.set_params(request.json) # set a limit on the results paginator = Paginator() paginator.page_size = 2000 search_query.paginator = paginator search_results = self.gxdindex_service.search(search_query) app.logger.debug(search_results.serialize()) return search_results.serialize()
def get_valid_markers_by_symbol(self, symbol): """ Retrieve list of valid markers by symbol """ search_query = SearchQuery() search_query.set_param('symbol', symbol) # restrict to official and withdrawn search_query.set_param('_marker_status_keys', [1,2]) # only search mouse search_query.set_param('_organism_keys', [1]) search_results = self.marker_dao.search(search_query) markers = search_results.items batchLoadAttribute(markers, 'current_markers') batchLoadAttribute(markers, 'featuretype_vocterms') ValidMarkerSortHelper().sort(markers) # convert db models to domain objects search_results.items = convert_models(markers, SmallMarker) return search_results
def setUp(self): self.search_query = SearchQuery()
def _get_emapa_term_results_count(self, term_id): search_query = SearchQuery() search_query.set_param("direct_structure_id", term_id) count = self.gxdresult_dao.get_search_count(search_query) return count