def viz(): """ Handles the functionality on the alternate bubbleViz page with performance improvements. Note: Returns a response object (often a render_template call) to flask and eventually to the browser. """ fileManager = managers.utility.loadFileManager() if request.method == "GET": # "GET" request occurs when the page is first loaded. if 'cloudoption' not in session: session['cloudoption'] = constants.DEFAULT_CLOUD_OPTIONS if 'bubblevisoption' not in session: session['bubblevisoption'] = constants.DEFAULT_BUBBLEVIZ_OPTIONS labels = fileManager.getActiveLabels() return render_template('viz.html', JSONObj="", labels=labels) if request.method == "POST": # "POST" request occur when html form is submitted (i.e. 'Get Dendrogram', 'Download...') labels = fileManager.getActiveLabels() JSONObj = utility.generateJSONForD3(fileManager, mergedSet=True) session_manager.cacheCloudOption() session_manager.cacheBubbleVizOption() # return render_template('viz.html', JSONObj=JSONObj, labels=labels, loading='loading') return render_template('viz.html', JSONObj=JSONObj, labels=labels)
def multicloud(): """ Handles the functionality on the multicloud pages. Note: Returns a response object (often a render_template call) to flask and eventually to the browser. """ fileManager = managers.utility.loadFileManager() if request.method == 'GET': # 'GET' request occurs when the page is first loaded. if 'cloudoption' not in session: session['cloudoption'] = constants.DEFAULT_CLOUD_OPTIONS if 'multicloudoptions' not in session: session['multicloudoptions'] = constants.DEFAULT_MULTICLOUD_OPTIONS labels = fileManager.getActiveLabels() return render_template('multicloud.html', jsonStr="", labels=labels) if request.method == "POST": # 'POST' request occur when html form is submitted (i.e. 'Get Graphs', 'Download...') labels = fileManager.getActiveLabels() JSONObj = utility.generateMCJSONObj(fileManager) session_manager.cacheCloudOption() session_manager.cacheMultiCloudOptions() # return render_template('multicloud.html', JSONObj=JSONObj, labels=labels, loading='loading') return render_template('multicloud.html', JSONObj=JSONObj, labels=labels)
def wordcloud(): """ Handles the functionality on the visualisation page -- a prototype for displaying single word cloud graphs. Note: Returns a response object (often a render_template call) to flask and eventually to the browser. """ fileManager = managers.utility.loadFileManager() labels = fileManager.getActiveLabels() if request.method == "GET": # "GET" request occurs when the page is first loaded. if 'cloudoption' not in session: session['cloudoption'] = constants.DEFAULT_CLOUD_OPTIONS # there is no wordcloud option so we don't initialize that return render_template('wordcloud.html', labels=labels) if request.method == "POST": # "POST" request occur when html form is submitted (i.e. 'Get Dendrogram', 'Download...') JSONObj = utility.generateJSONForD3(fileManager, mergedSet=True) # Create a list of column values for the word count table from operator import itemgetter terms = sorted(JSONObj["children"], key=itemgetter('size'), reverse=True) columnValues = [] for term in terms: rows = [term["name"], term["size"]] columnValues.append(rows) session_manager.cacheCloudOption() return render_template('wordcloud.html', labels=labels, JSONObj=JSONObj, columnValues=columnValues)