Exemplo n.º 1
0
def getDashboard(dashboardChoice, dashboardId):

    global dashboard_df
    global processedText_df
    global replacement_df
    global zoom_df

    studentmapping = [k for k, v in object['activityData']['payload'].items()]
    "Read texts from students"
    texts = [
        v['data']['text']
        for k, v in object['activityData']['payload'].items()
    ]

    "Create dataframe"
    new_df = pd.DataFrame(texts, columns=[TEXT_FIELD])

    if (dashboardChoice == 'dasbhoard1'):
        processedText_df, replacement_df, dashboard_df = get_dashboard(
            new_df, TEXT_FIELD, FASTTEXT, STOPWORDS, NB_CLUSTER,
            THRESHOLD_REPLACEMENT, SEED)
    elif (dashboardChoice == 'dasbhoard2'):
        processedText_df, replacement_df, dashboard_df = get_dashboard(
            new_df, TEXT_FIELD, FASTTEXT, STOPWORDS, NB_CLUSTER,
            THRESHOLD_REPLACEMENT, SEED, True, THRESHOLD_TAKEOUT)
    else:
        nbCluster = int(cluster)
        zoom_df = zoom_cluster(dashboard_df, nbCluster)
Exemplo n.º 2
0
    def get_context_data(self, *args, **kwargs):
        context = super(DashboardView, self).get_context_data(*args, **kwargs)
        dashboard_id = context["dashboard_id"]
        if dashboard_id:
            dashboard = get_dashboard(dashboard_id)
            context.update({"dashboard": dashboard, "color_id": self.request.session.get("color_id")})

        return context
Exemplo n.º 3
0
def click_select_button_evnt(event):
    ticker_dict = {
        "crypto": crypto_checkboxes.value,
        "index": index_checkboxes.value
    }
    #print(ticker_dict)
    panel = dashboard.get_dashboard(ticker_dict, mc_trials=30)
    panel.show()
Exemplo n.º 4
0
def statistics():
    layout = dashboard.get_dashboard()
    # grab the static resources
    js_resources = INLINE.render_js()
    css_resources = INLINE.render_css()
    # render template
    script, div = components(layout)
    return render_template('dashboard.html',
                           plot_script=script,
                           plot_div=div,
                           js_resources=js_resources,
                           css_resources=css_resources,
                           last_update=dashboard.get_last_dashboard_update())
Exemplo n.º 5
0
    def get_context_data(self, *args, **kwargs):
        context = super(DashboardView, self).get_context_data(*args, **kwargs)
        dashboard_id = context['dashboard_id']
        if dashboard_id:
            dashboard = get_dashboard(dashboard_id)
            context.update(
                {'dashboard': dashboard,
                'short_url': dashboard.short_url,
                'color_id': self.request.session.get("color_id")
                }
            )

        return context
Exemplo n.º 6
0
    def post(self, request):
        #Create new canvas
        username = request.POST['username']
        color_id = request.POST['color_id']
        dashboard_id = request.POST.get('dashboard_id', None)
        if not dashboard_id:
            dashboard = Dashboard(username)
            dashboard_id = dashboard.dashboard_id
        else:
            dashboard = get_dashboard(dashboard_id)
            if dashboard:
            	dashboard_id = dashboard.dashboard_id
            else:
            	dashboard = Dashboard(username)
                dashboard_id = dashboard.dashboard_id
        dashboard.add_buddy(Buddy(username, color_id))
        dashboard.save()

        request.session["color_id"] = color_id
        return redirect(dashboard.get_absolute_url())
Exemplo n.º 7
0
    def post(self, request):
        # Create new canvas
        username = request.POST["username"]
        color_id = request.POST["color_id"]
        dashboard_id = request.POST.get("dashboard_id", None)
        if not dashboard_id:
            dashboard = Dashboard(username)
            dashboard_id = dashboard.dashboard_id
        else:
            dashboard = get_dashboard(dashboard_id)
            if dashboard:
                dashboard_id = dashboard.dashboard_id
            else:
                dashboard = Dashboard(username)
                dashboard_id = dashboard.dashboard_id
        dashboard.add_buddy(Buddy(username, color_id))
        dashboard.save()

        request.session["color_id"] = color_id
        # Notify all clients of new user
        return redirect(dashboard.get_absolute_url())
Exemplo n.º 8
0
 def get(self, request):
     dashboard_id = request.GET.get("dashboard_id")
     dashboard = get_dashboard(dashboard_id)
     buddies = [{"username": b.username, "color_id": b.color_id} for b in dashboard.buddies]
     return HttpResponse(json.dumps({"buddies": buddies}), mimetype="application/json")
Exemplo n.º 9
0
def indicator_button(event):
    indicator_dict = {"indicator": indicator_checkboxes}
    panel = dashboard.get_dashboard(indicator_dict)
    panel.show()