def update_file_usage_chart(jsonified_df, association=None, course_id=None, month=None): if jsonified_df is None: raise PreventUpdate else: df = chart_helper.decode_json_df(jsonified_df) if (course_id == None) and (association == None): fig = chart_helper.make_aggregate_data_usage_chart( df, association, course_id, month) return fig elif (association != None) and (course_id == None): filtered_df = df[df["association"] == association] fig = chart_helper.make_data_bar_chart_facetted_by( filtered_df, "course_id", association, course_id, month) return fig elif association == None and course_id != None: raise PreventUpdate else: # NOTE: need to use bitwise operator with pandas (can't use And or Or) filt = (df["association"] == association) & (df["course_id"] == course_id) filtered_df = df[filt] fig = chart_helper.make_data_bar_chart_facetted_by( filtered_df, "paper_id", association, course_id, month) return fig
def update_data_chart_course_filter(association, jsonified_data_usage_df): if (jsonified_data_usage_df is None): raise PreventUpdate else: df = chart_helper.decode_json_df(jsonified_data_usage_df) options = chart_helper.get_course_filter_options(df, association) return options
def update_login_chart_on_filter_change(jsonified_df, association, status, chart_type, frequency, month): if jsonified_df is None: print("Nothing to show for!") raise PreventUpdate else: df = chart_helper.decode_json_df(jsonified_df) #print(df.head()) if (association == None): if (status == None): fig = chart_helper.make_login_chart(df, month, frequency=frequency[0], chart_type=chart_type) #print(fig.data) return fig else: fig = chart_helper.make_login_chart(df, month, status=status, frequency=frequency[0], chart_type=chart_type) #print(fig.data) return fig else: if (status == None): fig = chart_helper.make_login_chart(df, month, association=association, frequency=frequency[0], chart_type=chart_type) #print(fig.data) return fig else: fig = chart_helper.make_login_chart(df, month, association, status, frequency=frequency[0], chart_type=chart_type) #print(fig.data) return fig
def update_file_usage_chart(jsonified_data_usage_df, association=None, course_id=None, month=None): df = chart_helper.decode_json_df(jsonified_data_usage_df) if (course_id == None) & (association == None): fig = chart_helper.make_aggregate_data_usage_chart( df, association, course_id, month) return fig elif (association != None) & (course_id == None): filtered_df = df[df['association'] == association] fig = chart_helper.make_data_bar_chart_facetted_by( filtered_df, 'course_id', association, course_id, month) return fig else: filt = (df['association'] == association) & (df['course_id'] == course_id) filtered_df = df[filt] fig = chart_helper.make_data_bar_chart_facetted_by( filtered_df, 'paper_id', association, course_id, month) return fig