示例#1
0
 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()
示例#2
0
 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()
示例#3
0
文件: mgitype_api.py 项目: mgijax/pwi
    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()
示例#4
0
    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()
示例#5
0
文件: user_api.py 项目: mgijax/pwi
    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()
示例#6
0
文件: user_api.py 项目: mgijax/pwi
    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()
示例#7
0
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])
        )
示例#8
0
 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()
示例#9
0
 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()
示例#10
0
 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
示例#11
0
 def setUp(self):
     self.search_query = SearchQuery()
示例#12
0
 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