aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/datasets.py
blob: d15aad7edf678e48e4bdb13b3f0619e3cad552fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""this module contains code for creating datasets"""
from flask import Blueprint
from flask import jsonify

from gn3.computations.datasets import create_dataset


dataset = Blueprint("dataset", __name__)


@dataset.route("/")
def dataset_home():
    """initial test endpont for dataset"""
    return jsonify({"results": "ok"})


@dataset.route("/create/<dataset_name>/")
@dataset.route("/create/<dataset_name>/<dataset_type>")
def create_dataset_api(dataset_name, dataset_type=None):
    """Test api/create/dataset/<dataset_name>/<dataset_type>"""

    new_dataset = create_dataset(
        dataset_type=dataset_type, dataset_name=dataset_name)

    results = {
        "dataset": new_dataset
    }
    return jsonify(results)


@dataset.route("/fetch_traits_data/<dataset_name>/<dataset_type>")
def fetch_traits_data(dataset_name, dataset_type):
    """endpoints fetches sample for each trait in\
    a dataset"""
    # what actually brings speed issues in correlation
    _query_values = dataset_name, dataset_type

    return jsonify({})