Ejemplo n.º 1
0
def explore_data(project_id, dataset_id):
    if not current_user.is_authenticated:
        print('not logged in')
        return redirect(url_for('login'))

    content = None
    data = None
    data = Project.from_user(current_user.user_id)
    if Project.check_auth(current_user.user_id, int(project_id)):
        project_specific_data = Project.get_one(current_user.user_id,
                                                int(project_id))

    table_data, titles, numerical_vals = Analysis.get_coloums_stat(
        app.config['UPLOAD_FOLDER'] + 'dataset/' + dataset_id)

    try:
        # try to match the pages defined in -> pages/<input file>
        return render_template('pages/explore_data.html',
                               data=data,
                               project_specific_data=project_specific_data,
                               numerical_vals=numerical_vals,
                               table_data=table_data,
                               titles=titles,
                               active_dataset=dataset_id)

    except:

        return render_template('pages/error-404.html')
Ejemplo n.º 2
0
def dataset_raw_data(project_id, dataset_id):
    """
    RAW Data exploaration\n
    Allows an ADMIN user to explore user dataset
    through its dashboard and see all the raw not pruned data
    user login status. If dataset not found then redirect 404.\n\n

    method: GET\n

    API/URL must be accessed with GET request and supply project_id and dataset_id in the URL\n

    Args:
        project_id (str): ID of the poject need to be sent in url. It is made to do so via Front end href
        dataset_id (str): ID of the dataset need to be sent in url. It is made to do so via Frontend href

    Returns:
        view: A flask view for the raw data html

    """
    if not current_user.is_authenticated:
        print('not logged in')
        return redirect(url_for('login'))

    content = None
    data = None
    data = Project.from_user(current_user.user_id)
    if Project.check_auth(current_user.user_id, int(project_id)):
        project_specific_data = Project.get_one(current_user.user_id,
                                                int(project_id))
        print(project_specific_data)

    table_html, titles = Analysis.get_data_head(app.config['UPLOAD_FOLDER'] +
                                                'dataset/' + dataset_id)

    try:
        # try to match the pages defined in -> pages/<input file>
        return render_template('pages/raw_data.html',
                               data=data,
                               project_specific_data=project_specific_data,
                               tables=table_html,
                               titles=titles,
                               active_dataset=dataset_id)

    except:

        return render_template('pages/error-404.html')