Exemplo n.º 1
0
def updateDataTable(data):
    try:
        df = hf.string_to_df(data).iloc[::-1]
        data_table = hf.generate_data_table_information(df)
        return data_table[0], data_table[1]
    except:
        raise PreventUpdate
Exemplo n.º 2
0
def campus_graphs(data, active_tab):
    try:
        # Converting string to data frame
        return tab_content(hf.string_to_df(data), active_tab)

    except Exception as e:
        print('Campus Graph: ', e)
        raise PreventUpdate
Exemplo n.º 3
0
def create_general_graphs(data, graph_type):
    df = hf.string_to_df(data)
    prediction_df = pd.read_sql_table('prediction', con=db.engine)
    df['dates'] = df['dates'].apply(lambda date: datetime.strptime(date, "%B %d %Y"))

    location_list = hf.get_daily_cases_by_location(hf.get_df_by_location(df))
    prediction_list = hf.get_prediction_by_location(prediction_df)

    return dict(data=gg.generate_daily_bar_graph(location_list),
                layout=gg.generate_bar_layout('Daily Cases on USF Campuses', 'group')), \
           dict(data=gg.generate_total_scatter(graph_type, location_list, prediction_list),
                layout=gg.general_graph_layout('Total Cases USF Campuses'))
Exemplo n.º 4
0
def update_cards(data):
    df = hf.string_to_df(data)

    dfs_by_location = hf.get_df_by_location(df)
    total_cases_tampa, total_cases_st_pete, total_cases_health = hf.get_total_cases_by_location(dfs_by_location)
    daily_cases_tampa, daily_cases_st_pete, daily_cases_tampa_health = hf.get_daily_cases_by_location(
        dfs_by_location)

    return str(total_cases_tampa), \
           str(total_cases_health), \
           str(total_cases_st_pete), \
           hf.create_daily_cases_str(daily_cases_tampa), \
           hf.create_daily_cases_str(daily_cases_tampa_health), \
           hf.create_daily_cases_str(daily_cases_st_pete), \
Exemplo n.º 5
0
def updateCards(data):
    try:
        df = hf.string_to_df(data)

        # Get for each location
        dfByLocation = hf.get_df_by_location(df)

        # Get total cases for each location
        totalCasesTampa, totalCasesStPete, totalCasesHealth, totalCasesSarasota = hf.get_total_cases_by_location(
            dfByLocation)

        # Get daily cases for each location
        dailyCasesTampa, dailyCasesStPete, dailyCasesHealth, dailyCasesSarasota = hf.get_daily_cases_by_location(
            dfByLocation)

        return totalCasesTampa + ' cases', totalCasesHealth + ' cases',totalCasesStPete + ' cases',\
            hf.create_daily_cases_string(dailyCasesTampa), hf.create_daily_cases_string(dailyCasesHealth),\
            hf.create_daily_cases_string(dailyCasesStPete), totalCasesSarasota + ' cases',\
            hf.create_daily_cases_string(dailyCasesSarasota)

    except Exception as e:
        print('updateCards: ', e)
        raise PreventUpdate
Exemplo n.º 6
0
def update_data_table(data):
    df = hf.string_to_df(data)
    data_table = hf.generate_data_table(df)
    return data_table[0], data_table[1]
Exemplo n.º 7
0
def campus_graphs(data, active_tab):
    return tab_content(hf.string_to_df(data), active_tab)