aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/datasets.py28
-rw-r--r--gn3/experimental_db.py11
2 files changed, 39 insertions, 0 deletions
diff --git a/gn3/api/datasets.py b/gn3/api/datasets.py
new file mode 100644
index 0000000..874c76a
--- /dev/null
+++ b/gn3/api/datasets.py
@@ -0,0 +1,28 @@
+"""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)
diff --git a/gn3/experimental_db.py b/gn3/experimental_db.py
new file mode 100644
index 0000000..c928265
--- /dev/null
+++ b/gn3/experimental_db.py
@@ -0,0 +1,11 @@
+"""this function contains experimental db staff"""
+from typing import Tuple
+import MySQLdb as mdb # type: ignore
+
+
+def database_connector()->Tuple:
+ """function to create db connector"""
+ conn = mdb.connect("local", "kabui", "1234", "db_webqtl")
+ cursor = conn.cursor()
+
+ return (conn, cursor)