Пример #1
0
def main():
    # point to database
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')

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

    # process all files found ind folder "directory"
    for path in paths:
        process_file(conn, path)

    sql.close_connection(conn)
    print("done")
Пример #2
0
def main():
    # generate paths
    DATABASE_LOCATION = os.path.join(get_config()['jwql_dir'], 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_database.db')

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

    # process every csv file in directory folder
    for path in paths:
        process_file(conn, path)

    # close connection
    sql.close_connection(conn)
    print("done")
Пример #3
0
def data_trending_dashboard(start=default_start, end=now):
    """Builds 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_LOCATION = os.path.join(PACKAGE_DIR, 'database')
    DATABASE_FILE = os.path.join(DATABASE_LOCATION, 'miri_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 = fpe_plots(conn, start, end)
    tab4 = temperature_plots(conn, start, end)
    tab5 = bias_plots(conn, start, end)
    tab6 = wheel_ratios(conn, start, end)

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

    # return dashboard to web app
    script, div = components(tabs)
    plot_data = [div, script]

    # close sql connection
    sql.close_connection(conn)

    return plot_data, variables