emit(doc.shared_with, doc._id) }; } ''') from flask import current_app as app app = Flask(__name__) app.config.update(COUCHDB_SERVER='http://*****:*****@app_txl_cloud.route('/editor') def txl_index(): return render_template('quick_txl.html') @app_txl_cloud.route('/txl', methods=['POST']) def txl(): # getting the txl and the input file to parse txl_source = request.form['txl_source'] input_to_parse = request.form['input_to_parse']
}; } ''') from flask import current_app as app app = Flask(__name__) app.config.update(COUCHDB_SERVER='http://*****:*****@app_code_clone.route('/cloneCognition') def cloneCognition(): return render_template('index_cloneValidationFramework.html') @app_code_clone.route('/app_code_clone_request_user_access')
''') views_by_workflow_locking_module = ViewDefinition('hello', 'workflow_locking_module', ''' function (doc) { if (doc.doc_type && doc.doc_type == 'workflow_locking_module') { emit(doc.workflow_id, doc._id) }; } ''') manager = CouchDBManager() manager.setup(app) manager.add_viewdef([views_by_user, views_by_non_validated_clones, views_by_pipeline_module, views_by_email, views_by_saved_pipeline, views_by_workflow_locking_turn, views_by_workflow_locking_module]) manager.sync(app) tasks = [ { 'id': 1, 'title': u'Buy groceries', 'description': u'Milk, Cheese, Pizza, Fruit, Tylenol', 'done': False }, { 'id': 2, 'title': u'Learn Python', 'description': u'Need to find a good Python tutorial on the web',
emit(doc.author, doc._id) }; } ''') from flask import current_app as app app = Flask(__name__) app.config.update(COUCHDB_SERVER='http://*****:*****@app_collaborative_sci_workflow.route('/collaborative_workflow') def collaborative_workflow(): return render_template('collaborative_workflow.html') #--------------------------------------------------------------------------------------- # MAIN CODES #--------------------------------------------------------------------------------------- ############ BIO STARTS ############################# import pandas
#!/usr/bin/env python # -*- coding: utf-8 -*- from flaskext.couchdb import CouchDBManager, ViewDefinition manager = CouchDBManager() # auto_sync=False all_users_view = ViewDefinition('users', 'all', '''\ function (doc) { if (doc.type == 'user') { emit(doc.openid, null) }; }''') all_text_view = ViewDefinition('text', 'all', '''\ function (doc) { if (doc.type != 'user') { emit(doc.date, {title:doc.title, content: doc.content, user: doc.user}) }; }''') manager.add_viewdef((all_users_view, all_text_view))
from GetTaskIDs import GetTaskIDs from couchdb import Server import requests import uuid #prepare app to be a flask based application #Enable cors on the app #set up couch DB manager to enable communication from API to DB app = Flask(__name__) cors = CORS(app, resources={r"/todo_list/*": {"origins": "*"}}) manager = CouchDBManager() manager.setup(app) #Add user_tasks_view to manager's list of views manager.add_viewdef(user_tasks_view) #Route to return all currently store tasks in the DB @app.route('/todo_list/getAllViews', methods=['GET']) @cross_origin() def getAllTasks(): #runs user_tasks_view and returns resulting IDs to docIDs docIDs = GetTaskIDs(user_tasks_view) documents = [] #for ever ID locate the doc in DB and append to documents array for ids in docIDs: documents.append(g.couch[ids]) return jsonify(documents)
} ''') views_by_non_validated_clones = ViewDefinition('hello', 'my_non_validated_clones', ''' function (doc) { if (doc.is_clone_doc == 'yes' && doc.is_validated_by_any_user == 'no') { emit(doc._id, doc) }; } ''') # userInfo & uplaod imgs database manager = CouchDBManager() manager.setup(app) manager.add_viewdef([views_by_source, views_by_user, views_by_Lsysmodel, views_by_non_validated_clones]) manager.sync(app) # imgs search database search_obj = imgSearch() imgId = [] idseq = 0 def image_source(selectedSource): sources = [] for row in views_by_source(g.couch): sources.append(row.key) sources = list(set(sources)) sources.sort() if selectedSource in sources: