aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/traits.py
diff options
context:
space:
mode:
authorAlexander Kabui2021-04-05 14:34:01 +0300
committerAlexander Kabui2021-04-05 14:34:01 +0300
commita301093ce9ea825606db29bd1f1f40e1971897dd (patch)
tree10f0ee83b127a5cb907eb66dfe9955b44a0cd105 /gn3/api/traits.py
parent2301b11e8a975f2e6dc7e5144e4b26c34b186501 (diff)
downloadgenenetwork3-a301093ce9ea825606db29bd1f1f40e1971897dd.tar.gz
fix for fetching dataset traits data
Diffstat (limited to 'gn3/api/traits.py')
-rw-r--r--gn3/api/traits.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/gn3/api/traits.py b/gn3/api/traits.py
index a9ff906..758dcca 100644
--- a/gn3/api/traits.py
+++ b/gn3/api/traits.py
@@ -7,6 +7,8 @@ from flask import request
from gn3.computations.traits import fetch_trait
from gn3.computations.traits import get_trait_info_data
+from gn3.experimental_db import database_connector
+
trait = Blueprint("trait", __name__)
@@ -18,14 +20,23 @@ def home():
@trait.route("/<string:trait_name>/<string:dataset_name>")
def create_trait(trait_name, dataset_name):
- """endpoints for creating trait first should\
- call the endpoint for creating the trait only\
- also acts as endpoints for fetching trait data"""
-
- trait_dataset = mock.Mock() # xtodo should replace this with calling epoints
- trait_dataset.name = dataset_name
-
- trait_results = fetch_trait(dataset=trait_dataset, trait_name=trait_name)
+ """/test:trait_name/dataset_name/type :retrieve sample\
+ data for trait"""
+
+ # xtodo replace the object at most this endpoint
+ # requires dataset_type,dataset_name ,dataset_id
+ trait_dataset = {
+ "name": dataset_name,
+ "id": 12,
+ "type": "ProbeSet" # temp values
+ }
+ conn, _cursor = database_connector()
+
+ trait_results = fetch_trait(dataset=trait_dataset,
+ trait_name=trait_name,
+ database=conn)
+
+ conn.close()
return jsonify(trait_results)