Ejemplo n.º 1
0
def data_trending_dashboard(start=default_start, end=now):
    """Bulilds dashboard
    Parameters
    ----------
    start : time
        configures start time for query and visualisation
    end : time
        configures end time for query and visualisation
    Return
    ------
    plot_data : list
        A list containing the JavaScript and HTML content for the dashboard
    variables : dict
        no use
    """

    # connect to database
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'nirspec_database.db')

    conn = sql.create_connection(DATABASE_FILE)

    # some variables can be passed to the template via following
    variables = dict(init=1)

    # some variables can be passed to the template via following
    variables = dict(init=1)

    # add tabs to dashboard
    tab1 = power_plots(conn, start, end)
    tab2 = volt_plots(conn, start, end)
    tab3 = temperature_plots(conn, start, end)
    tab4 = msa_mce_plots(conn, start, end)
    tab5 = fpe_fpa_plots(conn, start, end)
    tab6 = caa_plots(conn, start, end)
    tab7 = wheel_pos(conn, start, end)

    # build dashboard
    tabs = Tabs(tabs=[tab1, tab2, tab3, tab4, tab5, tab6, tab7])
    # tabs = Tabs( tabs=[ tab1, tab7] )

    # return dasboard to webapp
    script, div = components(tabs)
    plot_data = [div, script]

    # close sql connection
    sql.close_connection(conn)

    return plot_data, variables
Ejemplo n.º 2
0
def main():
    # generate paths
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'nirspec_database.db')

    # connect to temporary database
    conn = sql.create_connection(DATABASE_FILE)

    # do for every file in list above
    for path in filenames:
        process_file(conn, path)

    # close connection
    sql.close_connection(conn)
    print("done")