def route_sample_treatment(database, feature_type, operation): # add, clear_samples, band, disband if operation not in [ 'add', 'clear_samples', 'band', 'disband', 'get_samples', 'get_sample_detail' ]: return { "status": "Error", "message": "operation '%s' without algorithm in the url is not allowed" % operation } params = parse_params(request.params) if params.has_key('json_data'): json_data_s = params['json_data'] else: json_data_s = "{}" if type(json_data_s) == unicode: json_data_s = json_data_s.encode('utf-8') db = mongo_client[database] result = my_classifier.route(db, json_data_s, operation, feature_type) print result return json.dumps(result, default=json_util.default)
def route_sample_treatment(database,feature_type,operation): # add, clear_samples, band, disband if operation not in ['add','clear_samples','band','disband','get_samples','get_sample_detail']: return {"status": "Error", "message":"operation '%s' without algorithm in the url is not allowed" % operation} params = parse_params(request.params) if params.has_key('json_data'): json_data_s = params['json_data'] else: json_data_s = "{}" if type(json_data_s) == unicode: json_data_s = json_data_s.encode('utf-8') db = mongo_client[database] result = my_classifier.route(db,json_data_s,operation,feature_type) print result return json.dumps(result,default=json_util.default)
def route_machine_learning_basic(database, feature_type, algorithm, operation): print 'function: route' params = parse_params(request.params) if params.has_key('json_data'): json_data_s = params['json_data'] else: json_data_s = "{}" if type(json_data_s) == unicode: json_data_s = json_data_s.encode('utf-8') print "param: " + json_data_s db = mongo_client[database] result = my_classifier.route(db, json_data_s, operation, feature_type, algorithm) #print result return json.dumps(result,default=json_util.default)
def route_machine_learning_basic(database, feature_type, algorithm, operation): print 'function: route' params = parse_params(request.params) if params.has_key('json_data'): json_data_s = params['json_data'] else: json_data_s = "{}" if type(json_data_s) == unicode: json_data_s = json_data_s.encode('utf-8') print "param: " + json_data_s db = mongo_client[database] result = my_classifier.route(db, json_data_s, operation, feature_type, algorithm) #print result return json.dumps(result, default=json_util.default)