From 99833c77e1bd3d207ba671fd9b1e209f33d83d95 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Thu, 28 Jan 2021 13:44:48 +0200
Subject: [PATCH 01/30] Added some demo algorithm property files.

---
 .../crossvalidation/crossvalidation.json      | 39 ++++++++++++
 algorithms/test/test.json                     | 60 +++++++++++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 algorithms/crossvalidation/crossvalidation.json
 create mode 100644 algorithms/test/test.json

diff --git a/algorithms/crossvalidation/crossvalidation.json b/algorithms/crossvalidation/crossvalidation.json
new file mode 100644
index 00000000..28667e52
--- /dev/null
+++ b/algorithms/crossvalidation/crossvalidation.json
@@ -0,0 +1,39 @@
+{
+    "name": "crossvalidation",
+    "desc": "This is the cross validation tool.",
+    "label": "Cross Validation",
+    "enabled": true,
+    "parameters": {
+        "modelparams":{
+            "my_enum_param": {
+                "label": "Some param",
+                "desc": "Example of parameter with enumerations.",
+                "type": "text",
+                "enums": ["a", "b", "c"],
+                "default": "a",
+                "notblank": true,
+                "multiple": false
+            },
+            "my_int_param": {
+                "label": "Some param",
+                "desc": "Example of integer param.",
+                "type": "int",
+                "default": 4,
+                "min": 2,
+                "max": 4,
+                "notblank": true,
+                "multiple": false
+            },
+            "list_param": {
+                "label": "Some param",
+                "desc": "Example of list of floats param.",
+                "type": "real",
+                "default": [0.8, 0.95],
+                "min": 0.0,
+                "max": 1.0,
+                "notblank": true,
+                "multiple": true
+            }
+        }
+    }
+}
diff --git a/algorithms/test/test.json b/algorithms/test/test.json
new file mode 100644
index 00000000..64ebd836
--- /dev/null
+++ b/algorithms/test/test.json
@@ -0,0 +1,60 @@
+{
+    "name": "test",
+    "desc": "This is a test algorithm.",
+    "label": "TEST",
+    "enabled": true,
+    "parameters": {
+        "dataparams": {
+            "x": {
+                "label": "features",
+                "desc": "Features used in my algorithm.",
+                "types": ["real", "int", "text"],
+                "stattypes": ["numerical", "nomimal"],
+                "notblank": true,
+                "multiple": true
+            },
+            "y": {
+                "label": "target",
+                "desc": "Target variable for my algorithm.",
+                "types": ["text", "int"],
+                "stattypes": ["nominal"],
+                "enumslen": 2,
+                "notblank": true,
+                "multiple": false
+            }
+        },
+        "modelparams":{
+            "my_enum_param": {
+                "label": "Some param",
+                "desc": "Example of parameter with enumerations.",
+                "type": "text",
+                "enums": ["a", "b", "c"],
+                "default": "a",
+                "notblank": true,
+                "multiple": false
+            },
+            "my_int_param": {
+                "label": "Some param",
+                "desc": "Example of integer param.",
+                "type": "int",
+                "default": 4,
+                "min": 2,
+                "max": 4,
+                "notblank": true,
+                "multiple": false
+            },
+            "list_param": {
+                "label": "Some param",
+                "desc": "Example of list of floats param.",
+                "type": "real",
+                "default": [0.8, 0.95],
+                "min": 0.0,
+                "max": 1.0,
+                "notblank": true,
+                "multiple": true
+            }
+        },
+        "formula": true,
+        "crossvalidation": true
+    }
+}
-- 
GitLab


From 38045d7d870f0dcae1496aa3168f1a6a9108cf4f Mon Sep 17 00:00:00 2001
From: jason <40263717+jassak@users.noreply.github.com>
Date: Thu, 28 Jan 2021 14:27:09 +0200
Subject: [PATCH 02/30] Example of crossvalidation.json

We start with a few parameters:
- type is in the type of CV, possible types can be "k_fold" and "leave_dataset_out" (for the begining)
- nsplits is the number of splits (valid for k_fold CV)
- metrics are the CV metrics to compute, possible values will be determined later
---
 .../crossvalidation/crossvalidation.json      | 35 +++----------------
 1 file changed, 4 insertions(+), 31 deletions(-)

diff --git a/algorithms/crossvalidation/crossvalidation.json b/algorithms/crossvalidation/crossvalidation.json
index 28667e52..6c9bf3f9 100644
--- a/algorithms/crossvalidation/crossvalidation.json
+++ b/algorithms/crossvalidation/crossvalidation.json
@@ -1,39 +1,12 @@
 {
     "name": "crossvalidation",
-    "desc": "This is the cross validation tool.",
+    "desc": "Module for performing cross validation on supervised learning models.",
     "label": "Cross Validation",
     "enabled": true,
     "parameters": {
-        "modelparams":{
-            "my_enum_param": {
-                "label": "Some param",
-                "desc": "Example of parameter with enumerations.",
-                "type": "text",
-                "enums": ["a", "b", "c"],
-                "default": "a",
-                "notblank": true,
-                "multiple": false
-            },
-            "my_int_param": {
-                "label": "Some param",
-                "desc": "Example of integer param.",
-                "type": "int",
-                "default": 4,
-                "min": 2,
-                "max": 4,
-                "notblank": true,
-                "multiple": false
-            },
-            "list_param": {
-                "label": "Some param",
-                "desc": "Example of list of floats param.",
-                "type": "real",
-                "default": [0.8, 0.95],
-                "min": 0.0,
-                "max": 1.0,
-                "notblank": true,
-                "multiple": true
-            }
+        "type": "k_fold",
+        "nsplits": 10,
+        "metrics": ["precision", "recall", "auc", "roc", "confusion_matrix", "f1_score"]
         }
     }
 }
-- 
GitLab


From c48c4c6ca491e8b729031be52211b192f997d7c9 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 29 Jan 2021 12:22:33 +0200
Subject: [PATCH 03/30] Added test algorithm property files.

---
 .../crossvalidation/crossvalidation.json      | 61 ++++++------
 algorithms/test/test.json                     | 96 +++++++++----------
 2 files changed, 77 insertions(+), 80 deletions(-)

diff --git a/algorithms/crossvalidation/crossvalidation.json b/algorithms/crossvalidation/crossvalidation.json
index 28667e52..2eadad9f 100644
--- a/algorithms/crossvalidation/crossvalidation.json
+++ b/algorithms/crossvalidation/crossvalidation.json
@@ -1,39 +1,36 @@
 {
     "name": "crossvalidation",
-    "desc": "This is the cross validation tool.",
+    "desc": "Module for performing cross validation on supervised learning models.",
     "label": "Cross Validation",
     "enabled": true,
     "parameters": {
-        "modelparams":{
-            "my_enum_param": {
-                "label": "Some param",
-                "desc": "Example of parameter with enumerations.",
-                "type": "text",
-                "enums": ["a", "b", "c"],
-                "default": "a",
-                "notblank": true,
-                "multiple": false
-            },
-            "my_int_param": {
-                "label": "Some param",
-                "desc": "Example of integer param.",
-                "type": "int",
-                "default": 4,
-                "min": 2,
-                "max": 4,
-                "notblank": true,
-                "multiple": false
-            },
-            "list_param": {
-                "label": "Some param",
-                "desc": "Example of list of floats param.",
-                "type": "real",
-                "default": [0.8, 0.95],
-                "min": 0.0,
-                "max": 1.0,
-                "notblank": true,
-                "multiple": true
-            }
+        "type": {
+            "label": "Type of cross-validation",
+            "desc": "Type of cross-validation",
+            "type": "text",
+            "enums": ["k_fold", "leave_dataset_out"],
+            "default": "k_fold",
+            "notblank": true,
+            "multiple": false
+        }, 
+        "nsplits": {
+            "label": "Number of splits",
+            "desc": "Number of splits",
+            "type": "int",
+            "min": 2,
+            "max": 20,
+            "default": 5,
+            "notblank": true,
+            "multiple": false
+        },
+        "metrics": {
+            "label": "Metrics",
+            "desc": "Cross-validation metrics.",
+            "type": "text",
+            "enums": ["precision", "recall", "auc", "roc", "confusion_matrix", "f1_score"],
+            "default": null,
+            "notblank": true,
+            "multiple": true
         }
     }
-}
+}
\ No newline at end of file
diff --git a/algorithms/test/test.json b/algorithms/test/test.json
index 64ebd836..0def7444 100644
--- a/algorithms/test/test.json
+++ b/algorithms/test/test.json
@@ -3,57 +3,57 @@
     "desc": "This is a test algorithm.",
     "label": "TEST",
     "enabled": true,
+    "inputdata": {
+        "x": {
+            "label": "features",
+            "desc": "Features used in my algorithm.",
+            "types": ["real", "int", "text"],
+            "stattypes": ["numerical", "nomimal"],
+            "notblank": true,
+            "multiple": true
+        },
+        "y": {
+            "label": "target",
+            "desc": "Target variable for my algorithm.",
+            "types": ["text", "int"],
+            "stattypes": ["nominal"],
+            "enumslen": 2,
+            "notblank": true,
+            "multiple": false
+        }
+    },
     "parameters": {
-        "dataparams": {
-            "x": {
-                "label": "features",
-                "desc": "Features used in my algorithm.",
-                "types": ["real", "int", "text"],
-                "stattypes": ["numerical", "nomimal"],
-                "notblank": true,
-                "multiple": true
-            },
-            "y": {
-                "label": "target",
-                "desc": "Target variable for my algorithm.",
-                "types": ["text", "int"],
-                "stattypes": ["nominal"],
-                "enumslen": 2,
-                "notblank": true,
-                "multiple": false
-            }
+        "my_enum_param": {
+            "label": "Some param",
+            "desc": "Example of parameter with enumerations.",
+            "type": "text",
+            "enums": ["a", "b", "c"],
+            "default": "a",
+            "notblank": true,
+            "multiple": false
         },
-        "modelparams":{
-            "my_enum_param": {
-                "label": "Some param",
-                "desc": "Example of parameter with enumerations.",
-                "type": "text",
-                "enums": ["a", "b", "c"],
-                "default": "a",
-                "notblank": true,
-                "multiple": false
-            },
-            "my_int_param": {
-                "label": "Some param",
-                "desc": "Example of integer param.",
-                "type": "int",
-                "default": 4,
-                "min": 2,
-                "max": 4,
-                "notblank": true,
-                "multiple": false
-            },
-            "list_param": {
-                "label": "Some param",
-                "desc": "Example of list of floats param.",
-                "type": "real",
-                "default": [0.8, 0.95],
-                "min": 0.0,
-                "max": 1.0,
-                "notblank": true,
-                "multiple": true
-            }
+        "my_int_param": {
+            "label": "Some param",
+            "desc": "Example of integer param.",
+            "type": "int",
+            "default": 4,
+            "min": 2,
+            "max": 4,
+            "notblank": true,
+            "multiple": false
         },
+        "list_param": {
+            "label": "Some param",
+            "desc": "Example of list of floats param.",
+            "type": "real",
+            "default": [0.8, 0.95],
+            "min": 0.0,
+            "max": 1.0,
+            "notblank": true,
+            "multiple": true
+        }
+    },
+    "flags": {
         "formula": true,
         "crossvalidation": true
     }
-- 
GitLab


From b30e167ba263bea1eb2af232ee6839939d178b26 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 29 Jan 2021 15:24:51 +0200
Subject: [PATCH 04/30] Updated the interface yml with cross validation. When
 an algorithm has crossvalidation enabled, there will be an extra parameter
 (crossvalidation) containing the crossvalidation parameters.

---
 .../design_docs/MIP_Engine_Interface.yml      | 226 +++++++-----------
 1 file changed, 86 insertions(+), 140 deletions(-)

diff --git a/documentation/design_docs/MIP_Engine_Interface.yml b/documentation/design_docs/MIP_Engine_Interface.yml
index c0b3cdbe..2f31263b 100644
--- a/documentation/design_docs/MIP_Engine_Interface.yml
+++ b/documentation/design_docs/MIP_Engine_Interface.yml
@@ -59,109 +59,7 @@ components:
                     "name": "ALGORITHMNAME",
                     "desc": "This is an example algorithm.",
                     "label": "My Algorithm",
-                    "parameters": {
-                        "dataparams": {
-                            "pathology": {
-                                "label": "Pathology of the data.",
-                                "desc": "The pathology that the algorithm will run on.",
-                                "types": ["text"],
-                                "notblank": true,
-                                "multiple": false
-                            },
-                            "dataset": {
-                                "label": "Set of data to use.",
-                                "desc": "The set of data to run the algorithm on.",
-                                "types": ["text"],
-                                "notblank": true,
-                                "multiple": true
-                            },
-                            "filter": {
-                                "label": "Filter on the data.",
-                                "desc": "Features used in my algorithm.",
-                                "types": ["json"],
-                                "notblank": false,
-                                "multiple": false
-                            },
-                            "x": {
-                                "label": "features",
-                                "desc": "Features used in my algorithm.",
-                                "types": ["real", "int", "text"],
-                                "stattypes": ["numerical", "nomimal"],
-                                "notblank": true,
-                                "multiple": true
-                            },
-                            "y": {
-                                "label": "target",
-                                "desc": "Target variable for my algorithm.",
-                                "types": ["text", "int"],
-                                "stattypes": ["nominal"],
-                                "enumslen": 2,
-                                "notblank": true,
-                                "multiple": false
-                            }
-                        },
-                        "modelparams":{
-                            "my_enum_param": {
-                                "label": "Some param",
-                                "desc": "Example of parameter with enumerations.",
-                                "type": "text",
-                                "inputtype": "dropdown",
-                                "enums": ["a", "b", "c"],
-                                "default": "a",
-                                "notblank": true,
-                                "multiple": false
-                            },
-                            "my_int_param": {
-                                "label": "Some param",
-                                "desc": "Example of integer param.",
-                                "type": "int",
-                                "default": 4,
-                                "min": 2,
-                                "max": 4,
-                                "notblank": true,
-                                "multiple": false
-                            },
-                            "list_param": {
-                                "label": "Some param",
-                                "desc": "Example of list of floats param.",
-                                "type": "real",
-                                "default": [0.8, 0.95],
-                                "min": 0.0,
-                                "max": 1.0,
-                                "notblank": true,
-                                "multiple": true
-                            }
-                        },
-                        "formula": true,
-                        "crossvalidation": true
-                    }
-                }
-      type: object
-      required:
-        - name
-        - desc
-        - label
-        - enabled
-        - parameters
-      properties:
-        name:
-          type: string
-        desc:
-          type: string
-        label:
-          type: string
-        enabled:
-          type: boolean
-        parameters:
-          type: object
-          properties:
-            schema:
-              $ref: '#/components/schemas/AlgorithmParameters'
-          
-    AlgorithmParameters:
-      description: All the details and properties that specify an algorithm
-      example: {
-                    "dataparams": {
+                    "inputdata": {
                         "pathology": {
                             "label": "Pathology of the data.",
                             "desc": "The pathology that the algorithm will run on.",
@@ -186,7 +84,7 @@ components:
                         "x": {
                             "label": "features",
                             "desc": "Features used in my algorithm.",
-                            "types": ["real", "int", "text"],
+                            "types": ["int", "real", "text"],
                             "stattypes": ["numerical", "nomimal"],
                             "notblank": true,
                             "multiple": true
@@ -201,12 +99,11 @@ components:
                             "multiple": false
                         }
                     },
-                    "modelparams":{
+                    "parameters": {
                         "my_enum_param": {
                             "label": "Some param",
                             "desc": "Example of parameter with enumerations.",
                             "type": "text",
-                            "inputtype": "dropdown",
                             "enums": ["a", "b", "c"],
                             "default": "a",
                             "notblank": true,
@@ -233,36 +130,72 @@ components:
                             "multiple": true
                         }
                     },
-                    "formula": true,
-                    "crossvalidation": true
+                    "crossvalidation": {
+                        "name": "crossvalidation",
+                        "desc": "Module for performing cross validation on supervised learning models.",
+                        "label": "Cross Validation",
+                        "parameters": {
+                            "type": {
+                                "label": "Type of cross-validation",
+                                "desc": "Type of cross-validation",
+                                "type": "text",
+                                "enums": ["k_fold", "leave_dataset_out"],
+                                "default": "k_fold",
+                                "notblank": true,
+                                "multiple": false
+                            }, 
+                            "nsplits": {
+                                "label": "Number of splits",
+                                "desc": "Number of splits",
+                                "type": "int",
+                                "min": 2,
+                                "max": 20,
+                                "default": 5,
+                                "notblank": true,
+                                "multiple": false
+                            },
+                            "metrics": {
+                                "label": "Metrics",
+                                "desc": "Cross-validation metrics.",
+                                "type": "text",
+                                "enums": ["precision", "recall", "auc", "roc", "confusion_matrix", "f1_score"],
+                                "default": null,
+                                "notblank": true,
+                                "multiple": true
+                            }
+                        }
+                    }
                 }
       type: object
       required:
-        - dataparams
-        - modelparams
-        - formula
-        - crossvalidation
+        - name
+        - desc
+        - label
+        - parameters
       properties:
-        dataparams:
+        name:
+          type: string
+        desc:
+          type: string
+        label:
+          type: string
+        inputdata:
           type: object
-          description: Input parameters describing the data used to fit a statistical/ML model.
           properties:
             schema:
-              $ref: '#/components/schemas/AlgorithmDataParameters'
-        modelparams:
+              $ref: '#/components/schemas/AlgorithmInputData'
+        parameters:
           type: object
-          description: Additional input parameters controlling the fitting process.
           properties:
             schema:
-              $ref: '#/components/schemas/AlgorithmModelParameters'
-        formula:
-          type: boolean
-          description: defines if the algorithm can accept formula as input
+              $ref: '#/components/schemas/AlgorithmParameters'
         crossvalidation:
-          type: boolean
-          description: defines if the algorithm can be cross validated
-
-    AlgorithmDataParameters:
+          type: object
+          properties:
+            schema:
+              $ref: '#/components/schemas/Algorithm'
+              
+    AlgorithmInputData:
       description: Input parameters describing the data used to fit a statistical/ML model.
       example: {
                     "pathology": {
@@ -282,7 +215,7 @@ components:
                     "filter": {
                         "label": "Filter on the data.",
                         "desc": "Features used in my algorithm.",
-                        "types": ["json"],
+                        "types": ["jsonObject"],
                         "notblank": false,
                         "multiple": false
                     },
@@ -326,7 +259,7 @@ components:
                 - 'int'
                 - 'real'
                 - 'text'
-                - 'json'
+                - 'jsonObject'
           stattypes:
             type: array
             items:
@@ -341,8 +274,8 @@ components:
           enumslen:
             type: integer
 
-    AlgorithmModelParameters:
-      description: Additional input parameters controlling the fitting process.
+    AlgorithmParameters:
+      description: Algorithm parameters controlling the fitting process.
       example: {
                     "my_enum_param": {
                         "label": "Some param",
@@ -416,31 +349,34 @@ components:
     AlgorithmRequestBody:
       description: The request body of the call to run an algorithm.
       example: {
-                    "dataparams": {
+                    "inputdata": {
                         "pathology": "dementia",
                         "dataset": ["adni", "ppmi"],
                         "filter": {},
                         "x": ["lefthippocampus", "righthippocampus"],
                         "y": ["alzheimerbroadcategory"]
                     },
-                    "modelparams": {
+                    "parameters": {
                         "my_enum_param": "a",
                         "my_int_param": 3,
                         "list_param": [0.8, 0.95]
                     },
-                    "formula": "alzheimerbroadcategory ~ lefthippocampus : righthippocampus",
                     "crossvalidation": {
-                        "my_crossvalidation_param1": "a",
-                        "my_crossvalidation_param2": 3
+                        "type": "k_fold",
+                        "nsplits": 10,
+                        "metrics": ["precision","confusion_matrix"]
                     }
                 }
       type: object
       required:
-        - dataparams
+        - inputdata
       properties:
-        dataparams:    
+        inputdata:    
           description: a dictionairy of parameters relative to the datasets
           type: object
+          required:
+            - pathology
+            - dataset
           properties:
             pathology:
               type: string
@@ -459,7 +395,7 @@ components:
             filter:
               type: object
               description: A jquery builder object, https://querybuilder.js.org/demo.html , using the x and y variables given.
-        modelparams:
+        parameters:
           description: a dictionairy of parameters relative to the algorithm
           type: object
           additionalProperties:
@@ -469,12 +405,22 @@ components:
               - type: number
               - type: boolean
               - type: array
-        formula:
-          type: string
-          description: Patsy formula (https://patsy.readthedocs.io/en/v0.1.0/formulas.html)
         crossvalidation:
           description: a dictionairy of parameters relative to the cross validation of the algorithm
           type: object
+          required:
+            - type
+            - nsplits
+            - metrics
+          properties:
+            type:
+              type: string
+            nsplits:
+              type: integer
+            metrics:
+              type: array
+              items:
+                type: string
 
     AlgorithmResult:
       description: The result of an algorithm execution. A dictionairy of the available visualization types, containing a list of the different visualizations. Possible MIMETypes here https://redmine.hbpmip.link/issues/186
-- 
GitLab


From 0a0aef1691f5d0e03e2de4f7631ad583a96e7902 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Mon, 1 Feb 2021 20:25:29 +0200
Subject: [PATCH 05/30] Implemented the GET /algorithms.

---
 __init__.py                                   |   0
 .../crossvalidation.json                      |   0
 algorithms/{test => }/test.json               |   2 +-
 controller/__init__.py                        |   0
 controller/algorithms.py                      | 117 ++++++++++++++++++
 controller/api/DTOs.py                        | 113 +++++++++++++++++
 controller/api/__init__.py                    |   0
 controller/api/api_controller.py              |  19 +++
 controller/requirements.txt                   |   3 +
 controller/utils.py                           |   7 ++
 .../design_docs/MIP_Engine_Interface.yml      |  11 +-
 11 files changed, 266 insertions(+), 6 deletions(-)
 create mode 100644 __init__.py
 rename algorithms/{crossvalidation => }/crossvalidation.json (100%)
 rename algorithms/{test => }/test.json (96%)
 create mode 100644 controller/__init__.py
 create mode 100644 controller/algorithms.py
 create mode 100644 controller/api/DTOs.py
 create mode 100644 controller/api/__init__.py
 create mode 100644 controller/api/api_controller.py
 create mode 100644 controller/requirements.txt
 create mode 100644 controller/utils.py

diff --git a/__init__.py b/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/algorithms/crossvalidation/crossvalidation.json b/algorithms/crossvalidation.json
similarity index 100%
rename from algorithms/crossvalidation/crossvalidation.json
rename to algorithms/crossvalidation.json
diff --git a/algorithms/test/test.json b/algorithms/test.json
similarity index 96%
rename from algorithms/test/test.json
rename to algorithms/test.json
index 0def7444..56f66d28 100644
--- a/algorithms/test/test.json
+++ b/algorithms/test.json
@@ -8,7 +8,7 @@
             "label": "features",
             "desc": "Features used in my algorithm.",
             "types": ["real", "int", "text"],
-            "stattypes": ["numerical", "nomimal"],
+            "stattypes": ["numerical", "nominal"],
             "notblank": true,
             "multiple": true
         },
diff --git a/controller/__init__.py b/controller/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/algorithms.py b/controller/algorithms.py
new file mode 100644
index 00000000..6b38f88a
--- /dev/null
+++ b/controller/algorithms.py
@@ -0,0 +1,117 @@
+import json
+import logging
+import os
+from dataclasses import dataclass, asdict
+from pprint import pprint
+from typing import List, Dict, Optional, Any
+
+from dataclasses_json import dataclass_json
+
+from controller.utils import Singleton
+
+RELATIVE_ALGORITHMS_PATH = "../../algorithms"
+CROSSVALIDATION_ALGORITHM_NAME = "crossvalidation"
+
+
+@dataclass_json
+@dataclass
+class InputDataParameter:
+    label: str
+    desc: str
+    types: List[str]
+    stattypes: List[str]
+    notblank: bool
+    multiple: bool
+    enumslen: Optional[int] = None
+
+    def __init__(self, label, desc, types, stattypes, notblank, multiple, enumslen):
+        self.label = label
+        self.desc = desc
+        self.notblank = notblank
+        self.multiple = multiple
+
+        allowed_types = ["real", "int", "text", "boolean"]
+        if not all(elem in allowed_types for elem in types):
+            raise ValueError(f"Input data types can include: {allowed_types}")
+        self.types = types
+
+        allowed_stattypes = ["numerical", "nominal"]
+        if not all(elem in allowed_stattypes for elem in stattypes):
+            raise ValueError(f"Input data stattypes can include: {allowed_stattypes}")
+        self.stattypes = stattypes
+
+        self.enumslen = enumslen
+
+
+@dataclass_json
+@dataclass
+class GenericParameter:
+    label: str
+    desc: str
+    type: str
+    notblank: bool
+    multiple: bool
+    # TODO Not working with Any directly
+    default: Any
+    enums: Optional[List[Any]] = None
+    min: Optional[int] = None
+    max: Optional[int] = None
+
+    def __init__(self, label, desc, type, default, notblank, multiple, enums, min, max):
+        self.label = label
+        self.desc = desc
+        self.default = default
+        self.notblank = notblank
+        self.multiple = multiple
+        self.enums = enums
+        self.min = min
+        self.max = max
+
+        allowed_types = ["real", "int", "text", "boolean"]
+        if type not in allowed_types:
+            raise ValueError(f"Generic parameter type can be one of the following: {allowed_types}")
+        self.type = type
+
+
+@dataclass_json
+@dataclass
+class Algorithm:
+    name: str
+    desc: str
+    label: str
+    enabled: bool
+    inputdata: Optional[Dict[str, InputDataParameter]] = None
+    parameters: Optional[Dict[str, GenericParameter]] = None
+    flags: Optional[Dict[str, bool]] = None
+
+
+class Algorithms(metaclass=Singleton):
+    crossvalidation: Algorithm
+    available: Dict[str, Algorithm]
+
+    def __init__(self):
+        algorithm_property_paths = [os.path.join(RELATIVE_ALGORITHMS_PATH, json_file)
+                                    for json_file in os.listdir(RELATIVE_ALGORITHMS_PATH)
+                                    if json_file.endswith('.json')]
+
+        all_algorithms = {}
+        for algorithm_property_path in algorithm_property_paths:
+            try:
+                algorithm = Algorithm.from_json(open(algorithm_property_path).read())
+            except Exception as e:
+                logging.error(f"Parsing property file: {algorithm_property_path}")
+                raise e
+            all_algorithms[algorithm.name] = algorithm
+
+        self.available = {
+            algorithm.name: algorithm
+            for algorithm in all_algorithms.values()
+            if algorithm.enabled and algorithm.name != CROSSVALIDATION_ALGORITHM_NAME}
+
+        self.crossvalidation = None
+        if (CROSSVALIDATION_ALGORITHM_NAME in all_algorithms.keys() and
+                all_algorithms[CROSSVALIDATION_ALGORITHM_NAME].enabled):
+            self.crossvalidation = all_algorithms[CROSSVALIDATION_ALGORITHM_NAME]
+
+
+Algorithms()
diff --git a/controller/api/DTOs.py b/controller/api/DTOs.py
new file mode 100644
index 00000000..bab03956
--- /dev/null
+++ b/controller/api/DTOs.py
@@ -0,0 +1,113 @@
+from dataclasses import dataclass
+from typing import List, Optional, Dict
+
+from controller.algorithms import GenericParameter, Algorithm, CROSSVALIDATION_ALGORITHM_NAME
+
+
+@dataclass
+class InputDataParameterDTO:
+    """
+    InputDataParameterDTO is different from the InputDataParameter
+    on the stattypes field.
+    It is optional on the DTO, due to the dataset and pathology parameters.
+    """
+    label: str
+    desc: str
+    types: List[str]
+    notblank: bool
+    multiple: bool
+    stattypes: Optional[List[str]] = None
+    enumslen: Optional[int] = None
+
+
+def get_pathology_parameter():
+    return InputDataParameterDTO(
+        "Pathology of the data.",
+        "The pathology that the algorithm will run on.",
+        ["text"],
+        True,
+        False,
+        None,
+        None,
+    )
+
+
+def get_dataset_parameter():
+    return InputDataParameterDTO(
+        "Set of data to use.",
+        "The set of data to run the algorithm on.",
+        ["text"],
+        True,
+        True,
+        None,
+        None,
+    )
+
+
+def get_filter_parameter():
+    return InputDataParameterDTO(
+        "Filter on the data.",
+        "Features used in my algorithm.",
+        ["jsonObject"],
+        False,
+        False,
+        None,
+        None,
+    )
+
+
+@dataclass
+class CrossValidationAlgorithmDTO:
+    """
+    CrossValidationAlgorithmDTO is different from the Algorithm class
+    because it doesn't have the enabled flag and the name.
+    """
+    desc: str
+    label: str
+    parameters: Optional[Dict[str, GenericParameter]] = None
+
+
+@dataclass
+class AlgorithmDTO:
+    """
+    AlgorithmDTO is different from the Algorithm class
+    because it doesn't have the enabled flag and
+    the crossvalidation algorithm is nested, not a flag.
+    """
+    name: str
+    desc: str
+    label: str
+    inputdata: Optional[Dict[str, InputDataParameterDTO]] = None
+    parameters: Optional[Dict[str, GenericParameter]] = None
+    crossvalidation: Optional[CrossValidationAlgorithmDTO] = None
+
+    def __init__(self, algorithm: Algorithm, crossvalidation: Algorithm):
+        self.name = algorithm.name
+        self.desc = algorithm.desc
+        self.label = algorithm.label
+        self.parameters = algorithm.parameters
+        self.inputdata = {name: InputDataParameterDTO(
+            parameter.label,
+            parameter.desc,
+            parameter.types,
+            parameter.notblank,
+            parameter.multiple,
+            parameter.stattypes,
+            parameter.enumslen,
+        )
+            for name, parameter in algorithm.inputdata.items()
+        }
+
+        # Adding the 3 "system" input data parameters
+        self.inputdata["pathology"] = get_pathology_parameter()
+        self.inputdata["dataset"] = get_dataset_parameter()
+        self.inputdata["filter"] = get_filter_parameter()
+
+        # Adding the crossvalidation algorithm as a nested algorithm
+        if (CROSSVALIDATION_ALGORITHM_NAME in algorithm.flags.keys()
+                and algorithm.flags[CROSSVALIDATION_ALGORITHM_NAME]):
+            self.crossvalidation = CrossValidationAlgorithmDTO(
+                crossvalidation.desc,
+                crossvalidation.label,
+                crossvalidation.parameters,
+            )
diff --git a/controller/api/__init__.py b/controller/api/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/api/api_controller.py b/controller/api/api_controller.py
new file mode 100644
index 00000000..3fd4a2e2
--- /dev/null
+++ b/controller/api/api_controller.py
@@ -0,0 +1,19 @@
+import json
+from dataclasses import asdict
+
+from quart import Quart
+
+from DTOs import AlgorithmDTO
+from controller.algorithms import Algorithms
+
+app = Quart(__name__)
+
+
+@app.route("/algorithms")
+async def get_algorithms() -> str:
+    algorithm_DTOs = [asdict(AlgorithmDTO(algorithm, Algorithms().crossvalidation))
+                      for algorithm in Algorithms().available.values()]
+
+    # return algorithm_DTOs[0].to_json()
+    return json.dumps(algorithm_DTOs)
+    # return AlgorithmDTO.schema().dumps(algorithm_DTOs, many=True)
diff --git a/controller/requirements.txt b/controller/requirements.txt
new file mode 100644
index 00000000..a24db43f
--- /dev/null
+++ b/controller/requirements.txt
@@ -0,0 +1,3 @@
+quart==0.14.1
+dataclasses_json==0.5.2
+
diff --git a/controller/utils.py b/controller/utils.py
new file mode 100644
index 00000000..3776cb92
--- /dev/null
+++ b/controller/utils.py
@@ -0,0 +1,7 @@
+class Singleton(type):
+    _instances = {}
+
+    def __call__(cls, *args, **kwargs):
+        if cls not in cls._instances:
+            cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
+        return cls._instances[cls]
diff --git a/documentation/design_docs/MIP_Engine_Interface.yml b/documentation/design_docs/MIP_Engine_Interface.yml
index 2f31263b..77a868b0 100644
--- a/documentation/design_docs/MIP_Engine_Interface.yml
+++ b/documentation/design_docs/MIP_Engine_Interface.yml
@@ -171,7 +171,8 @@ components:
         - name
         - desc
         - label
-        - parameters
+        - notblank
+        - multiple
       properties:
         name:
           type: string
@@ -244,7 +245,7 @@ components:
           - label
           - desc
           - types
-          - notBlank
+          - notblank
           - multiple
         properties:
           label:
@@ -267,7 +268,7 @@ components:
               enum:
                 - 'numerical'
                 - 'nominal'
-          notBlank:
+          notblank:
             type: boolean
           multiple:
             type: boolean
@@ -316,7 +317,7 @@ components:
           - desc
           - type
           - default
-          - notBlank
+          - notblank
           - multiple
         properties:
           label:
@@ -337,7 +338,7 @@ components:
               - type: number
               - type: boolean
               - type: array
-          notBlank:
+          notblank:
             type: boolean
           multiple:
             type: boolean
-- 
GitLab


From 01eb63b9598cbbf3a288fd4fef8f81e80e1d0300 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Tue, 2 Feb 2021 17:56:56 +0200
Subject: [PATCH 06/30] API GET /algorithms fixes. 1) 'typing.Any' added
 instead of Any to solve the to_json not working bug. 2) Running the 
 remove_null_values method before returning the algorithms. 3) Changed the
 __init__ method of the dataclasses to __post_init__.

---
 controller/algorithms.py         | 37 +++++++-------------------------
 controller/api/DTOs.py           |  5 +++++
 controller/api/api_controller.py |  9 ++------
 controller/utils.py              | 14 ++++++++++++
 4 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/controller/algorithms.py b/controller/algorithms.py
index 6b38f88a..86eeddc3 100644
--- a/controller/algorithms.py
+++ b/controller/algorithms.py
@@ -1,8 +1,7 @@
-import json
 import logging
 import os
-from dataclasses import dataclass, asdict
-from pprint import pprint
+import typing
+from dataclasses import dataclass
 from typing import List, Dict, Optional, Any
 
 from dataclasses_json import dataclass_json
@@ -24,23 +23,14 @@ class InputDataParameter:
     multiple: bool
     enumslen: Optional[int] = None
 
-    def __init__(self, label, desc, types, stattypes, notblank, multiple, enumslen):
-        self.label = label
-        self.desc = desc
-        self.notblank = notblank
-        self.multiple = multiple
-
+    def __post_init__(self):
         allowed_types = ["real", "int", "text", "boolean"]
-        if not all(elem in allowed_types for elem in types):
+        if not all(elem in allowed_types for elem in self.types):
             raise ValueError(f"Input data types can include: {allowed_types}")
-        self.types = types
 
         allowed_stattypes = ["numerical", "nominal"]
-        if not all(elem in allowed_stattypes for elem in stattypes):
+        if not all(elem in allowed_stattypes for elem in self.stattypes):
             raise ValueError(f"Input data stattypes can include: {allowed_stattypes}")
-        self.stattypes = stattypes
-
-        self.enumslen = enumslen
 
 
 @dataclass_json
@@ -51,26 +41,15 @@ class GenericParameter:
     type: str
     notblank: bool
     multiple: bool
-    # TODO Not working with Any directly
-    default: Any
+    default: 'typing.Any'
     enums: Optional[List[Any]] = None
     min: Optional[int] = None
     max: Optional[int] = None
 
-    def __init__(self, label, desc, type, default, notblank, multiple, enums, min, max):
-        self.label = label
-        self.desc = desc
-        self.default = default
-        self.notblank = notblank
-        self.multiple = multiple
-        self.enums = enums
-        self.min = min
-        self.max = max
-
+    def __post_init__(self):
         allowed_types = ["real", "int", "text", "boolean"]
-        if type not in allowed_types:
+        if self.type not in allowed_types:
             raise ValueError(f"Generic parameter type can be one of the following: {allowed_types}")
-        self.type = type
 
 
 @dataclass_json
diff --git a/controller/api/DTOs.py b/controller/api/DTOs.py
index bab03956..2e045f92 100644
--- a/controller/api/DTOs.py
+++ b/controller/api/DTOs.py
@@ -1,9 +1,12 @@
 from dataclasses import dataclass
 from typing import List, Optional, Dict
 
+from dataclasses_json import dataclass_json
+
 from controller.algorithms import GenericParameter, Algorithm, CROSSVALIDATION_ALGORITHM_NAME
 
 
+@dataclass_json
 @dataclass
 class InputDataParameterDTO:
     """
@@ -56,6 +59,7 @@ def get_filter_parameter():
     )
 
 
+@dataclass_json
 @dataclass
 class CrossValidationAlgorithmDTO:
     """
@@ -67,6 +71,7 @@ class CrossValidationAlgorithmDTO:
     parameters: Optional[Dict[str, GenericParameter]] = None
 
 
+@dataclass_json
 @dataclass
 class AlgorithmDTO:
     """
diff --git a/controller/api/api_controller.py b/controller/api/api_controller.py
index 3fd4a2e2..3a5f9304 100644
--- a/controller/api/api_controller.py
+++ b/controller/api/api_controller.py
@@ -1,6 +1,3 @@
-import json
-from dataclasses import asdict
-
 from quart import Quart
 
 from DTOs import AlgorithmDTO
@@ -11,9 +8,7 @@ app = Quart(__name__)
 
 @app.route("/algorithms")
 async def get_algorithms() -> str:
-    algorithm_DTOs = [asdict(AlgorithmDTO(algorithm, Algorithms().crossvalidation))
+    algorithm_DTOs = [AlgorithmDTO(algorithm, Algorithms().crossvalidation)
                       for algorithm in Algorithms().available.values()]
 
-    # return algorithm_DTOs[0].to_json()
-    return json.dumps(algorithm_DTOs)
-    # return AlgorithmDTO.schema().dumps(algorithm_DTOs, many=True)
+    return AlgorithmDTO.schema().dumps(algorithm_DTOs, many=True)
diff --git a/controller/utils.py b/controller/utils.py
index 3776cb92..8a3ac311 100644
--- a/controller/utils.py
+++ b/controller/utils.py
@@ -5,3 +5,17 @@ class Singleton(type):
         if cls not in cls._instances:
             cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
         return cls._instances[cls]
+
+
+def remove_null_values(dictionary):
+    """
+    Delete keys with the value ``None`` in a dictionary, recursively.
+
+    This alters the input so you may wish to ``copy`` the dict first.
+    """
+    for key, value in list(dictionary.items()):
+        if value is None:
+            del dictionary[key]
+        elif isinstance(value, dict):
+            remove_null_values(value)
+    return dictionary
-- 
GitLab


From d36472df3078be8bc7da388af36f955ff99adf59 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Tue, 2 Feb 2021 19:49:40 +0200
Subject: [PATCH 07/30] Added simple WorkerCatalogue.

---
 controller/config/__init__.py           |  0
 controller/config/worker_catalogue.json | 36 +++++++++++++++++++++++++
 controller/worker_catalogue.py          | 32 ++++++++++++++++++++++
 3 files changed, 68 insertions(+)
 create mode 100644 controller/config/__init__.py
 create mode 100644 controller/config/worker_catalogue.json
 create mode 100644 controller/worker_catalogue.py

diff --git a/controller/config/__init__.py b/controller/config/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/config/worker_catalogue.json b/controller/config/worker_catalogue.json
new file mode 100644
index 00000000..978f3341
--- /dev/null
+++ b/controller/config/worker_catalogue.json
@@ -0,0 +1,36 @@
+{
+  "worker1": {
+    "ip": "127.0.0.1",
+    "port": 5672,
+    "data": {
+      "dementia": [
+        "adni"
+      ]
+    }
+  },
+  "worker2": {
+    "ip": "127.0.0.1",
+    "port": 5673,
+    "data": {
+      "mentalhealth": [
+        "mentalhealth_demo"
+      ],
+      "tbi": [
+        "tbi_demo2"
+      ]
+    }
+  },
+  "worker3": {
+    "ip": "127.0.0.1",
+    "port": 5674,
+    "data": {
+      "tbi": [
+        "demo1"
+      ],
+      "dementia_longitudinal": [
+        "fake_longitudinal",
+        "alzheimer_fake_cohort"
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/controller/worker_catalogue.py b/controller/worker_catalogue.py
new file mode 100644
index 00000000..fbcfdd72
--- /dev/null
+++ b/controller/worker_catalogue.py
@@ -0,0 +1,32 @@
+import importlib.resources as pkg_resources
+import json
+from dataclasses import dataclass
+from typing import Dict, List
+
+from dataclasses_json import dataclass_json
+
+from controller import config
+from controller.utils import Singleton
+
+
+@dataclass_json
+@dataclass
+class Worker():
+    ip: str
+    port: int
+    data: Dict[str, List[str]]
+
+
+@dataclass_json
+@dataclass
+class WorkerCatalogue(metaclass=Singleton):
+    workers: Dict[str, Worker]
+
+    def __init__(self):
+        worker_catalogue_str = pkg_resources.read_text(config, 'worker_catalogue.json')
+        workers_dict: Dict[str, Worker] = json.loads(worker_catalogue_str)
+        self.workers = {worker_name: Worker.from_dict(worker_values)
+                        for worker_name, worker_values in workers_dict.items()}
+
+
+WorkerCatalogue()
-- 
GitLab


From 53058db189586cfa34227ba0dd9a3bcf43ed470a Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 3 Feb 2021 13:45:12 +0200
Subject: [PATCH 08/30] Removed uneccessary method.

---
 controller/utils.py            | 17 +++--------------
 controller/worker_catalogue.py |  2 +-
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/controller/utils.py b/controller/utils.py
index 8a3ac311..63d0d4c6 100644
--- a/controller/utils.py
+++ b/controller/utils.py
@@ -1,21 +1,10 @@
 class Singleton(type):
+    """
+    Copied from https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
+    """
     _instances = {}
 
     def __call__(cls, *args, **kwargs):
         if cls not in cls._instances:
             cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
         return cls._instances[cls]
-
-
-def remove_null_values(dictionary):
-    """
-    Delete keys with the value ``None`` in a dictionary, recursively.
-
-    This alters the input so you may wish to ``copy`` the dict first.
-    """
-    for key, value in list(dictionary.items()):
-        if value is None:
-            del dictionary[key]
-        elif isinstance(value, dict):
-            remove_null_values(value)
-    return dictionary
diff --git a/controller/worker_catalogue.py b/controller/worker_catalogue.py
index fbcfdd72..06c2d3b6 100644
--- a/controller/worker_catalogue.py
+++ b/controller/worker_catalogue.py
@@ -11,7 +11,7 @@ from controller.utils import Singleton
 
 @dataclass_json
 @dataclass
-class Worker():
+class Worker:
     ip: str
     port: int
     data: Dict[str, List[str]]
-- 
GitLab


From 727193bbe135ed6b9a1e2b0a73ab8ae51383a369 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 3 Feb 2021 17:09:25 +0200
Subject: [PATCH 09/30] Added pathologies metadata and a reader.

---
 controller/algorithms.py                      |    1 +
 controller/common_data_elements.py            |   87 +
 .../config/pathologies_metadata/dementia.json | 2435 +++++++++++++++
 .../pathologies_metadata/mentalhealth.json    | 2752 +++++++++++++++++
 .../config/pathologies_metadata/tbi.json      |  609 ++++
 5 files changed, 5884 insertions(+)
 create mode 100644 controller/common_data_elements.py
 create mode 100755 controller/config/pathologies_metadata/dementia.json
 create mode 100755 controller/config/pathologies_metadata/mentalhealth.json
 create mode 100755 controller/config/pathologies_metadata/tbi.json

diff --git a/controller/algorithms.py b/controller/algorithms.py
index 86eeddc3..4b54ed1d 100644
--- a/controller/algorithms.py
+++ b/controller/algorithms.py
@@ -8,6 +8,7 @@ from dataclasses_json import dataclass_json
 
 from controller.utils import Singleton
 
+# TODO How can we read all algorithm.json files without relative paths?
 RELATIVE_ALGORITHMS_PATH = "../../algorithms"
 CROSSVALIDATION_ALGORITHM_NAME = "crossvalidation"
 
diff --git a/controller/common_data_elements.py b/controller/common_data_elements.py
new file mode 100644
index 00000000..6d8f973c
--- /dev/null
+++ b/controller/common_data_elements.py
@@ -0,0 +1,87 @@
+import logging
+import os
+from dataclasses import dataclass, field
+from typing import List, Optional, Set, Dict
+
+from dataclasses_json import dataclass_json
+
+# TODO How can we read all algorithm.json files without relative paths?
+RELATIVE_METADATA_PATH = "config/pathologies_metadata"
+
+
+@dataclass_json
+@dataclass
+class MetadataEnumeration:
+    code: str
+    label: str
+
+
+@dataclass_json
+@dataclass
+class MetadataVariable:
+    code: str
+    sql_type: str
+    isCategorical: bool
+    enumerations: Optional[List[MetadataEnumeration]] = None
+
+    def __post_init__(self):
+        allowed_types = {"int", "real", "text"}
+        if self.sql_type not in allowed_types:
+            raise ValueError(f"Metadata sql_type can be one of the following: {allowed_types}")
+
+
+@dataclass_json
+@dataclass
+class MetadataGroup:
+    """
+    MetadataGroup is used to map the pathology metadata .json to an object.
+    """
+    code: str
+    label: str
+    variables: Optional[List[MetadataVariable]] = field(default_factory=list)
+    groups: Optional[List["MetadataGroup"]] = field(default_factory=list)
+
+
+@dataclass
+class CommonDataElement:
+    sql_type: str
+    categorical: bool
+    enumerations: Optional[Set] = None
+
+    def __init__(self, variable: MetadataVariable):
+        self.sql_type = variable.sql_type
+        self.categorical = variable.isCategorical
+        if variable.enumerations:
+            self.enumerations = {enumeration.code for enumeration in variable.enumerations}
+
+
+@dataclass
+class CommonDataElements:
+    elements: Dict[str, Dict[str, CommonDataElement]]
+
+    def __init__(self):
+
+        def iterate_metadata_groups(metadata_group: MetadataGroup) -> Dict[str, CommonDataElement]:
+            group_elements: Dict[str, CommonDataElement] = {}
+            for variable in metadata_group.variables:
+                group_elements[variable.code] = CommonDataElement(variable)
+            for sub_group in metadata_group.groups:
+                group_elements.update(iterate_metadata_groups(sub_group))
+            return group_elements
+
+        metadata_paths = [os.path.join(RELATIVE_METADATA_PATH, json_file)
+                          for json_file in os.listdir(RELATIVE_METADATA_PATH)
+                          if json_file.endswith('.json')]
+
+        self.elements = {}
+        for metadata_path in metadata_paths:
+            try:
+                pathology_metadata = MetadataGroup.from_json(open(metadata_path).read())
+                self.elements[pathology_metadata.code] = iterate_metadata_groups(pathology_metadata)
+
+            except Exception as e:
+                logging.error(f"Parsing metadata file: {metadata_path}")
+                raise e
+
+
+CommonDataElements()
diff --git a/controller/config/pathologies_metadata/dementia.json b/controller/config/pathologies_metadata/dementia.json
new file mode 100755
index 00000000..7589480b
--- /dev/null
+++ b/controller/config/pathologies_metadata/dementia.json
@@ -0,0 +1,2435 @@
+
+{
+    "variables": [
+        {
+            "isCategorical": true,
+            "code": "dataset",
+            "sql_type": "text",
+            "description": "Variable used to differentiate datasets",
+            "enumerations": [
+                {
+                    "code": "ppmi",
+                    "label": "PPMI"
+                },
+                {
+                    "code": "edsd",
+                    "label": "EDSD"
+                },
+                {
+                    "code": "desd-synthdata",
+                    "label": "DESD-synthdata"
+                },
+                {
+                    "code": "fake_longitudinal",
+                    "label": "Longitudinal"
+                }
+            ],
+            "label": "Dataset",
+            "units": "",
+            "type": "nominal",
+            "methodology": "mip-cde"
+        },
+        {
+            "isCategorical": false,
+            "code": "subjectvisitid",
+            "sql_type": "text",
+            "description": "The ID of the Patient’s Visit",
+            "label": "Visit ID",
+            "units": "",
+            "type": "text",
+            "methodology": ""
+        },
+        {
+            "isCategorical": false,
+            "code": "subjectvisitdate",
+            "sql_type": "text",
+            "description": "The date of the Patient’s Visit",
+            "label": "Visit Date",
+            "units": "",
+            "type": "date",
+            "methodology": ""
+        }
+    ],
+    "code": "dementia",
+    "groups": [
+        {
+            "variables": [
+                {
+                    "isCategorical": false,
+                    "code": "av45",
+                    "sql_type": "real",
+                    "description": "AV45 Average AV45 SUVR of frontal  anterior cingulate  precuneus  and parietal cortex\\nrelative to the cerebellum",
+                    "label": "AV45",
+                    "units": "",
+                    "type": "real",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": false,
+                    "code": "fdg",
+                    "sql_type": "real",
+                    "description": "Average FDG-PET of angular  temporal  and posterior cingulate. Most important hypometabolic regions that are indicative of pathological metabolic change in MCI and AD.",
+                    "label": "FDG-PET",
+                    "units": "",
+                    "type": "real",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": false,
+                    "code": "pib",
+                    "sql_type": "real",
+                    "description": "Average PIB SUVR of frontal cortex  anterior cingulate  precuneus cortex  and parietal cortex.",
+                    "label": "PIB",
+                    "units": "",
+                    "type": "real",
+                    "methodology": "mip-cde"
+                }
+            ],
+            "code": "pet",
+            "label": "Pet"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": false,
+                    "code": "brainstem",
+                    "sql_type": "real",
+                    "description": "Brainstem volume",
+                    "label": "Brainstem",
+                    "units": "cm3",
+                    "type": "real",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": false,
+                    "code": "tiv",
+                    "sql_type": "real",
+                    "description": "Total intra-cranial volume",
+                    "label": "TIV",
+                    "units": "cm3",
+                    "type": "real",
+                    "methodology": "mip-cde"
+                }
+            ],
+            "code": "brain_anatomy",
+            "groups": [
+                {
+                    "variables": [
+                        {
+                            "isCategorical": false,
+                            "code": "_3rdventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "3rd Ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "_4thventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "4th Ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "csfglobal",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "CSF global",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "leftinflatvent",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left inferior lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "leftlateralventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightinflatvent",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right inferior lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightlateralventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "csf_volume",
+                    "label": "Csf_volume"
+                },
+                {
+                    "code": "grey_matter_volume",
+                    "groups": [
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "cerebellarvermallobulesiv",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Cerebellar Vermal Lobules I-V",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "cerebellarvermallobulesviiix",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Cerebellar Vermal Lobules VIII-X",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "cerebellarvermallobulesvivii",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Cerebellar Vermal Lobules VI-VII",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcerebellumexterior",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Cerebellum Exterior",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcerebellumexterior",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Cerebellum Exterior",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "cerebellum",
+                            "label": "Cerebellum"
+                        },
+                        {
+                            "code": "cerebral_nuclei",
+                            "groups": [
+                                {
+                                    "variables": [
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftamygdala",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Amygdala",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightamygdala",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Amygdala",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        }
+                                    ],
+                                    "code": "amygdala",
+                                    "label": "Amygdala"
+                                },
+                                {
+                                    "variables": [
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftaccumbensarea",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Accumbens Area",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftbasalforebrain",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Basal Forebrain",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftcaudate",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Caudate",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftpallidum",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Pallidum",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftputamen",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Putamen",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightaccumbensarea",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Accumbens Area",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightbasalforebrain",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Basal Forebrain",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightcaudate",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Caudate",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightpallidum",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Pallidum",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightputamen",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Putamen",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": "mip-cde"
+                                        }
+                                    ],
+                                    "code": "basal_ganglia",
+                                    "label": "Basal_ganglia"
+                                }
+                            ],
+                            "label": "Cerebral_nuclei"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftventraldc",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Ventral DC",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightventraldc",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Ventral DC",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "diencephalon",
+                            "label": "Diencephalon"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftaorganteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left anterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcocentraloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left central operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftfofrontaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left frontal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftfrpfrontalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left frontal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftgregyrusrectus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left gyrus rectus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftlorglateralorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left lateral orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmfcmedialfrontalcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left medial frontal cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmfgmiddlefrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmorgmedialorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left medial orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmprgprecentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left precentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmsfgsuperiorfrontalgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior frontal gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftopifgopercularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left opercular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftorifgorbitalpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left orbital part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpoparietaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left parietal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftporgposteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left posterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftprgprecentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left precentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftscasubcallosalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left subcallosal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsfgsuperiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsmcsupplementarymotorcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left supplementary motor cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "lefttrifgtriangularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left triangular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightaorganteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right anterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcocentraloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right central operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightfofrontaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right frontal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightfrpfrontalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right frontal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightgregyrusrectus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right gyrus rectus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightlorglateralorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right lateral orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmfcmedialfrontalcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right medial frontal cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmfgmiddlefrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmorgmedialorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right medial orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmprgprecentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right precentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmsfgsuperiorfrontalgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior frontal gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightopifgopercularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right opercular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightorifgorbitalpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right orbital part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpoparietaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right parietal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightporgposteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right posterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightprgprecentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right precentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightscasubcallosalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right subcallosal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsfgsuperiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsmcsupplementarymotorcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right supplementary motor cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "righttrifgtriangularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right triangular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "frontal",
+                            "label": "Frontal"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftainsanteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left anterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpinsposteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left posterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightainsanteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right anterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpinsposteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right posterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "insula",
+                            "label": "Insula"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftacgganteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left anterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftententorhinalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left entorhinal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "lefthippocampus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Hippocampus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmcggmiddlecingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpcggposteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left posterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftphgparahippocampalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left parahippocampal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftthalamusproper",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Thalamus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightacgganteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right anterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightententorhinalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right entorhinal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "righthippocampus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Hippocampus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmcggmiddlecingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpcggposteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right posterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightphgparahippocampalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right parahippocampal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightthalamusproper",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Thalamus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "limbic",
+                            "label": "Limbic"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcalccalcarinecortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left calcarine cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcuncuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left cuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftioginferioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left inferior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftliglingualgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left lingual gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmogmiddleoccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftocpoccipitalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left occipital pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftofugoccipitalfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left occipital fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsogsuperioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcalccalcarinecortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right calcarine cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcuncuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right cuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightioginferioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right inferior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightliglingualgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right lingual gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmogmiddleoccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightocpoccipitalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right occipital pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightofugoccipitalfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right occipital fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsogsuperioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "occipital",
+                            "label": "Occipital"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftangangulargyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left angular gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmpogpostcentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left postcentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpcuprecuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left precuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpogpostcentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left postcentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsmgsupramarginalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left supramarginal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsplsuperiorparietallobule",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior parietal lobule",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightangangulargyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right angular gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmpogpostcentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right postcentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpcuprecuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right precuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpogpostcentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right postcentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsmgsupramarginalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right supramarginal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsplsuperiorparietallobule",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior parietal lobule",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "parietal",
+                            "label": "Parietal"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftfugfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftitginferiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left inferior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmtgmiddletemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftppplanumpolare",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left planum polare",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftptplanumtemporale",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left planum temporale",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftstgsuperiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "lefttmptemporalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left temporal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftttgtransversetemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left transverse temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightfugfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightitginferiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right inferior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmtgmiddletemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightppplanumpolare",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right planum polare",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightptplanumtemporale",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right planum temporale",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightstgsuperiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "righttmptemporalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right temporal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightttgtransversetemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right transverse temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": "mip-cde"
+                                }
+                            ],
+                            "code": "temporal",
+                            "label": "Temporal"
+                        }
+                    ],
+                    "label": "Grey_matter_volume"
+                },
+                {
+                    "variables": [
+                        {
+                            "isCategorical": false,
+                            "code": "leftcerebellumwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left Cerebellum White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "leftcerebralwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left Cerebral White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "opticchiasm",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Optic chiasm",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightcerebellumwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right Cerebellum White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightcerebralwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right Cerebral White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "white_matter_volume",
+                    "label": "White_matter_volume"
+                }
+            ],
+            "label": "Brain_anatomy"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": true,
+                    "code": "alzheimerbroadcategory",
+                    "sql_type": "text",
+                    "description": "There will be two broad categories taken into account. Alzheimer s disease (AD) in which the diagnostic is 100% certain and <Other> comprising the rest of Alzheimer s related categories. The <Other> category refers to Alzheime s related diagnosis which origin can be traced to other pathology eg. vascular. In this category MCI diagnosis can also be found. In summary  all Alzheimer s related diagnosis that are not pure.",
+                    "enumerations": [
+                        {
+                            "code": "AD",
+                            "label": "Alzheimer’s disease"
+                        },
+                        {
+                            "code": "CN",
+                            "label": "Cognitively Normal"
+                        },
+                        {
+                            "code": "Other",
+                            "label": "Other"
+                        },
+                        {
+                            "code": "MCI",
+                            "label": "Mild cognitive impairment"
+                        }
+                    ],
+                    "label": "Alzheimer Broad Category",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": true,
+                    "code": "neurodegenerativescategories",
+                    "sql_type": "text",
+                    "description": "There will be two broad categories taken into account. Parkinson s disease without disability or light disability: Without fluctuation of the effect. Dementia in Parkinson s disease",
+                    "enumerations": [
+                        {
+                            "code": "PD",
+                            "label": "Parkinson’s disease"
+                        },
+                        {
+                            "code": "AD",
+                            "label": "Alzheimer’s disease"
+                        },
+                        {
+                            "code": "HD",
+                            "label": "Huntington’s disease\""
+                        },
+                        {
+                            "code": "ALS",
+                            "label": "Amyotrophic lateral sclerosis"
+                        },
+                        {
+                            "code": "BD",
+                            "label": "Batten disease"
+                        },
+                        {
+                            "code": "MCI",
+                            "label": "MCI"
+                        },
+                        {
+                            "code": "LBD",
+                            "label": "Lewy body dementia"
+                        },
+                        {
+                            "code": "CJD",
+                            "label": "Creutzfeldt Jakob disease"
+                        },
+                        {
+                            "code": "FTD",
+                            "label": "Frontotemporal dementia"
+                        },
+                        {
+                            "code": "MS",
+                            "label": "Multiple sclerosis"
+                        },
+                        {
+                            "code": "CN",
+                            "label": "Cognitively normal"
+                        }
+                    ],
+                    "label": "Neurodegeneratives categories",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": true,
+                    "code": "parkinsonbroadcategory",
+                    "sql_type": "text",
+                    "description": "There will be two broad categories taken into account. Parkinson s disease without disability or light disability: Without fluctuation of the effect. Dementia in Parkinson s disease",
+                    "enumerations": [
+                        {
+                            "code": "PD",
+                            "label": "Dementia in Parkinson''s disease"
+                        },
+                        {
+                            "code": "CN",
+                            "label": "Healthy control"
+                        },
+                        {
+                            "code": "Other",
+                            "label": "Parkinson''s disease without disability or light disability: Without fluctuation of the effect"
+                        }
+                    ],
+                    "label": "Parkinson Broad Category",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": "mip-cde"
+                }
+            ],
+            "code": "diagnosis",
+            "groups": [
+                {
+                    "variables": [
+                        {
+                            "isCategorical": true,
+                            "code": "adnicategory",
+                            "sql_type": "text",
+                            "description": "Terms aggregating illnesses into classes. Note that the diagnosis in this categories are given only for the ADNI data set.",
+                            "enumerations": [
+                                {
+                                    "code": "AD",
+                                    "label": "Alzheimer’s Disease"
+                                },
+                                {
+                                    "code": "MCI",
+                                    "label": "Mild Cognitive Impairment"
+                                },
+                                {
+                                    "code": "CN",
+                                    "label": "Cognitively Normal"
+                                }
+                            ],
+                            "label": "ADNI category",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "edsdcategory",
+                            "sql_type": "text",
+                            "description": "Terms aggregating illnesses into classes. Note that the diagnosis in this categories are given only for the EDSD data set.",
+                            "enumerations": [
+                                {
+                                    "code": "AD",
+                                    "label": "Alzheimer’s Disease"
+                                },
+                                {
+                                    "code": "MCI",
+                                    "label": "Mild Cognitive Impairment"
+                                },
+                                {
+                                    "code": "CN",
+                                    "label": "Cognitively Normal"
+                                }
+                            ],
+                            "label": "EDSD category",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "ppmicategory",
+                            "sql_type": "text",
+                            "description": "Terms aggregating the Parkinson s diseases into classes. For this instance the diagnosis given at enrollment is taken as the clinical diagnosis. Note that the diagnosis in this categories are given only for the PPMI data set.",
+                            "enumerations": [
+                                {
+                                    "code": "PD",
+                                    "label": "Parkinson disease"
+                                },
+                                {
+                                    "code": "HC",
+                                    "label": "Healthy controls"
+                                },
+                                {
+                                    "code": "PRODROMA",
+                                    "label": "Prodromal"
+                                },
+                                {
+                                    "code": "GENPD",
+                                    "label": "Genetic PD patients with a mutation (LRRK2, GBA or SNCA)"
+                                },
+                                {
+                                    "code": "REGUN",
+                                    "label": "Genetic Unaffected patients with a mutation (LRRK2, GBA or SNCA)"
+                                },
+                                {
+                                    "code": "REGPD",
+                                    "label": "Genetic registry PD subjects with a mutation (LRRK2, GBA or SNCA)"
+                                }
+                            ],
+                            "label": "PPMI category",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "dataset_specific_diagnosis",
+                    "label": "Dataset_specific_diagnosis"
+                },
+                {
+                    "variables": [
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_etiology_1",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:etiology:1",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_etiology_2",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:etiology:2",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_etiology_3",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:etiology:3",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_lng",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:lng",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_lngapp",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:lngapp",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_stade",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:stade",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_stademin",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:stademin",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_syndamn",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:syndamn",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_syndoth",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:syndoth",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "DIAG_syndr",
+                            "sql_type": "text",
+                            "description": "",
+                            "label": "DIAG:syndr",
+                            "units": "",
+                            "type": "text",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "bna",
+                    "label": "Bna"
+                }
+            ],
+            "label": "Diagnosis"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": false,
+                    "minValue": 0,
+                    "code": "minimentalstate",
+                    "maxValue": 30,
+                    "sql_type": "int",
+                    "description": "The Mini Mental State Examination (MMSE) or Folstein test is a 30-point questionnaire that is used extensively in clinical and research settings to measure cognitive impairment. It is commonly used to screen for dementia.",
+                    "label": "MMSE Total scores",
+                    "units": "",
+                    "type": "integer",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": false,
+                    "minValue": 0,
+                    "code": "montrealcognitiveassessment",
+                    "maxValue": 30,
+                    "sql_type": "int",
+                    "description": "The Montreal Cognitive Assessment (MoCA) was designed as a rapid screening instrument for mild cognitive dysfunction. It assesses different cognitive domains: attention and concentration  executive functions  memory  language  visuoconstructional skills  conceptual thinking  calculations  and orientation. MoCA Total Scores refer to the final count obtained by patients after the complete test is performed.",
+                    "label": "MoCA Total",
+                    "units": "",
+                    "type": "integer",
+                    "methodology": "mip-cde"
+                }
+            ],
+            "code": "neuropsychology",
+            "groups": [
+                {
+                    "variables": [
+                        {
+                            "isCategorical": true,
+                            "code": "updrshy",
+                            "sql_type": "text",
+                            "description": "The Hoehn and Yahr scale (HY) is a widely used clinical rating scale  which defines broad categories of motor function in Parkinson\\u2019s disease (PD). It captures typical patterns of progressive motor impairment.",
+                            "enumerations": [
+                                {
+                                    "code": "1",
+                                    "label": "Unilateral involvement only usually with minimal or no functional disability"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "Bilateral or midline involvement without impairment of balance"
+                                },
+                                {
+                                    "code": "3",
+                                    "label": "Bilateral disease: mild to moderate disability with impaired postural reflexes; physically independent"
+                                },
+                                {
+                                    "code": "4",
+                                    "label": "Severely disabling disease; still able to walk or stand unassisted"
+                                },
+                                {
+                                    "code": "5",
+                                    "label": "Confinement to bed or wheelchair unless aided"
+                                }
+                            ],
+                            "label": "UPDRS HY",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "minValue": 0,
+                            "code": "updrstotal",
+                            "maxValue": 172,
+                            "sql_type": "int",
+                            "description": "The unified Parkinson s disease rating scale (UPDRS) is used to follow the longitudinal course of Parkinson s disease. The UPD rating scale is the most commonly used scale in the clinical study of Parkinson s disease.",
+                            "label": "UPDRS Total",
+                            "units": "",
+                            "type": "integer",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "updrs",
+                    "label": "Updrs"
+                }
+            ],
+            "label": "Neuropsychology"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": true,
+                    "code": "agegroup",
+                    "sql_type": "text",
+                    "description": "Age Group",
+                    "enumerations": [
+                        {
+                            "code": "-50y",
+                            "label": "-50y"
+                        },
+                        {
+                            "code": "50-59y",
+                            "label": "50-59y"
+                        },
+                        {
+                            "code": "60-69y",
+                            "label": "60-69y"
+                        },
+                        {
+                            "code": "70-79y",
+                            "label": "70-79y"
+                        },
+                        {
+                            "code": "+80y",
+                            "label": "+80y"
+                        }
+                    ],
+                    "label": "agegroup",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": true,
+                    "code": "gender",
+                    "sql_type": "text",
+                    "description": "Gender of the patient - Sex assigned at birth",
+                    "enumerations": [
+                        {
+                            "code": "M",
+                            "label": "Male"
+                        },
+                        {
+                            "code": "F",
+                            "label": "Female"
+                        }
+                    ],
+                    "label": "Gender",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": true,
+                    "code": "handedness",
+                    "sql_type": "text",
+                    "description": "Describes the tendency of the patient to use either the right or the left hand more naturally than the other.",
+                    "enumerations": [
+                        {
+                            "code": "R",
+                            "label": "Right"
+                        },
+                        {
+                            "code": "L",
+                            "label": "Left"
+                        },
+                        {
+                            "code": "A",
+                            "label": "Ambidextrous"
+                        }
+                    ],
+                    "label": "Handedness",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": false,
+                    "minValue": 0,
+                    "code": "subjectage",
+                    "maxValue": 130,
+                    "sql_type": "real",
+                    "description": "Exact age of the subject  for datasets that allow such precision.",
+                    "label": "Exact age",
+                    "units": "years",
+                    "type": "real",
+                    "methodology": "mip-cde"
+                },
+                {
+                    "isCategorical": false,
+                    "minValue": 0,
+                    "code": "subjectageyears",
+                    "maxValue": 130,
+                    "sql_type": "int",
+                    "description": "Subject age in years.",
+                    "label": "Age Years",
+                    "units": "years",
+                    "type": "integer",
+                    "methodology": "mip-cde"
+                }
+            ],
+            "code": "demographics",
+            "label": "Demographics"
+        },
+        {
+            "code": "genetic",
+            "groups": [
+                {
+                    "variables": [
+                        {
+                            "isCategorical": true,
+                            "code": "apoe4",
+                            "sql_type": "text",
+                            "description": "Apolipoprotein E (APOE) e4 allele: is the strongest risk factor for Late Onset Alzheimer Disease (LOAD). At least one copy of APOE-e4 ",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "ApoE4",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs10498633_t",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs10498633_T",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs11136000_t",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs11136000_T",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs11767557_c",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs11767557_C",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs1476679_c",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs1476679_C",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs17125944_c",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs17125944_C",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs190982_g",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs190982_G",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs2718058_g",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs2718058_G",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs3764650_g",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs3764650_G",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs3818361_t",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs3818361_T",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs3851179_a",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs3851179_A",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs3865444_t",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs3865444_T",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs610932_a",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs610932_A",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": true,
+                            "code": "rs744373_c",
+                            "sql_type": "text",
+                            "description": "",
+                            "enumerations": [
+                                {
+                                    "code": "0",
+                                    "label": "0"
+                                },
+                                {
+                                    "code": "1",
+                                    "label": "1"
+                                },
+                                {
+                                    "code": "2",
+                                    "label": "2"
+                                }
+                            ],
+                            "label": "rs744373_C",
+                            "units": "",
+                            "type": "nominal",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "polymorphism",
+                    "label": "Polymorphism"
+                }
+            ],
+            "label": "Genetic"
+        },
+        {
+            "code": "proteome",
+            "groups": [
+                {
+                    "variables": [
+                        {
+                            "isCategorical": false,
+                            "code": "ab1_42",
+                            "sql_type": "real",
+                            "description": "A\\u03b2 is the main component of amyloid plaques (extracellular deposits found in the brains of patients with Alzheimer’s disease). Similar plaques appear in some variants of Lewy body dementia and in inclusion body myositis (a muscle disease), while A\\u03b2 can also form the aggregates that coat cerebral blood vessels in cerebral amyloid angiopathy. The plaques are composed of a tangle of regularly ordered fibrillar aggregates called amyloid fibers, a protein fold shared by other peptides such as the prions associated with protein misfolding diseases.",
+                            "label": "Level of amyloid beta 1-42 peptides in cerebrospinal fluid",
+                            "units": "",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "ab1_40",
+                            "sql_type": "real",
+                            "description": "A\\u03b2 is the main component of amyloid plaques (extracellular deposits found in the brains of patients with Alzheimer's disease). Similar plaques appear in some variants of Lewy body dementia and in inclusion body myositis (a muscle disease), while A\\u03b2 can also form the aggregates that coat cerebral blood vessels in cerebral amyloid angiopathy. The plaques are composed of a tangle of regularly ordered fibrillar aggregates called amyloid fibers, a protein fold shared by other peptides such as the prions associated with protein misfolding diseases.",
+                            "label": "Level od amyloid beta 1-40 peptides ion cerebrospinal fluid",
+                            "units": "",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "t_tau",
+                            "sql_type": "real",
+                            "description": "Tau proteins (or \\u03c4 proteins) are proteins that stabilize microtubules. They are abundant in neurons of the central nervous system and are less common elsewhere, but are also expressed at very low levels in CNS astrocytes and oligodendrocytes. Pathologies and dementias of the nervous system such as Alzheimer’s disease and Parkinson’s disease are associated with tau proteins that have become defective and no longer stabilize microtubules properly.",
+                            "label": "Total level of tau proteins in cerebrospinal fluid",
+                            "units": "",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "p_tau",
+                            "sql_type": "real",
+                            "description": "Hyperphosphorylation of the tau protein (tau inclusions, pTau) can result in the self-assembly of tangles of paired helical filaments and straight filaments, which are involved in the pathogenesis of Alzheimer's disease, frontotemporal dementia, and other tauopathies.",
+                            "label": "Level of phosphorylated tau proteins in cerebrospinal fluid",
+                            "units": "",
+                            "type": "real",
+                            "methodology": "mip-cde"
+                        }
+                    ],
+                    "code": "csf_proteome",
+                    "label": "Csf_proteome"
+                }
+            ],
+            "label": "Proteome"
+        }
+    ],
+    "label": "Dementia"
+}
diff --git a/controller/config/pathologies_metadata/mentalhealth.json b/controller/config/pathologies_metadata/mentalhealth.json
new file mode 100755
index 00000000..7fa9d70f
--- /dev/null
+++ b/controller/config/pathologies_metadata/mentalhealth.json
@@ -0,0 +1,2752 @@
+{
+    "variables": [
+        {
+            "isCategorical": true,
+            "code": "dataset",
+            "sql_type": "text",
+            "description": "",
+            "enumerations": [
+                {
+                    "code": "demo",
+                    "label": "Demo"
+                }
+            ],
+            "label": "dataset",
+            "units": "",
+            "type": "nominal",
+            "methodology": ""
+        }
+    ],
+    "code": "mentalhealth",
+    "groups": [
+        {
+            "variables": [
+                {
+                    "isCategorical": true,
+                    "code": "sex",
+                    "sql_type": "text",
+                    "description": "gender of the subject",
+                    "enumerations": [
+                        {
+                            "code": "1",
+                            "label": "male"
+                        },
+                        {
+                            "code": "2",
+                            "label": "female"
+                        },
+                        {
+                            "code": "3",
+                            "label": "other"
+                        }
+                    ],
+                    "label": "sex",
+                    "units": "none",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "handedness",
+                    "sql_type": "text",
+                    "description": "handedness of the subject",
+                    "enumerations": [
+                        {
+                            "code": "right",
+                            "label": "right handed"
+                        },
+                        {
+                            "code": "left",
+                            "label": "left handed"
+                        },
+                        {
+                            "code": "unknown",
+                            "label": "unknown"
+                        }
+                    ],
+                    "label": "handedness",
+                    "units": "none",
+                    "type": "nominal",
+                    "methodology": ""
+                }
+            ],
+            "code": "demographic",
+            "label": "Demographic"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": true,
+                    "code": "A1a",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to mother",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1b",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to father",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1c",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to another mother figure",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1d",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to another father figure",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1e",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to one or more grandparents",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1f",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to one or more other adult relatives",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1g",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to childminder, nanny, au pair",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1h",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to one or more teachers",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1i",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to one or more adult non-relatives",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1k",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to one or more brothers, sisters or other young relatives",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A1l",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no or not applicable"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Special attachment to one or more friends",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A2",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Concern about separation over the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3a",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Concern about loss of, or harm of attachment figures over the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3b",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Unrealistic concern about being taken away from attachment figures over the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3c",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Not wanting to go to school due to fear of harm to attachment figure while at school in the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3d",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Concern about sleeping alone in the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3e",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Sleeping with or checking on attachment figures at night in the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3f",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Concern about sleeping in a strange place in the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3g",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Afraid of being alone at home for the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3h",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Nightmares about separation from attachment figures in the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3i",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Somatic symptoms linked to separations in the past 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A3j",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no more than others (or not applicable)"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little more than others"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot more than others"
+                        }
+                    ],
+                    "label": "Anticipatory anxiety of separations",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A4",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Presence of separation worries for at least 4 weeks",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": false,
+                    "code": "A5",
+                    "sql_type": "real",
+                    "description": "",
+                    "label": "Age of onset",
+                    "units": "",
+                    "type": "real",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A6",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Distress due to these worries",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A7a",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Impact on family life",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A7b",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Impact on frienships",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A7c",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Impact on learning or class work",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A7d",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Impact on leisure",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "A8",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Worries leading to burden on others",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                }
+            ],
+            "code": "separation_anxiety",
+            "label": "Separation_anxiety"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": true,
+                    "code": "B1a",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of animals",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1b",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of some aspects of the natural environment (e.g. storms, thunder, heights or water)",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1c",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of the dark",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1d",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of loud noises",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1e",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of blood - injection - injury",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1f",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of dentists or doctors",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1g",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of vomitting, choking or getting particular diseases",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1h",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of using particular types of transport",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1i",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of small enclosed spaces",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1j",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear od using the toilet",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1k",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear od specific types of people, e.g. clowns",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B1l",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Fear of imaginary or supernatural things",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": false,
+                    "code": "B1m",
+                    "sql_type": "text",
+                    "description": "",
+                    "label": "Any other specific fear (Describe)",
+                    "units": "",
+                    "type": "text",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B2",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "perhaps"
+                        },
+                        {
+                            "code": "2",
+                            "label": "definitely"
+                        }
+                    ],
+                    "label": "Fear is a nuisance to person or others",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B3",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "less than 1 month"
+                        },
+                        {
+                            "code": "1",
+                            "label": "1-5 months"
+                        },
+                        {
+                            "code": "2",
+                            "label": "6 months or more"
+                        }
+                    ],
+                    "label": "Duration in months",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B4",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Anxiety or very upset when fear is triggered",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B5",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "yes"
+                        }
+                    ],
+                    "label": "Upset every time confronted with fears",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B6",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "every now and then"
+                        },
+                        {
+                            "code": "1",
+                            "label": "most weeks"
+                        },
+                        {
+                            "code": "2",
+                            "label": "most days"
+                        },
+                        {
+                            "code": "3",
+                            "label": "many times a day"
+                        }
+                    ],
+                    "label": "How often is fear triggered",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B7",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Avoidance of the phobic stimulus",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B8",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a lot"
+                        }
+                    ],
+                    "label": "Interference of avoidance on daily life",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B9",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "perhaps"
+                        },
+                        {
+                            "code": "2",
+                            "label": "definitely"
+                        }
+                    ],
+                    "label": "Others think fear is excessive",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B10",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "no"
+                        },
+                        {
+                            "code": "1",
+                            "label": "perhaps"
+                        },
+                        {
+                            "code": "2",
+                            "label": "definitely"
+                        }
+                    ],
+                    "label": "Person themselves think fear is excessive",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": true,
+                    "code": "B11",
+                    "sql_type": "text",
+                    "description": "",
+                    "enumerations": [
+                        {
+                            "code": "0",
+                            "label": "not at all"
+                        },
+                        {
+                            "code": "1",
+                            "label": "a little"
+                        },
+                        {
+                            "code": "2",
+                            "label": "a medium amount"
+                        },
+                        {
+                            "code": "3",
+                            "label": "a great deal"
+                        }
+                    ],
+                    "label": "Fears leading to burden on others",
+                    "units": "",
+                    "type": "nominal",
+                    "methodology": ""
+                }
+            ],
+            "code": "Fears_of_specific_things_or_situations",
+            "label": "Fears_of_specific_things_or_situations"
+        },
+        {
+            "variables": [
+                {
+                    "isCategorical": false,
+                    "code": "brainstem",
+                    "sql_type": "real",
+                    "description": "Brainstem volume",
+                    "label": "Brainstem",
+                    "units": "cm3",
+                    "type": "real",
+                    "methodology": ""
+                },
+                {
+                    "isCategorical": false,
+                    "code": "tiv",
+                    "sql_type": "real",
+                    "description": "Total intra-cranial volume",
+                    "label": "TIV",
+                    "units": "cm3",
+                    "type": "real",
+                    "methodology": ""
+                }
+            ],
+            "code": "brain_anatomy",
+            "groups": [
+                {
+                    "variables": [
+                        {
+                            "isCategorical": false,
+                            "code": "_3rdventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "3rd Ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "_4thventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "4th Ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "csfglobal",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "CSF global",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "leftinflatvent",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left inferior lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "leftlateralventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightinflatvent",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right inferior lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightlateralventricle",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right lateral ventricle",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        }
+                    ],
+                    "code": "csf_volume",
+                    "label": "Csf_volume"
+                },
+                {
+                    "code": "grey_matter_volume",
+                    "groups": [
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "cerebellarvermallobulesiv",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Cerebellar Vermal Lobules I-V",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "cerebellarvermallobulesviiix",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Cerebellar Vermal Lobules VIII-X",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "cerebellarvermallobulesvivii",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Cerebellar Vermal Lobules VI-VII",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcerebellumexterior",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Cerebellum Exterior",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcerebellumexterior",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Cerebellum Exterior",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "cerebellum",
+                            "label": "Cerebellum"
+                        },
+                        {
+                            "code": "cerebral_nuclei",
+                            "groups": [
+                                {
+                                    "variables": [
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftamygdala",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Amygdala",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightamygdala",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Amygdala",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        }
+                                    ],
+                                    "code": "amygdala",
+                                    "label": "Amygdala"
+                                },
+                                {
+                                    "variables": [
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftaccumbensarea",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Accumbens Area",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftbasalforebrain",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Basal Forebrain",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftcaudate",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Caudate",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftpallidum",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Pallidum",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "leftputamen",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Left Putamen",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightaccumbensarea",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Accumbens Area",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightbasalforebrain",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Basal Forebrain",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightcaudate",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Caudate",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightpallidum",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Pallidum",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        },
+                                        {
+                                            "isCategorical": false,
+                                            "code": "rightputamen",
+                                            "sql_type": "real",
+                                            "description": "",
+                                            "label": "Right Putamen",
+                                            "units": "cm3",
+                                            "type": "real",
+                                            "methodology": ""
+                                        }
+                                    ],
+                                    "code": "basal_ganglia",
+                                    "label": "Basal_ganglia"
+                                }
+                            ],
+                            "label": "Cerebral_nuclei"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftventraldc",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Ventral DC",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightventraldc",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Ventral DC",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "diencephalon",
+                            "label": "Diencephalon"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftaorganteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left anterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcocentraloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left central operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftfofrontaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left frontal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftfrpfrontalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left frontal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftgregyrusrectus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left gyrus rectus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftlorglateralorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left lateral orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmfcmedialfrontalcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left medial frontal cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmfgmiddlefrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmorgmedialorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left medial orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmprgprecentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left precentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmsfgsuperiorfrontalgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior frontal gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftopifgopercularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left opercular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftorifgorbitalpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left orbital part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpoparietaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left parietal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftporgposteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left posterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftprgprecentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left precentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftscasubcallosalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left subcallosal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsfgsuperiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsmcsupplementarymotorcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left supplementary motor cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "lefttrifgtriangularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left triangular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightaorganteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right anterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcocentraloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right central operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightfofrontaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right frontal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightfrpfrontalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right frontal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightgregyrusrectus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right gyrus rectus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightlorglateralorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right lateral orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmfcmedialfrontalcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right medial frontal cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmfgmiddlefrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmorgmedialorbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right medial orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmprgprecentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right precentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmsfgsuperiorfrontalgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior frontal gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightopifgopercularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right opercular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightorifgorbitalpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right orbital part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpoparietaloperculum",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right parietal operculum",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightporgposteriororbitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right posterior orbital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightprgprecentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right precentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightscasubcallosalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right subcallosal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsfgsuperiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsmcsupplementarymotorcortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right supplementary motor cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "righttrifgtriangularpartoftheinferiorfrontalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right triangular part of the inferior frontal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "frontal",
+                            "label": "Frontal"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftainsanteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left anterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpinsposteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left posterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightainsanteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right anterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpinsposteriorinsula",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right posterior insula",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "insula",
+                            "label": "Insula"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftacgganteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left anterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftententorhinalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left entorhinal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "lefthippocampus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Hippocampus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmcggmiddlecingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpcggposteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left posterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftphgparahippocampalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left parahippocampal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftthalamusproper",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left Thalamus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightacgganteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right anterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightententorhinalarea",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right entorhinal area",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "righthippocampus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Hippocampus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmcggmiddlecingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpcggposteriorcingulategyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right posterior cingulate gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightphgparahippocampalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right parahippocampal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightthalamusproper",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right Thalamus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "limbic",
+                            "label": "Limbic"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcalccalcarinecortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left calcarine cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftcuncuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left cuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftioginferioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left inferior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftliglingualgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left lingual gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmogmiddleoccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftocpoccipitalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left occipital pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftofugoccipitalfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left occipital fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsogsuperioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcalccalcarinecortex",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right calcarine cortex",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightcuncuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right cuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightioginferioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right inferior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightliglingualgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right lingual gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmogmiddleoccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightocpoccipitalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right occipital pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightofugoccipitalfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right occipital fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsogsuperioroccipitalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior occipital gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "occipital",
+                            "label": "Occipital"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftangangulargyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left angular gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmpogpostcentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left postcentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpcuprecuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left precuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftpogpostcentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left postcentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsmgsupramarginalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left supramarginal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftsplsuperiorparietallobule",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior parietal lobule",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightangangulargyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right angular gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmpogpostcentralgyrusmedialsegment",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right postcentral gyrus medial segment",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpcuprecuneus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right precuneus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightpogpostcentralgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right postcentral gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsmgsupramarginalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right supramarginal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightsplsuperiorparietallobule",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior parietal lobule",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "parietal",
+                            "label": "Parietal"
+                        },
+                        {
+                            "variables": [
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftfugfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftitginferiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left inferior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftmtgmiddletemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left middle temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftppplanumpolare",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left planum polare",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftptplanumtemporale",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left planum temporale",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftstgsuperiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left superior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "lefttmptemporalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left temporal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "leftttgtransversetemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Left transverse temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightfugfusiformgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right fusiform gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightitginferiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right inferior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightmtgmiddletemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right middle temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightppplanumpolare",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right planum polare",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightptplanumtemporale",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right planum temporale",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightstgsuperiortemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right superior temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "righttmptemporalpole",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right temporal pole",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                },
+                                {
+                                    "isCategorical": false,
+                                    "code": "rightttgtransversetemporalgyrus",
+                                    "sql_type": "real",
+                                    "description": "",
+                                    "label": "Right transverse temporal gyrus",
+                                    "units": "cm3",
+                                    "type": "real",
+                                    "methodology": ""
+                                }
+                            ],
+                            "code": "temporal",
+                            "label": "Temporal"
+                        }
+                    ],
+                    "label": "Grey_matter_volume"
+                },
+                {
+                    "variables": [
+                        {
+                            "isCategorical": false,
+                            "code": "leftcerebellumwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left Cerebellum White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "leftcerebralwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Left Cerebral White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "opticchiasm",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Optic chiasm",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightcerebellumwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right Cerebellum White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        },
+                        {
+                            "isCategorical": false,
+                            "code": "rightcerebralwhitematter",
+                            "sql_type": "real",
+                            "description": "",
+                            "label": "Right Cerebral White Matter",
+                            "units": "cm3",
+                            "type": "real",
+                            "methodology": ""
+                        }
+                    ],
+                    "code": "white_matter_volume",
+                    "label": "White_matter_volume"
+                }
+            ],
+            "label": "Brain_anatomy"
+        }
+    ],
+    "label": "Mentalhealth"
+}
diff --git a/controller/config/pathologies_metadata/tbi.json b/controller/config/pathologies_metadata/tbi.json
new file mode 100755
index 00000000..68cd84c8
--- /dev/null
+++ b/controller/config/pathologies_metadata/tbi.json
@@ -0,0 +1,609 @@
+{
+  "variables": [
+    {
+      "isCategorical": true,
+      "code": "dataset",
+      "sql_type": "text",
+      "description": "",
+      "enumerations": [
+        {
+          "code": "dummy_tbi",
+          "label": "Dummy TBI"
+        }
+      ],
+      "label": "Dataset",
+      "units": "",
+      "type": "nominal",
+      "methodology": ""
+    }
+  ],
+  "code": "tbi",
+  "groups": [
+    {
+      "variables": [
+        {
+          "isCategorical": false,
+          "minValue": "0",
+          "code": "age_value",
+          "maxValue": "130",
+          "sql_type": "int",
+          "description": "",
+          "enumerations": [],
+          "label": "Age",
+          "units": "years",
+          "type": "integer",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "gender_type",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "M",
+              "label": "Male"
+            },
+            {
+              "code": "F",
+              "label": "Female"
+            }
+          ],
+          "label": "Gender",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "Demographics",
+      "label": "Demographics"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "gcs_eye_response_scale",
+          "sql_type": "text",
+          "description": "Glasgow Coma Scale (GCS) - eye response scale",
+          "enumerations": [
+            {
+              "code": "Untestable",
+              "label": "Untestable"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            },
+            {
+              "code": "1",
+              "label": "No eye opening"
+            },
+            {
+              "code": "2",
+              "label": "Eye opening to pain"
+            },
+            {
+              "code": "3",
+              "label": "Eye opening to speech/verbal command"
+            },
+            {
+              "code": "4",
+              "label": "Eyes open spontaneously"
+            }
+          ],
+          "label": "GCS eye",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "gcs_motor_response_scale",
+          "sql_type": "text",
+          "description": "Glasgow Coma Scale (GCS) - motor response scale",
+          "enumerations": [
+            {
+              "code": "Untestable",
+              "label": "Untestable"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            },
+            {
+              "code": "1",
+              "label": "No motor response"
+            },
+            {
+              "code": "2",
+              "label": "Abnormal extension/Extensor response"
+            },
+            {
+              "code": "3",
+              "label": "Abnormal flexion"
+            },
+            {
+              "code": "4",
+              "label": "Flexion withdrawal/withdraws from pain"
+            },
+            {
+              "code": "5",
+              "label": "Localizes pain"
+            },
+            {
+              "code": "6",
+              "label": "Obeys command"
+            }
+          ],
+          "label": "GCS motor",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "gcs_verbal_response_scale",
+          "sql_type": "text",
+          "description": "Glasgow Coma Scale (GCS) - verbal response scale",
+          "enumerations": [
+            {
+              "code": "Untestable",
+              "label": "Untestable"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            },
+            {
+              "code": "1",
+              "label": "No verbal response/sounds"
+            },
+            {
+              "code": "2",
+              "label": "Incomprehensible sound"
+            },
+            {
+              "code": "3",
+              "label": "Inappropriate words"
+            },
+            {
+              "code": "4",
+              "label": "Confused"
+            },
+            {
+              "code": "5",
+              "label": "Oriented"
+            }
+          ],
+          "label": "GCS verbal",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "pupil_reactivity_right_eye_result",
+          "sql_type": "text",
+          "description": "Pupil reactivity light right eye",
+          "enumerations": [
+            {
+              "code": "Sluggish",
+              "label": "Sluggish"
+            },
+            {
+              "code": "Nonreactive",
+              "label": "Nonreactive"
+            },
+            {
+              "code": "Brisk",
+              "label": "Brisk"
+            },
+            {
+              "code": "Untestable",
+              "label": "Untestable"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            }
+          ],
+          "label": "Pupil right",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "pupil_reactivity_left_eye_result",
+          "sql_type": "text",
+          "description": "Pupil reactivity light left eye ",
+          "enumerations": [
+            {
+              "code": "Sluggish",
+              "label": "Sluggish"
+            },
+            {
+              "code": "Nonreactive",
+              "label": "Nonreactive"
+            },
+            {
+              "code": "Brisk",
+              "label": "Brisk"
+            },
+            {
+              "code": "Untestable",
+              "label": "Untestable"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            }
+          ],
+          "label": "Pupil left",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "gcs_total_score",
+          "sql_type": "text",
+          "description": "Glasgow Coma Scale (GCS) - total score",
+          "enumerations": [
+            {
+              "code": "3",
+              "label": "3"
+            },
+            {
+              "code": "4",
+              "label": "4"
+            },
+            {
+              "code": "5",
+              "label": "5"
+            },
+            {
+              "code": "6",
+              "label": "6"
+            },
+            {
+              "code": "7",
+              "label": "7"
+            },
+            {
+              "code": "8",
+              "label": "8"
+            },
+            {
+              "code": "9",
+              "label": "9"
+            },
+            {
+              "code": "10",
+              "label": "10"
+            },
+            {
+              "code": "11",
+              "label": "11"
+            },
+            {
+              "code": "12",
+              "label": "12"
+            },
+            {
+              "code": "13",
+              "label": "13"
+            },
+            {
+              "code": "14",
+              "label": "14"
+            },
+            {
+              "code": "15",
+              "label": "15"
+            },
+            {
+              "code": "untestable",
+              "label": "untestable"
+            },
+            {
+              "code": "unknown",
+              "label": "unknown"
+            }
+          ],
+          "label": "GSC total",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "Neurological Assessment",
+      "label": "Neurological Assessment"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "cisternal_compression_status",
+          "sql_type": "text",
+          "description": "Cisternal compression status",
+          "enumerations": [
+            {
+              "code": "Present",
+              "label": "Present"
+            },
+            {
+              "code": "Absent",
+              "label": "Absent"
+            },
+            {
+              "code": "Indeterminate",
+              "label": "Indeterminate"
+            }
+          ],
+          "label": "Cisternal compression",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "epidural_hematoma_anatomic_status",
+          "sql_type": "text",
+          "description": "Epidural hematoma status",
+          "enumerations": [
+            {
+              "code": "Present",
+              "label": "Present"
+            },
+            {
+              "code": "Absent",
+              "label": "Absent"
+            },
+            {
+              "code": "Indeterminate",
+              "label": "Indeterminate"
+            }
+          ],
+          "label": "Epidural hematoma",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "midline_shift_supratentorial_indicator",
+          "sql_type": "text",
+          "description": "Midline shift supratentorial indicator",
+          "enumerations": [
+            {
+              "code": "Present",
+              "label": "Present"
+            },
+            {
+              "code": "Absent",
+              "label": "Absent"
+            },
+            {
+              "code": "Indeterminate",
+              "label": "Indeterminate"
+            }
+          ],
+          "label": "Midline shift",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "marshall_ct_classification_code",
+          "sql_type": "text",
+          "description": "Marshall CT classification code",
+          "enumerations": [
+            {
+              "code": "1",
+              "label": "Diffuse injury NVP"
+            },
+            {
+              "code": "2",
+              "label": "Diffuse injury"
+            },
+            {
+              "code": "3",
+              "label": "Diffuse injury with swelling"
+            },
+            {
+              "code": "4",
+              "label": "Diffuse injury with shift"
+            },
+            {
+              "code": "5",
+              "label": "Mass lesions"
+            }
+          ],
+          "label": "Marshall CT",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "Imaging Assessment",
+      "label": "Imaging Assessment"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "hypoxic_episode_indicator",
+          "sql_type": "text",
+          "description": "Hypoxic episode indicator",
+          "enumerations": [
+            {
+              "code": "Yes",
+              "label": "Yes"
+            },
+            {
+              "code": "No",
+              "label": "No"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            },
+            {
+              "code": "Suspected",
+              "label": "Suspected"
+            }
+          ],
+          "label": "Hypoxia",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "hypotensive_episode_indicator",
+          "sql_type": "text",
+          "description": "Hypotensive episode indicator",
+          "enumerations": [
+            {
+              "code": "Yes",
+              "label": "Yes"
+            },
+            {
+              "code": "No",
+              "label": "No"
+            },
+            {
+              "code": "Unknown",
+              "label": "Unknown"
+            },
+            {
+              "code": "Suspected",
+              "label": "Suspected"
+            }
+          ],
+          "label": "Hypotension",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "Systemic Second Insult",
+      "label": "Systemic Second Insult"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "gose_score",
+          "sql_type": "text",
+          "description": "Glasgow Outcome Scale Extended (GOS-E) - score",
+          "enumerations": [
+            {
+              "code": "1",
+              "label": "Dead"
+            },
+            {
+              "code": "2",
+              "label": "Vegetative State"
+            },
+            {
+              "code": "3",
+              "label": "Lower Severe Disability"
+            },
+            {
+              "code": "4",
+              "label": "Upper Severe Disability"
+            },
+            {
+              "code": "5",
+              "label": "Lower Moderate Disability"
+            },
+            {
+              "code": "6",
+              "label": "Upper Moderate Disability"
+            },
+            {
+              "code": "7",
+              "label": "Lower Good Recovery "
+            },
+            {
+              "code": "8",
+              "label": "Upper Good Recovery"
+            }
+          ],
+          "label": "GOS-E score",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": false,
+          "code": "mortality_core",
+          "sql_type": "real",
+          "description": "6 month predicted mortality; LPcore, mortality = −2.55 + 0.275 × sum score core",
+          "label": "Mortality - Core Impact",
+          "units": "",
+          "type": "real",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "mortality_gose",
+          "sql_type": "text",
+          "description": "Observed mortality by Glasgow output score",
+          "enumerations": [
+            {
+              "code": "1",
+              "label": "Dead"
+            },
+            {
+              "code": "0",
+              "label": "Alive"
+            }
+          ],
+          "label": "Mortality - GOS-E ",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "Outcomes",
+      "label": "Outcomes"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": false,
+          "minValue": "1.54",
+          "code": "laboratory_procedure_glucose_value",
+          "maxValue": "36.00",
+          "sql_type": "real",
+          "description": "Laboratory procedure glucose value",
+          "enumerations": [],
+          "label": "Glucose",
+          "units": "mmol/L",
+          "type": "real",
+          "methodology": ""
+        },
+        {
+          "isCategorical": false,
+          "minValue": "3.40",
+          "code": "laboratory_procedure_hemoglobin_value",
+          "maxValue": "18.00",
+          "sql_type": "real",
+          "description": "Laboratory procedure hemoglobin value ",
+          "enumerations": [],
+          "label": "Hemoglobin",
+          "units": "g/dL",
+          "type": "real",
+          "methodology": ""
+        }
+      ],
+      "code": "Laboratory Tests",
+      "label": "Laboratory Tests"
+    }
+  ],
+  "label": "Traumatic Brain Injury"
+}
-- 
GitLab


From 7b8d8bf612664cd6431e450c0ff2aa34d1d8107e Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 3 Feb 2021 20:51:10 +0200
Subject: [PATCH 10/30] Added POST /algorithms template.

---
 .../api/{DTOs.py => DTOs/AlgorithmDTO.py}     |  4 +--
 controller/api/DTOs/AlgorithmExecutionDTOs.py | 22 ++++++++++++++++
 controller/api/DTOs/__init__.py               |  0
 controller/api/api_controller.py              | 25 +++++++++++++++++--
 controller/api/errors.py                      |  9 +++++++
 controller/api/services/__init__.py           |  0
 controller/api/services/run_algorithm.py      |  0
 .../design_docs/MIP_Engine_Interface.yml      |  1 -
 8 files changed, 56 insertions(+), 5 deletions(-)
 rename controller/api/{DTOs.py => DTOs/AlgorithmDTO.py} (95%)
 create mode 100644 controller/api/DTOs/AlgorithmExecutionDTOs.py
 create mode 100644 controller/api/DTOs/__init__.py
 create mode 100644 controller/api/errors.py
 create mode 100644 controller/api/services/__init__.py
 create mode 100644 controller/api/services/run_algorithm.py

diff --git a/controller/api/DTOs.py b/controller/api/DTOs/AlgorithmDTO.py
similarity index 95%
rename from controller/api/DTOs.py
rename to controller/api/DTOs/AlgorithmDTO.py
index 2e045f92..f24f3dca 100644
--- a/controller/api/DTOs.py
+++ b/controller/api/DTOs/AlgorithmDTO.py
@@ -12,7 +12,7 @@ class InputDataParameterDTO:
     """
     InputDataParameterDTO is different from the InputDataParameter
     on the stattypes field.
-    It is optional on the DTO, due to the dataset and pathology parameters.
+    It is optional on the DTOs, due to the dataset and pathology parameters.
     """
     label: str
     desc: str
@@ -68,7 +68,7 @@ class CrossValidationAlgorithmDTO:
     """
     desc: str
     label: str
-    parameters: Optional[Dict[str, GenericParameter]] = None
+    parameters: Dict[str, GenericParameter]
 
 
 @dataclass_json
diff --git a/controller/api/DTOs/AlgorithmExecutionDTOs.py b/controller/api/DTOs/AlgorithmExecutionDTOs.py
new file mode 100644
index 00000000..174a9c29
--- /dev/null
+++ b/controller/api/DTOs/AlgorithmExecutionDTOs.py
@@ -0,0 +1,22 @@
+from dataclasses import dataclass
+from typing import Dict, Any, Optional, List
+
+from dataclasses_json import dataclass_json
+
+
+@dataclass_json
+@dataclass
+class AlgorithmInputDataDTO:
+    pathology: str
+    dataset: List[str]
+    filter: Optional[Any] = None
+    x: Optional[List[str]] = None
+    y: Optional[List[str]] = None
+
+
+@dataclass_json
+@dataclass
+class AlgorithmRequestDTO:
+    inputdata: AlgorithmInputDataDTO
+    parameters: Optional[Dict[str, Any]] = None
+    crossvalidation: Optional[Dict[str, Any]] = None
diff --git a/controller/api/DTOs/__init__.py b/controller/api/DTOs/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/api/api_controller.py b/controller/api/api_controller.py
index 3a5f9304..a7102c8d 100644
--- a/controller/api/api_controller.py
+++ b/controller/api/api_controller.py
@@ -1,14 +1,35 @@
-from quart import Quart
+from quart import Quart, request
 
-from DTOs import AlgorithmDTO
 from controller.algorithms import Algorithms
+from controller.api.DTOs.AlgorithmDTO import AlgorithmDTO
+from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from controller.api.errors import BadRequest
 
 app = Quart(__name__)
 
 
+# TODO break into views/app/errors
+
+
 @app.route("/algorithms")
 async def get_algorithms() -> str:
     algorithm_DTOs = [AlgorithmDTO(algorithm, Algorithms().crossvalidation)
                       for algorithm in Algorithms().available.values()]
 
     return AlgorithmDTO.schema().dumps(algorithm_DTOs, many=True)
+
+
+@app.route("/algorithms/<algorithm_name>", methods=['POST'])
+async def run_algorithm(algorithm_name: str) -> str:
+    algorithm_request = AlgorithmRequestDTO.from_json(await request.data)
+    print(f"Running algorithm: {algorithm_name} with body: {algorithm_request}")
+
+    if str.lower(algorithm_name) not in Algorithms().available.keys():
+        raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
+    response = run_algorithm(algorithm_request)
+    return "Response"
+
+
+@app.errorhandler(BadRequest)
+def handle_bad_request(error: BadRequest):
+    return error.message, error.status_code
diff --git a/controller/api/errors.py b/controller/api/errors.py
new file mode 100644
index 00000000..17cff568
--- /dev/null
+++ b/controller/api/errors.py
@@ -0,0 +1,9 @@
+class BadRequest(Exception):
+    def __init__(self, message):
+        Exception.__init__(self)
+        self.status_code = 400
+        self.message = message
+
+
+class UserError(Exception):
+    pass
diff --git a/controller/api/services/__init__.py b/controller/api/services/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/api/services/run_algorithm.py b/controller/api/services/run_algorithm.py
new file mode 100644
index 00000000..e69de29b
diff --git a/documentation/design_docs/MIP_Engine_Interface.yml b/documentation/design_docs/MIP_Engine_Interface.yml
index 77a868b0..7d82e489 100644
--- a/documentation/design_docs/MIP_Engine_Interface.yml
+++ b/documentation/design_docs/MIP_Engine_Interface.yml
@@ -131,7 +131,6 @@ components:
                         }
                     },
                     "crossvalidation": {
-                        "name": "crossvalidation",
                         "desc": "Module for performing cross validation on supervised learning models.",
                         "label": "Cross Validation",
                         "parameters": {
-- 
GitLab


From 76ad898b5090ccc6ca5d447c13b968b75bd84110 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Mon, 8 Feb 2021 17:23:54 +0200
Subject: [PATCH 11/30] Added validation for request body and generic
 parameters.

---
 algorithms/test.json                          |   2 +-
 controller/algorithms.py                      |   4 +-
 controller/api/DTOs/AlgorithmExecutionDTOs.py |  14 +-
 ...mDTO.py => AlgorithmSpecificationsDTOs.py} |  43 +++--
 controller/api/api_controller.py              |  36 ++--
 controller/api/services/run_algorithm.py      | 165 ++++++++++++++++++
 controller/common_data_elements.py            |  10 +-
 .../design_docs/MIP_Engine_Interface.yml      |   2 +-
 8 files changed, 231 insertions(+), 45 deletions(-)
 rename controller/api/DTOs/{AlgorithmDTO.py => AlgorithmSpecificationsDTOs.py} (67%)

diff --git a/algorithms/test.json b/algorithms/test.json
index 56f66d28..f12f6a92 100644
--- a/algorithms/test.json
+++ b/algorithms/test.json
@@ -49,7 +49,7 @@
             "default": [0.8, 0.95],
             "min": 0.0,
             "max": 1.0,
-            "notblank": true,
+            "notblank": false,
             "multiple": true
         }
     },
diff --git a/controller/algorithms.py b/controller/algorithms.py
index 4b54ed1d..31a7a489 100644
--- a/controller/algorithms.py
+++ b/controller/algorithms.py
@@ -15,7 +15,7 @@ CROSSVALIDATION_ALGORITHM_NAME = "crossvalidation"
 
 @dataclass_json
 @dataclass
-class InputDataParameter:
+class InputData:
     label: str
     desc: str
     types: List[str]
@@ -60,7 +60,7 @@ class Algorithm:
     desc: str
     label: str
     enabled: bool
-    inputdata: Optional[Dict[str, InputDataParameter]] = None
+    inputdata: Optional[Dict[str, InputData]] = None
     parameters: Optional[Dict[str, GenericParameter]] = None
     flags: Optional[Dict[str, bool]] = None
 
diff --git a/controller/api/DTOs/AlgorithmExecutionDTOs.py b/controller/api/DTOs/AlgorithmExecutionDTOs.py
index 174a9c29..d31b11c6 100644
--- a/controller/api/DTOs/AlgorithmExecutionDTOs.py
+++ b/controller/api/DTOs/AlgorithmExecutionDTOs.py
@@ -1,22 +1,12 @@
 from dataclasses import dataclass
-from typing import Dict, Any, Optional, List
+from typing import Dict, Any, Optional
 
 from dataclasses_json import dataclass_json
 
 
-@dataclass_json
-@dataclass
-class AlgorithmInputDataDTO:
-    pathology: str
-    dataset: List[str]
-    filter: Optional[Any] = None
-    x: Optional[List[str]] = None
-    y: Optional[List[str]] = None
-
-
 @dataclass_json
 @dataclass
 class AlgorithmRequestDTO:
-    inputdata: AlgorithmInputDataDTO
+    inputdata: Dict[str, Any]
     parameters: Optional[Dict[str, Any]] = None
     crossvalidation: Optional[Dict[str, Any]] = None
diff --git a/controller/api/DTOs/AlgorithmDTO.py b/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
similarity index 67%
rename from controller/api/DTOs/AlgorithmDTO.py
rename to controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index f24f3dca..379f1a6b 100644
--- a/controller/api/DTOs/AlgorithmDTO.py
+++ b/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -3,7 +3,8 @@ from typing import List, Optional, Dict
 
 from dataclasses_json import dataclass_json
 
-from controller.algorithms import GenericParameter, Algorithm, CROSSVALIDATION_ALGORITHM_NAME
+from controller.algorithms import GenericParameter, Algorithm, CROSSVALIDATION_ALGORITHM_NAME, Algorithms
+from controller.utils import Singleton
 
 
 @dataclass_json
@@ -61,10 +62,20 @@ def get_filter_parameter():
 
 @dataclass_json
 @dataclass
-class CrossValidationAlgorithmDTO:
+class GenericParameterDTO(GenericParameter):
     """
-    CrossValidationAlgorithmDTO is different from the Algorithm class
-    because it doesn't have the enabled flag and the name.
+    GenericParameterDTO is identical to the GenericParameter
+    but exists for consistency and future use if needed.
+    """
+    pass
+
+
+@dataclass_json
+@dataclass
+class CrossValidationParametersDTO:
+    """
+    CrossValidationDTO is a nested object, that contains
+    all the information need to run crossvalidation on an algorithm.
     """
     desc: str
     label: str
@@ -75,16 +86,16 @@ class CrossValidationAlgorithmDTO:
 @dataclass
 class AlgorithmDTO:
     """
-    AlgorithmDTO is different from the Algorithm class
-    because it doesn't have the enabled flag and
-    the crossvalidation algorithm is nested, not a flag.
+    AlgorithmDTO is used to provide the UI the requirements
+    of each algorithm.
+    System variables are added and unnecessary fields are removed.
     """
     name: str
     desc: str
     label: str
-    inputdata: Optional[Dict[str, InputDataParameterDTO]] = None
+    inputdata: Dict[str, InputDataParameterDTO]
     parameters: Optional[Dict[str, GenericParameter]] = None
-    crossvalidation: Optional[CrossValidationAlgorithmDTO] = None
+    crossvalidation: Optional[CrossValidationParametersDTO] = None
 
     def __init__(self, algorithm: Algorithm, crossvalidation: Algorithm):
         self.name = algorithm.name
@@ -111,8 +122,20 @@ class AlgorithmDTO:
         # Adding the crossvalidation algorithm as a nested algorithm
         if (CROSSVALIDATION_ALGORITHM_NAME in algorithm.flags.keys()
                 and algorithm.flags[CROSSVALIDATION_ALGORITHM_NAME]):
-            self.crossvalidation = CrossValidationAlgorithmDTO(
+            self.crossvalidation = CrossValidationParametersDTO(
                 crossvalidation.desc,
                 crossvalidation.label,
                 crossvalidation.parameters,
             )
+
+
+class AlgorithmSpecifications(metaclass=Singleton):
+    algorithms_list = List[AlgorithmDTO]
+    algorithms_dict = Dict[str, AlgorithmDTO]
+
+    def __init__(self):
+        self.algorithms_list = [AlgorithmDTO(algorithm, Algorithms().crossvalidation)
+                                for algorithm in Algorithms().available.values()]
+
+        self.algorithms_dict = {algorithm.name: AlgorithmDTO(algorithm, Algorithms().crossvalidation)
+                                for algorithm in Algorithms().available.values()}
diff --git a/controller/api/api_controller.py b/controller/api/api_controller.py
index a7102c8d..a0691d87 100644
--- a/controller/api/api_controller.py
+++ b/controller/api/api_controller.py
@@ -1,9 +1,11 @@
+import logging
+import traceback
+
 from quart import Quart, request
 
-from controller.algorithms import Algorithms
-from controller.api.DTOs.AlgorithmDTO import AlgorithmDTO
-from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, AlgorithmSpecifications
 from controller.api.errors import BadRequest
+from controller.api.services.run_algorithm import run_algorithm
 
 app = Quart(__name__)
 
@@ -13,21 +15,27 @@ app = Quart(__name__)
 
 @app.route("/algorithms")
 async def get_algorithms() -> str:
-    algorithm_DTOs = [AlgorithmDTO(algorithm, Algorithms().crossvalidation)
-                      for algorithm in Algorithms().available.values()]
+    algorithm_specifications = AlgorithmSpecifications().algorithms_list
 
-    return AlgorithmDTO.schema().dumps(algorithm_DTOs, many=True)
+    return AlgorithmDTO.schema().dumps(algorithm_specifications, many=True)
 
 
 @app.route("/algorithms/<algorithm_name>", methods=['POST'])
-async def run_algorithm(algorithm_name: str) -> str:
-    algorithm_request = AlgorithmRequestDTO.from_json(await request.data)
-    print(f"Running algorithm: {algorithm_name} with body: {algorithm_request}")
-
-    if str.lower(algorithm_name) not in Algorithms().available.keys():
-        raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
-    response = run_algorithm(algorithm_request)
-    return "Response"
+async def post_algorithm(algorithm_name: str) -> str:
+    logging.info(f"Algorithm execution with name {algorithm_name}.")
+
+    request_body = await request.data
+
+    try:
+        response = run_algorithm(algorithm_name, request_body)
+    except BadRequest as e:
+        raise e
+    except:
+        logging.error(f"Unhandled exception: \n {traceback.format_exc()}")
+        raise BadRequest("Something went wrong. "
+                         "Please inform the system administrator or try again later.")
+
+    return "Success!"
 
 
 @app.errorhandler(BadRequest)
diff --git a/controller/api/services/run_algorithm.py b/controller/api/services/run_algorithm.py
index e69de29b..531ee87c 100644
--- a/controller/api/services/run_algorithm.py
+++ b/controller/api/services/run_algorithm.py
@@ -0,0 +1,165 @@
+import logging
+import traceback
+from typing import Optional, Dict, Any, List
+
+from controller.algorithms import Algorithms, GenericParameter
+from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications, AlgorithmDTO, \
+    InputDataParameterDTO, CrossValidationParametersDTO
+from controller.api.errors import BadRequest
+
+
+def run_algorithm(algorithm_name: str, request_body: str):
+    # Check that algorithm exists
+    if str.lower(algorithm_name) not in Algorithms().available.keys():
+        raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
+
+    # Validate algorithm body has proper format
+    try:
+        algorithm_request = AlgorithmRequestDTO.from_json(request_body)
+    except Exception:
+        logging.error(f"Could not parse the algorithm request body. "
+                      f"Exception: \n {traceback.format_exc()}")
+        raise BadRequest(f"The algorithm body does not have the proper format.")
+
+    # Get algorithm specification and validate the request
+    algorithm_specs = AlgorithmSpecifications().algorithms_dict[algorithm_name]
+    validate_parameters(algorithm_specs, algorithm_request)
+
+    # TODO Run algorithm on the controller
+    pass
+
+
+def validate_parameters(algorithm_specs: AlgorithmDTO,
+                        algorithm_request: AlgorithmRequestDTO):
+    # Validate inputdata
+    validate_inputdata(algorithm_specs.inputdata,
+                       algorithm_request.inputdata)
+
+    # Validate generic parameters
+    validate_generic_parameters(algorithm_specs.parameters,
+                                algorithm_request.parameters)
+
+    # Validate crossvalidation parameters
+    validate_crossvalidation_parameters(algorithm_specs.crossvalidation,
+                                        algorithm_request.crossvalidation)
+    pass
+
+
+def validate_inputdata(inputdata_specs: Dict[str, InputDataParameterDTO],
+                       input_data: Dict[str, Any]):
+    for inputdata_name, inputdata_spec in inputdata_specs.items():
+        pass
+
+
+def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericParameter]],
+                                parameters: Optional[Dict[str, Any]]):
+    if parameters_specs is None:
+        return
+
+    if parameters is None:
+        raise BadRequest("Algorithm parameters not provided.")
+
+    for parameter_name, parameter_spec in parameters_specs.items():
+        if parameter_name not in parameters.keys():
+            if parameter_spec.notblank:
+                raise BadRequest(f"Parameter '{parameter_name}' should not be blank.")
+            else:
+                continue
+
+        parameter_value = parameters[parameter_name]
+        validate_parameter_proper_values(parameter_name,
+                                         parameter_value,
+                                         parameter_spec.type,
+                                         parameter_spec.enums,
+                                         parameter_spec.min,
+                                         parameter_spec.max,
+                                         parameter_spec.multiple)
+
+
+def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationParametersDTO],
+                                        crossvalidation: Optional[Dict[str, Any]]):
+    pass
+
+
+def validate_parameter_proper_values(parameter_name: str,
+                                     parameter_value: Any,
+                                     parameter_type: str,
+                                     parameter_enums: Optional[List[Any]],
+                                     parameter_min_value: Optional[int],
+                                     parameter_max_value: Optional[int],
+                                     multiple_allowed: bool
+                                     ):
+    if multiple_allowed and not isinstance(parameter_value, list):
+        raise BadRequest(f"Parameter '{parameter_name}' should be a list.")
+
+    # If the parameter value is a list, check each elements
+    if multiple_allowed:
+        for element in parameter_value:
+            validate_parameter_proper_type(parameter_name,
+                                           element,
+                                           parameter_type)
+
+            validate_parameter_proper_enumerations(parameter_name,
+                                                   element,
+                                                   parameter_enums)
+
+            validate_parameter_inside_min_max(parameter_name,
+                                              element,
+                                              parameter_min_value,
+                                              parameter_max_value)
+    else:
+        validate_parameter_proper_type(parameter_name,
+                                       parameter_value,
+                                       parameter_type)
+
+        validate_parameter_proper_enumerations(parameter_name,
+                                               parameter_value,
+                                               parameter_enums)
+
+        validate_parameter_inside_min_max(parameter_name,
+                                          parameter_value,
+                                          parameter_min_value,
+                                          parameter_max_value)
+
+
+def validate_parameter_proper_type(parameter_name: str,
+                                   parameter_value: Any,
+                                   parameter_type: str
+                                   ):
+    mip_types_to_python_types = {
+        "text": [str],
+        "int": [int],
+        "real": [float, int],
+        "jsonObject": [dict]
+    }
+    if type(parameter_value) not in mip_types_to_python_types[parameter_type]:
+        raise BadRequest(f"Parameter '{parameter_name}' values should be of type '{parameter_type}'.")
+
+
+def validate_parameter_proper_enumerations(parameter_name: str,
+                                           parameter_value: Any,
+                                           enumerations: Optional[List[Any]]
+                                           ):
+    if enumerations is None:
+        return
+
+    if parameter_value not in enumerations:
+        raise BadRequest(f"Parameter '{parameter_name}' values should be one of the following: '{str(enumerations)}' .")
+
+
+def validate_parameter_inside_min_max(parameter_name: str,
+                                      parameter_value: Any,
+                                      min: Optional[int],
+                                      max: Optional[int]
+                                      ):
+    if min is None and max is None:
+        return
+
+    if min is not None and parameter_value < min:
+        raise BadRequest(
+            f"Parameter '{parameter_name}' values should be greater than {min} .")
+
+    if max is not None and parameter_value > max:
+        raise BadRequest(
+            f"Parameter '{parameter_name}' values should be lower than {max} .")
diff --git a/controller/common_data_elements.py b/controller/common_data_elements.py
index 6d8f973c..fb0329e7 100644
--- a/controller/common_data_elements.py
+++ b/controller/common_data_elements.py
@@ -43,7 +43,7 @@ class MetadataGroup:
 
 
 @dataclass
-class CommonDataElement:
+class CommonDataElementMetadata:
     sql_type: str
     categorical: bool
     enumerations: Optional[Set] = None
@@ -57,14 +57,14 @@ class CommonDataElement:
 
 @dataclass
 class CommonDataElements:
-    elements: Dict[str, Dict[str, CommonDataElement]]
+    elements: Dict[str, Dict[str, CommonDataElementMetadata]]
 
     def __init__(self):
 
-        def iterate_metadata_groups(metadata_group: MetadataGroup) -> Dict[str, CommonDataElement]:
-            group_elements: Dict[str, CommonDataElement] = {}
+        def iterate_metadata_groups(metadata_group: MetadataGroup) -> Dict[str, CommonDataElementMetadata]:
+            group_elements: Dict[str, CommonDataElementMetadata] = {}
             for variable in metadata_group.variables:
-                group_elements[variable.code] = CommonDataElement(variable)
+                group_elements[variable.code] = CommonDataElementMetadata(variable)
             for sub_group in metadata_group.groups:
                 group_elements.update(iterate_metadata_groups(sub_group))
             return group_elements
diff --git a/documentation/design_docs/MIP_Engine_Interface.yml b/documentation/design_docs/MIP_Engine_Interface.yml
index 7d82e489..6d6c10ac 100644
--- a/documentation/design_docs/MIP_Engine_Interface.yml
+++ b/documentation/design_docs/MIP_Engine_Interface.yml
@@ -126,7 +126,7 @@ components:
                             "default": [0.8, 0.95],
                             "min": 0.0,
                             "max": 1.0,
-                            "notblank": true,
+                            "notblank": false,
                             "multiple": true
                         }
                     },
-- 
GitLab


From 355e1dadd63c4756f72a63dde0dad0f6808a9a9c Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Mon, 8 Feb 2021 21:49:28 +0200
Subject: [PATCH 12/30] Automatic format.

---
 algorithms/crossvalidation.json               |   76 +-
 algorithms/test.json                          |  129 +-
 .../config/pathologies_metadata/dementia.json | 4803 ++++++++-------
 .../pathologies_metadata/mentalhealth.json    | 5476 ++++++++---------
 .../design_docs/MIP_Engine_Interface.yml      |  450 +-
 .../design_docs/WorkerServiceAPISpec.yml      |  308 +-
 .../design_docs/privacy-tools-specs.md        |   92 +-
 documentation/user_stories/User-stories.md    |  133 +-
 8 files changed, 5743 insertions(+), 5724 deletions(-)

diff --git a/algorithms/crossvalidation.json b/algorithms/crossvalidation.json
index a75c36d5..706ff156 100644
--- a/algorithms/crossvalidation.json
+++ b/algorithms/crossvalidation.json
@@ -1,36 +1,46 @@
 {
-    "name": "crossvalidation",
-    "desc": "Module for performing cross validation on supervised learning models.",
-    "label": "Cross Validation",
-    "enabled": true,
-    "parameters": {
-        "type": {
-            "label": "Type of cross-validation",
-            "desc": "Type of cross-validation",
-            "type": "text",
-            "enums": ["k_fold", "leave_dataset_out"],
-            "default": "k_fold",
-            "notblank": true,
-            "multiple": false
-        }, 
-        "nsplits": {
-            "label": "Number of splits",
-            "desc": "Number of splits",
-            "type": "int",
-            "min": 2,
-            "max": 20,
-            "default": 5,
-            "notblank": true,
-            "multiple": false
-        },
-        "metrics": {
-            "label": "Metrics",
-            "desc": "Cross-validation metrics.",
-            "type": "text",
-            "enums": ["precision", "recall", "auc", "roc", "confusion_matrix", "f1_score"],
-            "default": null,
-            "notblank": true,
-            "multiple": true
-        }
+  "name": "crossvalidation",
+  "desc": "Module for performing cross validation on supervised learning models.",
+  "label": "Cross Validation",
+  "enabled": true,
+  "parameters": {
+    "type": {
+      "label": "Type of cross-validation",
+      "desc": "Type of cross-validation",
+      "type": "text",
+      "enums": [
+        "k_fold",
+        "leave_dataset_out"
+      ],
+      "default": "k_fold",
+      "notblank": true,
+      "multiple": false
+    },
+    "nsplits": {
+      "label": "Number of splits",
+      "desc": "Number of splits",
+      "type": "int",
+      "min": 2,
+      "max": 20,
+      "default": 5,
+      "notblank": true,
+      "multiple": false
+    },
+    "metrics": {
+      "label": "Metrics",
+      "desc": "Cross-validation metrics.",
+      "type": "text",
+      "enums": [
+        "precision",
+        "recall",
+        "auc",
+        "roc",
+        "confusion_matrix",
+        "f1_score"
+      ],
+      "default": null,
+      "notblank": true,
+      "multiple": true
     }
+  }
 }
diff --git a/algorithms/test.json b/algorithms/test.json
index f12f6a92..85f13e79 100644
--- a/algorithms/test.json
+++ b/algorithms/test.json
@@ -1,60 +1,79 @@
 {
-    "name": "test",
-    "desc": "This is a test algorithm.",
-    "label": "TEST",
-    "enabled": true,
-    "inputdata": {
-        "x": {
-            "label": "features",
-            "desc": "Features used in my algorithm.",
-            "types": ["real", "int", "text"],
-            "stattypes": ["numerical", "nominal"],
-            "notblank": true,
-            "multiple": true
-        },
-        "y": {
-            "label": "target",
-            "desc": "Target variable for my algorithm.",
-            "types": ["text", "int"],
-            "stattypes": ["nominal"],
-            "enumslen": 2,
-            "notblank": true,
-            "multiple": false
-        }
+  "name": "test",
+  "desc": "This is a test algorithm.",
+  "label": "TEST",
+  "enabled": true,
+  "inputdata": {
+    "x": {
+      "label": "features",
+      "desc": "Features used in my algorithm.",
+      "types": [
+        "real",
+        "int",
+        "text"
+      ],
+      "stattypes": [
+        "numerical",
+        "nominal"
+      ],
+      "notblank": true,
+      "multiple": true
     },
-    "parameters": {
-        "my_enum_param": {
-            "label": "Some param",
-            "desc": "Example of parameter with enumerations.",
-            "type": "text",
-            "enums": ["a", "b", "c"],
-            "default": "a",
-            "notblank": true,
-            "multiple": false
-        },
-        "my_int_param": {
-            "label": "Some param",
-            "desc": "Example of integer param.",
-            "type": "int",
-            "default": 4,
-            "min": 2,
-            "max": 4,
-            "notblank": true,
-            "multiple": false
-        },
-        "list_param": {
-            "label": "Some param",
-            "desc": "Example of list of floats param.",
-            "type": "real",
-            "default": [0.8, 0.95],
-            "min": 0.0,
-            "max": 1.0,
-            "notblank": false,
-            "multiple": true
-        }
+    "y": {
+      "label": "target",
+      "desc": "Target variable for my algorithm.",
+      "types": [
+        "text",
+        "int"
+      ],
+      "stattypes": [
+        "nominal"
+      ],
+      "enumslen": 2,
+      "notblank": true,
+      "multiple": false
+    }
+  },
+  "parameters": {
+    "my_enum_param": {
+      "label": "Some param",
+      "desc": "Example of parameter with enumerations.",
+      "type": "text",
+      "enums": [
+        "a",
+        "b",
+        "c"
+      ],
+      "default": "a",
+      "notblank": true,
+      "multiple": false
+    },
+    "my_int_param": {
+      "label": "Some param",
+      "desc": "Example of integer param.",
+      "type": "int",
+      "default": 4,
+      "min": 2,
+      "max": 4,
+      "notblank": true,
+      "multiple": false
     },
-    "flags": {
-        "formula": true,
-        "crossvalidation": true
+    "list_param": {
+      "label": "Some param",
+      "desc": "Example of list of floats param.",
+      "type": "real",
+      "default": [
+        0.8,
+        0.95
+      ],
+      "min": 0.0,
+      "max": 1.0,
+      "notblank": false,
+      "multiple": true
     }
+  },
+  "flags": {
+    "formula": true,
+    "crossvalidation": true
+  }
 }
diff --git a/controller/config/pathologies_metadata/dementia.json b/controller/config/pathologies_metadata/dementia.json
index 7589480b..1fcd0465 100755
--- a/controller/config/pathologies_metadata/dementia.json
+++ b/controller/config/pathologies_metadata/dementia.json
@@ -1,2435 +1,2434 @@
-
 {
-    "variables": [
+  "variables": [
+    {
+      "isCategorical": true,
+      "code": "dataset",
+      "sql_type": "text",
+      "description": "Variable used to differentiate datasets",
+      "enumerations": [
         {
-            "isCategorical": true,
-            "code": "dataset",
-            "sql_type": "text",
-            "description": "Variable used to differentiate datasets",
-            "enumerations": [
+          "code": "ppmi",
+          "label": "PPMI"
+        },
+        {
+          "code": "edsd",
+          "label": "EDSD"
+        },
+        {
+          "code": "desd-synthdata",
+          "label": "DESD-synthdata"
+        },
+        {
+          "code": "fake_longitudinal",
+          "label": "Longitudinal"
+        }
+      ],
+      "label": "Dataset",
+      "units": "",
+      "type": "nominal",
+      "methodology": "mip-cde"
+    },
+    {
+      "isCategorical": false,
+      "code": "subjectvisitid",
+      "sql_type": "text",
+      "description": "The ID of the Patient’s Visit",
+      "label": "Visit ID",
+      "units": "",
+      "type": "text",
+      "methodology": ""
+    },
+    {
+      "isCategorical": false,
+      "code": "subjectvisitdate",
+      "sql_type": "text",
+      "description": "The date of the Patient’s Visit",
+      "label": "Visit Date",
+      "units": "",
+      "type": "date",
+      "methodology": ""
+    }
+  ],
+  "code": "dementia",
+  "groups": [
+    {
+      "variables": [
+        {
+          "isCategorical": false,
+          "code": "av45",
+          "sql_type": "real",
+          "description": "AV45 Average AV45 SUVR of frontal  anterior cingulate  precuneus  and parietal cortex\\nrelative to the cerebellum",
+          "label": "AV45",
+          "units": "",
+          "type": "real",
+          "methodology": "mip-cde"
+        },
+        {
+          "isCategorical": false,
+          "code": "fdg",
+          "sql_type": "real",
+          "description": "Average FDG-PET of angular  temporal  and posterior cingulate. Most important hypometabolic regions that are indicative of pathological metabolic change in MCI and AD.",
+          "label": "FDG-PET",
+          "units": "",
+          "type": "real",
+          "methodology": "mip-cde"
+        },
+        {
+          "isCategorical": false,
+          "code": "pib",
+          "sql_type": "real",
+          "description": "Average PIB SUVR of frontal cortex  anterior cingulate  precuneus cortex  and parietal cortex.",
+          "label": "PIB",
+          "units": "",
+          "type": "real",
+          "methodology": "mip-cde"
+        }
+      ],
+      "code": "pet",
+      "label": "Pet"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": false,
+          "code": "brainstem",
+          "sql_type": "real",
+          "description": "Brainstem volume",
+          "label": "Brainstem",
+          "units": "cm3",
+          "type": "real",
+          "methodology": "mip-cde"
+        },
+        {
+          "isCategorical": false,
+          "code": "tiv",
+          "sql_type": "real",
+          "description": "Total intra-cranial volume",
+          "label": "TIV",
+          "units": "cm3",
+          "type": "real",
+          "methodology": "mip-cde"
+        }
+      ],
+      "code": "brain_anatomy",
+      "groups": [
+        {
+          "variables": [
+            {
+              "isCategorical": false,
+              "code": "_3rdventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "3rd Ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "_4thventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "4th Ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "csfglobal",
+              "sql_type": "real",
+              "description": "",
+              "label": "CSF global",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "leftinflatvent",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left inferior lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "leftlateralventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "rightinflatvent",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right inferior lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "rightlateralventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "csf_volume",
+          "label": "Csf_volume"
+        },
+        {
+          "code": "grey_matter_volume",
+          "groups": [
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "cerebellarvermallobulesiv",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Cerebellar Vermal Lobules I-V",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "cerebellarvermallobulesviiix",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Cerebellar Vermal Lobules VIII-X",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "cerebellarvermallobulesvivii",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Cerebellar Vermal Lobules VI-VII",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftcerebellumexterior",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Cerebellum Exterior",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcerebellumexterior",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Cerebellum Exterior",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "cerebellum",
+              "label": "Cerebellum"
+            },
+            {
+              "code": "cerebral_nuclei",
+              "groups": [
+                {
+                  "variables": [
+                    {
+                      "isCategorical": false,
+                      "code": "leftamygdala",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Amygdala",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightamygdala",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Amygdala",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    }
+                  ],
+                  "code": "amygdala",
+                  "label": "Amygdala"
+                },
+                {
+                  "variables": [
+                    {
+                      "isCategorical": false,
+                      "code": "leftaccumbensarea",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Accumbens Area",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftbasalforebrain",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Basal Forebrain",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftcaudate",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Caudate",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftpallidum",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Pallidum",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftputamen",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Putamen",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightaccumbensarea",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Accumbens Area",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightbasalforebrain",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Basal Forebrain",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightcaudate",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Caudate",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightpallidum",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Pallidum",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightputamen",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Putamen",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": "mip-cde"
+                    }
+                  ],
+                  "code": "basal_ganglia",
+                  "label": "Basal_ganglia"
+                }
+              ],
+              "label": "Cerebral_nuclei"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftventraldc",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Ventral DC",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightventraldc",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Ventral DC",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "diencephalon",
+              "label": "Diencephalon"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftaorganteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left anterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftcocentraloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left central operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftfofrontaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left frontal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftfrpfrontalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left frontal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftgregyrusrectus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left gyrus rectus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftlorglateralorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left lateral orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmfcmedialfrontalcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left medial frontal cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmfgmiddlefrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmorgmedialorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left medial orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmprgprecentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left precentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmsfgsuperiorfrontalgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior frontal gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftopifgopercularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left opercular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftorifgorbitalpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left orbital part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpoparietaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left parietal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftporgposteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left posterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftprgprecentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left precentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftscasubcallosalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left subcallosal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsfgsuperiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsmcsupplementarymotorcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left supplementary motor cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "lefttrifgtriangularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left triangular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightaorganteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right anterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcocentraloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right central operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightfofrontaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right frontal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightfrpfrontalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right frontal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightgregyrusrectus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right gyrus rectus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightlorglateralorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right lateral orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmfcmedialfrontalcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right medial frontal cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmfgmiddlefrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmorgmedialorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right medial orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmprgprecentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right precentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmsfgsuperiorfrontalgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior frontal gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightopifgopercularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right opercular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightorifgorbitalpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right orbital part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpoparietaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right parietal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightporgposteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right posterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightprgprecentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right precentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightscasubcallosalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right subcallosal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsfgsuperiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsmcsupplementarymotorcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right supplementary motor cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "righttrifgtriangularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right triangular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "frontal",
+              "label": "Frontal"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftainsanteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left anterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpinsposteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left posterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightainsanteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right anterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpinsposteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right posterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "insula",
+              "label": "Insula"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftacgganteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left anterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftententorhinalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left entorhinal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "lefthippocampus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Hippocampus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmcggmiddlecingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpcggposteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left posterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftphgparahippocampalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left parahippocampal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftthalamusproper",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Thalamus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightacgganteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right anterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightententorhinalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right entorhinal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "righthippocampus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Hippocampus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmcggmiddlecingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpcggposteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right posterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightphgparahippocampalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right parahippocampal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightthalamusproper",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Thalamus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "limbic",
+              "label": "Limbic"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftcalccalcarinecortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left calcarine cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftcuncuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left cuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftioginferioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left inferior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftliglingualgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left lingual gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmogmiddleoccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftocpoccipitalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left occipital pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftofugoccipitalfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left occipital fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsogsuperioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcalccalcarinecortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right calcarine cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcuncuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right cuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightioginferioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right inferior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightliglingualgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right lingual gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmogmiddleoccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightocpoccipitalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right occipital pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightofugoccipitalfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right occipital fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsogsuperioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "occipital",
+              "label": "Occipital"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftangangulargyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left angular gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmpogpostcentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left postcentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpcuprecuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left precuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpogpostcentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left postcentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsmgsupramarginalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left supramarginal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsplsuperiorparietallobule",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior parietal lobule",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightangangulargyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right angular gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
                 {
-                    "code": "ppmi",
-                    "label": "PPMI"
+                  "isCategorical": false,
+                  "code": "rightmpogpostcentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right postcentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
                 },
                 {
-                    "code": "edsd",
-                    "label": "EDSD"
+                  "isCategorical": false,
+                  "code": "rightpcuprecuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right precuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
                 },
                 {
-                    "code": "desd-synthdata",
-                    "label": "DESD-synthdata"
+                  "isCategorical": false,
+                  "code": "rightpogpostcentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right postcentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
                 },
                 {
-                    "code": "fake_longitudinal",
-                    "label": "Longitudinal"
+                  "isCategorical": false,
+                  "code": "rightsmgsupramarginalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right supramarginal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsplsuperiorparietallobule",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior parietal lobule",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
                 }
-            ],
-            "label": "Dataset",
-            "units": "",
-            "type": "nominal",
-            "methodology": "mip-cde"
+              ],
+              "code": "parietal",
+              "label": "Parietal"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftfugfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftitginferiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left inferior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmtgmiddletemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftppplanumpolare",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left planum polare",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftptplanumtemporale",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left planum temporale",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftstgsuperiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "lefttmptemporalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left temporal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftttgtransversetemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left transverse temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightfugfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightitginferiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right inferior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmtgmiddletemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightppplanumpolare",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right planum polare",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightptplanumtemporale",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right planum temporale",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightstgsuperiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "righttmptemporalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right temporal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightttgtransversetemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right transverse temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": "mip-cde"
+                }
+              ],
+              "code": "temporal",
+              "label": "Temporal"
+            }
+          ],
+          "label": "Grey_matter_volume"
+        },
+        {
+          "variables": [
+            {
+              "isCategorical": false,
+              "code": "leftcerebellumwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left Cerebellum White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "leftcerebralwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left Cerebral White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "opticchiasm",
+              "sql_type": "real",
+              "description": "",
+              "label": "Optic chiasm",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "rightcerebellumwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right Cerebellum White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "rightcerebralwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right Cerebral White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "white_matter_volume",
+          "label": "White_matter_volume"
+        }
+      ],
+      "label": "Brain_anatomy"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "alzheimerbroadcategory",
+          "sql_type": "text",
+          "description": "There will be two broad categories taken into account. Alzheimer s disease (AD) in which the diagnostic is 100% certain and <Other> comprising the rest of Alzheimer s related categories. The <Other> category refers to Alzheime s related diagnosis which origin can be traced to other pathology eg. vascular. In this category MCI diagnosis can also be found. In summary  all Alzheimer s related diagnosis that are not pure.",
+          "enumerations": [
+            {
+              "code": "AD",
+              "label": "Alzheimer’s disease"
+            },
+            {
+              "code": "CN",
+              "label": "Cognitively Normal"
+            },
+            {
+              "code": "Other",
+              "label": "Other"
+            },
+            {
+              "code": "MCI",
+              "label": "Mild cognitive impairment"
+            }
+          ],
+          "label": "Alzheimer Broad Category",
+          "units": "",
+          "type": "nominal",
+          "methodology": "mip-cde"
         },
         {
-            "isCategorical": false,
-            "code": "subjectvisitid",
-            "sql_type": "text",
-            "description": "The ID of the Patient’s Visit",
-            "label": "Visit ID",
-            "units": "",
-            "type": "text",
-            "methodology": ""
+          "isCategorical": true,
+          "code": "neurodegenerativescategories",
+          "sql_type": "text",
+          "description": "There will be two broad categories taken into account. Parkinson s disease without disability or light disability: Without fluctuation of the effect. Dementia in Parkinson s disease",
+          "enumerations": [
+            {
+              "code": "PD",
+              "label": "Parkinson’s disease"
+            },
+            {
+              "code": "AD",
+              "label": "Alzheimer’s disease"
+            },
+            {
+              "code": "HD",
+              "label": "Huntington’s disease\""
+            },
+            {
+              "code": "ALS",
+              "label": "Amyotrophic lateral sclerosis"
+            },
+            {
+              "code": "BD",
+              "label": "Batten disease"
+            },
+            {
+              "code": "MCI",
+              "label": "MCI"
+            },
+            {
+              "code": "LBD",
+              "label": "Lewy body dementia"
+            },
+            {
+              "code": "CJD",
+              "label": "Creutzfeldt Jakob disease"
+            },
+            {
+              "code": "FTD",
+              "label": "Frontotemporal dementia"
+            },
+            {
+              "code": "MS",
+              "label": "Multiple sclerosis"
+            },
+            {
+              "code": "CN",
+              "label": "Cognitively normal"
+            }
+          ],
+          "label": "Neurodegeneratives categories",
+          "units": "",
+          "type": "nominal",
+          "methodology": "mip-cde"
         },
         {
-            "isCategorical": false,
-            "code": "subjectvisitdate",
-            "sql_type": "text",
-            "description": "The date of the Patient’s Visit",
-            "label": "Visit Date",
-            "units": "",
-            "type": "date",
-            "methodology": ""
+          "isCategorical": true,
+          "code": "parkinsonbroadcategory",
+          "sql_type": "text",
+          "description": "There will be two broad categories taken into account. Parkinson s disease without disability or light disability: Without fluctuation of the effect. Dementia in Parkinson s disease",
+          "enumerations": [
+            {
+              "code": "PD",
+              "label": "Dementia in Parkinson''s disease"
+            },
+            {
+              "code": "CN",
+              "label": "Healthy control"
+            },
+            {
+              "code": "Other",
+              "label": "Parkinson''s disease without disability or light disability: Without fluctuation of the effect"
+            }
+          ],
+          "label": "Parkinson Broad Category",
+          "units": "",
+          "type": "nominal",
+          "methodology": "mip-cde"
         }
-    ],
-    "code": "dementia",
-    "groups": [
+      ],
+      "code": "diagnosis",
+      "groups": [
         {
-            "variables": [
-                {
-                    "isCategorical": false,
-                    "code": "av45",
-                    "sql_type": "real",
-                    "description": "AV45 Average AV45 SUVR of frontal  anterior cingulate  precuneus  and parietal cortex\\nrelative to the cerebellum",
-                    "label": "AV45",
-                    "units": "",
-                    "type": "real",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": false,
-                    "code": "fdg",
-                    "sql_type": "real",
-                    "description": "Average FDG-PET of angular  temporal  and posterior cingulate. Most important hypometabolic regions that are indicative of pathological metabolic change in MCI and AD.",
-                    "label": "FDG-PET",
-                    "units": "",
-                    "type": "real",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": false,
-                    "code": "pib",
-                    "sql_type": "real",
-                    "description": "Average PIB SUVR of frontal cortex  anterior cingulate  precuneus cortex  and parietal cortex.",
-                    "label": "PIB",
-                    "units": "",
-                    "type": "real",
-                    "methodology": "mip-cde"
+          "variables": [
+            {
+              "isCategorical": true,
+              "code": "adnicategory",
+              "sql_type": "text",
+              "description": "Terms aggregating illnesses into classes. Note that the diagnosis in this categories are given only for the ADNI data set.",
+              "enumerations": [
+                {
+                  "code": "AD",
+                  "label": "Alzheimer’s Disease"
+                },
+                {
+                  "code": "MCI",
+                  "label": "Mild Cognitive Impairment"
+                },
+                {
+                  "code": "CN",
+                  "label": "Cognitively Normal"
                 }
-            ],
-            "code": "pet",
-            "label": "Pet"
-        },
-        {
-            "variables": [
-                {
-                    "isCategorical": false,
-                    "code": "brainstem",
-                    "sql_type": "real",
-                    "description": "Brainstem volume",
-                    "label": "Brainstem",
-                    "units": "cm3",
-                    "type": "real",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": false,
-                    "code": "tiv",
-                    "sql_type": "real",
-                    "description": "Total intra-cranial volume",
-                    "label": "TIV",
-                    "units": "cm3",
-                    "type": "real",
-                    "methodology": "mip-cde"
+              ],
+              "label": "ADNI category",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "edsdcategory",
+              "sql_type": "text",
+              "description": "Terms aggregating illnesses into classes. Note that the diagnosis in this categories are given only for the EDSD data set.",
+              "enumerations": [
+                {
+                  "code": "AD",
+                  "label": "Alzheimer’s Disease"
+                },
+                {
+                  "code": "MCI",
+                  "label": "Mild Cognitive Impairment"
+                },
+                {
+                  "code": "CN",
+                  "label": "Cognitively Normal"
                 }
-            ],
-            "code": "brain_anatomy",
-            "groups": [
-                {
-                    "variables": [
-                        {
-                            "isCategorical": false,
-                            "code": "_3rdventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "3rd Ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "_4thventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "4th Ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "csfglobal",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "CSF global",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "leftinflatvent",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left inferior lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "leftlateralventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightinflatvent",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right inferior lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightlateralventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "csf_volume",
-                    "label": "Csf_volume"
-                },
-                {
-                    "code": "grey_matter_volume",
-                    "groups": [
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "cerebellarvermallobulesiv",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Cerebellar Vermal Lobules I-V",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "cerebellarvermallobulesviiix",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Cerebellar Vermal Lobules VIII-X",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "cerebellarvermallobulesvivii",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Cerebellar Vermal Lobules VI-VII",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcerebellumexterior",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Cerebellum Exterior",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcerebellumexterior",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Cerebellum Exterior",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "cerebellum",
-                            "label": "Cerebellum"
-                        },
-                        {
-                            "code": "cerebral_nuclei",
-                            "groups": [
-                                {
-                                    "variables": [
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftamygdala",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Amygdala",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightamygdala",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Amygdala",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        }
-                                    ],
-                                    "code": "amygdala",
-                                    "label": "Amygdala"
-                                },
-                                {
-                                    "variables": [
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftaccumbensarea",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Accumbens Area",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftbasalforebrain",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Basal Forebrain",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftcaudate",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Caudate",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftpallidum",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Pallidum",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftputamen",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Putamen",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightaccumbensarea",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Accumbens Area",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightbasalforebrain",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Basal Forebrain",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightcaudate",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Caudate",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightpallidum",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Pallidum",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightputamen",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Putamen",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": "mip-cde"
-                                        }
-                                    ],
-                                    "code": "basal_ganglia",
-                                    "label": "Basal_ganglia"
-                                }
-                            ],
-                            "label": "Cerebral_nuclei"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftventraldc",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Ventral DC",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightventraldc",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Ventral DC",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "diencephalon",
-                            "label": "Diencephalon"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftaorganteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left anterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcocentraloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left central operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftfofrontaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left frontal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftfrpfrontalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left frontal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftgregyrusrectus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left gyrus rectus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftlorglateralorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left lateral orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmfcmedialfrontalcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left medial frontal cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmfgmiddlefrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmorgmedialorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left medial orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmprgprecentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left precentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmsfgsuperiorfrontalgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior frontal gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftopifgopercularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left opercular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftorifgorbitalpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left orbital part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpoparietaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left parietal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftporgposteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left posterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftprgprecentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left precentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftscasubcallosalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left subcallosal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsfgsuperiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsmcsupplementarymotorcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left supplementary motor cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "lefttrifgtriangularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left triangular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightaorganteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right anterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcocentraloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right central operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightfofrontaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right frontal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightfrpfrontalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right frontal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightgregyrusrectus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right gyrus rectus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightlorglateralorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right lateral orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmfcmedialfrontalcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right medial frontal cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmfgmiddlefrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmorgmedialorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right medial orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmprgprecentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right precentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmsfgsuperiorfrontalgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior frontal gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightopifgopercularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right opercular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightorifgorbitalpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right orbital part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpoparietaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right parietal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightporgposteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right posterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightprgprecentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right precentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightscasubcallosalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right subcallosal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsfgsuperiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsmcsupplementarymotorcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right supplementary motor cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "righttrifgtriangularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right triangular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "frontal",
-                            "label": "Frontal"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftainsanteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left anterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpinsposteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left posterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightainsanteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right anterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpinsposteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right posterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "insula",
-                            "label": "Insula"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftacgganteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left anterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftententorhinalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left entorhinal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "lefthippocampus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Hippocampus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmcggmiddlecingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpcggposteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left posterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftphgparahippocampalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left parahippocampal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftthalamusproper",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Thalamus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightacgganteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right anterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightententorhinalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right entorhinal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "righthippocampus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Hippocampus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmcggmiddlecingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpcggposteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right posterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightphgparahippocampalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right parahippocampal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightthalamusproper",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Thalamus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "limbic",
-                            "label": "Limbic"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcalccalcarinecortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left calcarine cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcuncuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left cuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftioginferioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left inferior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftliglingualgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left lingual gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmogmiddleoccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftocpoccipitalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left occipital pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftofugoccipitalfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left occipital fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsogsuperioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcalccalcarinecortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right calcarine cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcuncuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right cuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightioginferioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right inferior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightliglingualgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right lingual gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmogmiddleoccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightocpoccipitalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right occipital pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightofugoccipitalfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right occipital fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsogsuperioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "occipital",
-                            "label": "Occipital"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftangangulargyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left angular gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmpogpostcentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left postcentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpcuprecuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left precuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpogpostcentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left postcentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsmgsupramarginalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left supramarginal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsplsuperiorparietallobule",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior parietal lobule",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightangangulargyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right angular gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmpogpostcentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right postcentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpcuprecuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right precuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpogpostcentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right postcentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsmgsupramarginalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right supramarginal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsplsuperiorparietallobule",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior parietal lobule",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "parietal",
-                            "label": "Parietal"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftfugfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftitginferiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left inferior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmtgmiddletemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftppplanumpolare",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left planum polare",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftptplanumtemporale",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left planum temporale",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftstgsuperiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "lefttmptemporalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left temporal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftttgtransversetemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left transverse temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightfugfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightitginferiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right inferior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmtgmiddletemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightppplanumpolare",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right planum polare",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightptplanumtemporale",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right planum temporale",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightstgsuperiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "righttmptemporalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right temporal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightttgtransversetemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right transverse temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": "mip-cde"
-                                }
-                            ],
-                            "code": "temporal",
-                            "label": "Temporal"
-                        }
-                    ],
-                    "label": "Grey_matter_volume"
-                },
-                {
-                    "variables": [
-                        {
-                            "isCategorical": false,
-                            "code": "leftcerebellumwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left Cerebellum White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "leftcerebralwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left Cerebral White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "opticchiasm",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Optic chiasm",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightcerebellumwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right Cerebellum White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightcerebralwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right Cerebral White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "white_matter_volume",
-                    "label": "White_matter_volume"
+              ],
+              "label": "EDSD category",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "ppmicategory",
+              "sql_type": "text",
+              "description": "Terms aggregating the Parkinson s diseases into classes. For this instance the diagnosis given at enrollment is taken as the clinical diagnosis. Note that the diagnosis in this categories are given only for the PPMI data set.",
+              "enumerations": [
+                {
+                  "code": "PD",
+                  "label": "Parkinson disease"
+                },
+                {
+                  "code": "HC",
+                  "label": "Healthy controls"
+                },
+                {
+                  "code": "PRODROMA",
+                  "label": "Prodromal"
+                },
+                {
+                  "code": "GENPD",
+                  "label": "Genetic PD patients with a mutation (LRRK2, GBA or SNCA)"
+                },
+                {
+                  "code": "REGUN",
+                  "label": "Genetic Unaffected patients with a mutation (LRRK2, GBA or SNCA)"
+                },
+                {
+                  "code": "REGPD",
+                  "label": "Genetic registry PD subjects with a mutation (LRRK2, GBA or SNCA)"
                 }
-            ],
-            "label": "Brain_anatomy"
+              ],
+              "label": "PPMI category",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "dataset_specific_diagnosis",
+          "label": "Dataset_specific_diagnosis"
         },
         {
-            "variables": [
-                {
-                    "isCategorical": true,
-                    "code": "alzheimerbroadcategory",
-                    "sql_type": "text",
-                    "description": "There will be two broad categories taken into account. Alzheimer s disease (AD) in which the diagnostic is 100% certain and <Other> comprising the rest of Alzheimer s related categories. The <Other> category refers to Alzheime s related diagnosis which origin can be traced to other pathology eg. vascular. In this category MCI diagnosis can also be found. In summary  all Alzheimer s related diagnosis that are not pure.",
-                    "enumerations": [
-                        {
-                            "code": "AD",
-                            "label": "Alzheimer’s disease"
-                        },
-                        {
-                            "code": "CN",
-                            "label": "Cognitively Normal"
-                        },
-                        {
-                            "code": "Other",
-                            "label": "Other"
-                        },
-                        {
-                            "code": "MCI",
-                            "label": "Mild cognitive impairment"
-                        }
-                    ],
-                    "label": "Alzheimer Broad Category",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": true,
-                    "code": "neurodegenerativescategories",
-                    "sql_type": "text",
-                    "description": "There will be two broad categories taken into account. Parkinson s disease without disability or light disability: Without fluctuation of the effect. Dementia in Parkinson s disease",
-                    "enumerations": [
-                        {
-                            "code": "PD",
-                            "label": "Parkinson’s disease"
-                        },
-                        {
-                            "code": "AD",
-                            "label": "Alzheimer’s disease"
-                        },
-                        {
-                            "code": "HD",
-                            "label": "Huntington’s disease\""
-                        },
-                        {
-                            "code": "ALS",
-                            "label": "Amyotrophic lateral sclerosis"
-                        },
-                        {
-                            "code": "BD",
-                            "label": "Batten disease"
-                        },
-                        {
-                            "code": "MCI",
-                            "label": "MCI"
-                        },
-                        {
-                            "code": "LBD",
-                            "label": "Lewy body dementia"
-                        },
-                        {
-                            "code": "CJD",
-                            "label": "Creutzfeldt Jakob disease"
-                        },
-                        {
-                            "code": "FTD",
-                            "label": "Frontotemporal dementia"
-                        },
-                        {
-                            "code": "MS",
-                            "label": "Multiple sclerosis"
-                        },
-                        {
-                            "code": "CN",
-                            "label": "Cognitively normal"
-                        }
-                    ],
-                    "label": "Neurodegeneratives categories",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": true,
-                    "code": "parkinsonbroadcategory",
-                    "sql_type": "text",
-                    "description": "There will be two broad categories taken into account. Parkinson s disease without disability or light disability: Without fluctuation of the effect. Dementia in Parkinson s disease",
-                    "enumerations": [
-                        {
-                            "code": "PD",
-                            "label": "Dementia in Parkinson''s disease"
-                        },
-                        {
-                            "code": "CN",
-                            "label": "Healthy control"
-                        },
-                        {
-                            "code": "Other",
-                            "label": "Parkinson''s disease without disability or light disability: Without fluctuation of the effect"
-                        }
-                    ],
-                    "label": "Parkinson Broad Category",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": "mip-cde"
-                }
-            ],
-            "code": "diagnosis",
-            "groups": [
-                {
-                    "variables": [
-                        {
-                            "isCategorical": true,
-                            "code": "adnicategory",
-                            "sql_type": "text",
-                            "description": "Terms aggregating illnesses into classes. Note that the diagnosis in this categories are given only for the ADNI data set.",
-                            "enumerations": [
-                                {
-                                    "code": "AD",
-                                    "label": "Alzheimer’s Disease"
-                                },
-                                {
-                                    "code": "MCI",
-                                    "label": "Mild Cognitive Impairment"
-                                },
-                                {
-                                    "code": "CN",
-                                    "label": "Cognitively Normal"
-                                }
-                            ],
-                            "label": "ADNI category",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "edsdcategory",
-                            "sql_type": "text",
-                            "description": "Terms aggregating illnesses into classes. Note that the diagnosis in this categories are given only for the EDSD data set.",
-                            "enumerations": [
-                                {
-                                    "code": "AD",
-                                    "label": "Alzheimer’s Disease"
-                                },
-                                {
-                                    "code": "MCI",
-                                    "label": "Mild Cognitive Impairment"
-                                },
-                                {
-                                    "code": "CN",
-                                    "label": "Cognitively Normal"
-                                }
-                            ],
-                            "label": "EDSD category",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "ppmicategory",
-                            "sql_type": "text",
-                            "description": "Terms aggregating the Parkinson s diseases into classes. For this instance the diagnosis given at enrollment is taken as the clinical diagnosis. Note that the diagnosis in this categories are given only for the PPMI data set.",
-                            "enumerations": [
-                                {
-                                    "code": "PD",
-                                    "label": "Parkinson disease"
-                                },
-                                {
-                                    "code": "HC",
-                                    "label": "Healthy controls"
-                                },
-                                {
-                                    "code": "PRODROMA",
-                                    "label": "Prodromal"
-                                },
-                                {
-                                    "code": "GENPD",
-                                    "label": "Genetic PD patients with a mutation (LRRK2, GBA or SNCA)"
-                                },
-                                {
-                                    "code": "REGUN",
-                                    "label": "Genetic Unaffected patients with a mutation (LRRK2, GBA or SNCA)"
-                                },
-                                {
-                                    "code": "REGPD",
-                                    "label": "Genetic registry PD subjects with a mutation (LRRK2, GBA or SNCA)"
-                                }
-                            ],
-                            "label": "PPMI category",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "dataset_specific_diagnosis",
-                    "label": "Dataset_specific_diagnosis"
-                },
-                {
-                    "variables": [
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_etiology_1",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:etiology:1",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_etiology_2",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:etiology:2",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_etiology_3",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:etiology:3",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_lng",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:lng",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_lngapp",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:lngapp",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_stade",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:stade",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_stademin",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:stademin",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_syndamn",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:syndamn",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_syndoth",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:syndoth",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "DIAG_syndr",
-                            "sql_type": "text",
-                            "description": "",
-                            "label": "DIAG:syndr",
-                            "units": "",
-                            "type": "text",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "bna",
-                    "label": "Bna"
-                }
-            ],
-            "label": "Diagnosis"
+          "variables": [
+            {
+              "isCategorical": false,
+              "code": "DIAG_etiology_1",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:etiology:1",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_etiology_2",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:etiology:2",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_etiology_3",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:etiology:3",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_lng",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:lng",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_lngapp",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:lngapp",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_stade",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:stade",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_stademin",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:stademin",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_syndamn",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:syndamn",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_syndoth",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:syndoth",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "DIAG_syndr",
+              "sql_type": "text",
+              "description": "",
+              "label": "DIAG:syndr",
+              "units": "",
+              "type": "text",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "bna",
+          "label": "Bna"
+        }
+      ],
+      "label": "Diagnosis"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": false,
+          "minValue": 0,
+          "code": "minimentalstate",
+          "maxValue": 30,
+          "sql_type": "int",
+          "description": "The Mini Mental State Examination (MMSE) or Folstein test is a 30-point questionnaire that is used extensively in clinical and research settings to measure cognitive impairment. It is commonly used to screen for dementia.",
+          "label": "MMSE Total scores",
+          "units": "",
+          "type": "integer",
+          "methodology": "mip-cde"
         },
         {
-            "variables": [
-                {
-                    "isCategorical": false,
-                    "minValue": 0,
-                    "code": "minimentalstate",
-                    "maxValue": 30,
-                    "sql_type": "int",
-                    "description": "The Mini Mental State Examination (MMSE) or Folstein test is a 30-point questionnaire that is used extensively in clinical and research settings to measure cognitive impairment. It is commonly used to screen for dementia.",
-                    "label": "MMSE Total scores",
-                    "units": "",
-                    "type": "integer",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": false,
-                    "minValue": 0,
-                    "code": "montrealcognitiveassessment",
-                    "maxValue": 30,
-                    "sql_type": "int",
-                    "description": "The Montreal Cognitive Assessment (MoCA) was designed as a rapid screening instrument for mild cognitive dysfunction. It assesses different cognitive domains: attention and concentration  executive functions  memory  language  visuoconstructional skills  conceptual thinking  calculations  and orientation. MoCA Total Scores refer to the final count obtained by patients after the complete test is performed.",
-                    "label": "MoCA Total",
-                    "units": "",
-                    "type": "integer",
-                    "methodology": "mip-cde"
-                }
-            ],
-            "code": "neuropsychology",
-            "groups": [
-                {
-                    "variables": [
-                        {
-                            "isCategorical": true,
-                            "code": "updrshy",
-                            "sql_type": "text",
-                            "description": "The Hoehn and Yahr scale (HY) is a widely used clinical rating scale  which defines broad categories of motor function in Parkinson\\u2019s disease (PD). It captures typical patterns of progressive motor impairment.",
-                            "enumerations": [
-                                {
-                                    "code": "1",
-                                    "label": "Unilateral involvement only usually with minimal or no functional disability"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "Bilateral or midline involvement without impairment of balance"
-                                },
-                                {
-                                    "code": "3",
-                                    "label": "Bilateral disease: mild to moderate disability with impaired postural reflexes; physically independent"
-                                },
-                                {
-                                    "code": "4",
-                                    "label": "Severely disabling disease; still able to walk or stand unassisted"
-                                },
-                                {
-                                    "code": "5",
-                                    "label": "Confinement to bed or wheelchair unless aided"
-                                }
-                            ],
-                            "label": "UPDRS HY",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "minValue": 0,
-                            "code": "updrstotal",
-                            "maxValue": 172,
-                            "sql_type": "int",
-                            "description": "The unified Parkinson s disease rating scale (UPDRS) is used to follow the longitudinal course of Parkinson s disease. The UPD rating scale is the most commonly used scale in the clinical study of Parkinson s disease.",
-                            "label": "UPDRS Total",
-                            "units": "",
-                            "type": "integer",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "updrs",
-                    "label": "Updrs"
+          "isCategorical": false,
+          "minValue": 0,
+          "code": "montrealcognitiveassessment",
+          "maxValue": 30,
+          "sql_type": "int",
+          "description": "The Montreal Cognitive Assessment (MoCA) was designed as a rapid screening instrument for mild cognitive dysfunction. It assesses different cognitive domains: attention and concentration  executive functions  memory  language  visuoconstructional skills  conceptual thinking  calculations  and orientation. MoCA Total Scores refer to the final count obtained by patients after the complete test is performed.",
+          "label": "MoCA Total",
+          "units": "",
+          "type": "integer",
+          "methodology": "mip-cde"
+        }
+      ],
+      "code": "neuropsychology",
+      "groups": [
+        {
+          "variables": [
+            {
+              "isCategorical": true,
+              "code": "updrshy",
+              "sql_type": "text",
+              "description": "The Hoehn and Yahr scale (HY) is a widely used clinical rating scale  which defines broad categories of motor function in Parkinson\\u2019s disease (PD). It captures typical patterns of progressive motor impairment.",
+              "enumerations": [
+                {
+                  "code": "1",
+                  "label": "Unilateral involvement only usually with minimal or no functional disability"
+                },
+                {
+                  "code": "2",
+                  "label": "Bilateral or midline involvement without impairment of balance"
+                },
+                {
+                  "code": "3",
+                  "label": "Bilateral disease: mild to moderate disability with impaired postural reflexes; physically independent"
+                },
+                {
+                  "code": "4",
+                  "label": "Severely disabling disease; still able to walk or stand unassisted"
+                },
+                {
+                  "code": "5",
+                  "label": "Confinement to bed or wheelchair unless aided"
                 }
-            ],
-            "label": "Neuropsychology"
+              ],
+              "label": "UPDRS HY",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "minValue": 0,
+              "code": "updrstotal",
+              "maxValue": 172,
+              "sql_type": "int",
+              "description": "The unified Parkinson s disease rating scale (UPDRS) is used to follow the longitudinal course of Parkinson s disease. The UPD rating scale is the most commonly used scale in the clinical study of Parkinson s disease.",
+              "label": "UPDRS Total",
+              "units": "",
+              "type": "integer",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "updrs",
+          "label": "Updrs"
+        }
+      ],
+      "label": "Neuropsychology"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "agegroup",
+          "sql_type": "text",
+          "description": "Age Group",
+          "enumerations": [
+            {
+              "code": "-50y",
+              "label": "-50y"
+            },
+            {
+              "code": "50-59y",
+              "label": "50-59y"
+            },
+            {
+              "code": "60-69y",
+              "label": "60-69y"
+            },
+            {
+              "code": "70-79y",
+              "label": "70-79y"
+            },
+            {
+              "code": "+80y",
+              "label": "+80y"
+            }
+          ],
+          "label": "agegroup",
+          "units": "",
+          "type": "nominal",
+          "methodology": "mip-cde"
         },
         {
-            "variables": [
-                {
-                    "isCategorical": true,
-                    "code": "agegroup",
-                    "sql_type": "text",
-                    "description": "Age Group",
-                    "enumerations": [
-                        {
-                            "code": "-50y",
-                            "label": "-50y"
-                        },
-                        {
-                            "code": "50-59y",
-                            "label": "50-59y"
-                        },
-                        {
-                            "code": "60-69y",
-                            "label": "60-69y"
-                        },
-                        {
-                            "code": "70-79y",
-                            "label": "70-79y"
-                        },
-                        {
-                            "code": "+80y",
-                            "label": "+80y"
-                        }
-                    ],
-                    "label": "agegroup",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": true,
-                    "code": "gender",
-                    "sql_type": "text",
-                    "description": "Gender of the patient - Sex assigned at birth",
-                    "enumerations": [
-                        {
-                            "code": "M",
-                            "label": "Male"
-                        },
-                        {
-                            "code": "F",
-                            "label": "Female"
-                        }
-                    ],
-                    "label": "Gender",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": true,
-                    "code": "handedness",
-                    "sql_type": "text",
-                    "description": "Describes the tendency of the patient to use either the right or the left hand more naturally than the other.",
-                    "enumerations": [
-                        {
-                            "code": "R",
-                            "label": "Right"
-                        },
-                        {
-                            "code": "L",
-                            "label": "Left"
-                        },
-                        {
-                            "code": "A",
-                            "label": "Ambidextrous"
-                        }
-                    ],
-                    "label": "Handedness",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": false,
-                    "minValue": 0,
-                    "code": "subjectage",
-                    "maxValue": 130,
-                    "sql_type": "real",
-                    "description": "Exact age of the subject  for datasets that allow such precision.",
-                    "label": "Exact age",
-                    "units": "years",
-                    "type": "real",
-                    "methodology": "mip-cde"
-                },
-                {
-                    "isCategorical": false,
-                    "minValue": 0,
-                    "code": "subjectageyears",
-                    "maxValue": 130,
-                    "sql_type": "int",
-                    "description": "Subject age in years.",
-                    "label": "Age Years",
-                    "units": "years",
-                    "type": "integer",
-                    "methodology": "mip-cde"
-                }
-            ],
-            "code": "demographics",
-            "label": "Demographics"
+          "isCategorical": true,
+          "code": "gender",
+          "sql_type": "text",
+          "description": "Gender of the patient - Sex assigned at birth",
+          "enumerations": [
+            {
+              "code": "M",
+              "label": "Male"
+            },
+            {
+              "code": "F",
+              "label": "Female"
+            }
+          ],
+          "label": "Gender",
+          "units": "",
+          "type": "nominal",
+          "methodology": "mip-cde"
         },
         {
-            "code": "genetic",
-            "groups": [
-                {
-                    "variables": [
-                        {
-                            "isCategorical": true,
-                            "code": "apoe4",
-                            "sql_type": "text",
-                            "description": "Apolipoprotein E (APOE) e4 allele: is the strongest risk factor for Late Onset Alzheimer Disease (LOAD). At least one copy of APOE-e4 ",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "ApoE4",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs10498633_t",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs10498633_T",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs11136000_t",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs11136000_T",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs11767557_c",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs11767557_C",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs1476679_c",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs1476679_C",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs17125944_c",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs17125944_C",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs190982_g",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs190982_G",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs2718058_g",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs2718058_G",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs3764650_g",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs3764650_G",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs3818361_t",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs3818361_T",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs3851179_a",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs3851179_A",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs3865444_t",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs3865444_T",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs610932_a",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs610932_A",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": true,
-                            "code": "rs744373_c",
-                            "sql_type": "text",
-                            "description": "",
-                            "enumerations": [
-                                {
-                                    "code": "0",
-                                    "label": "0"
-                                },
-                                {
-                                    "code": "1",
-                                    "label": "1"
-                                },
-                                {
-                                    "code": "2",
-                                    "label": "2"
-                                }
-                            ],
-                            "label": "rs744373_C",
-                            "units": "",
-                            "type": "nominal",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "polymorphism",
-                    "label": "Polymorphism"
-                }
-            ],
-            "label": "Genetic"
+          "isCategorical": true,
+          "code": "handedness",
+          "sql_type": "text",
+          "description": "Describes the tendency of the patient to use either the right or the left hand more naturally than the other.",
+          "enumerations": [
+            {
+              "code": "R",
+              "label": "Right"
+            },
+            {
+              "code": "L",
+              "label": "Left"
+            },
+            {
+              "code": "A",
+              "label": "Ambidextrous"
+            }
+          ],
+          "label": "Handedness",
+          "units": "",
+          "type": "nominal",
+          "methodology": "mip-cde"
         },
         {
-            "code": "proteome",
-            "groups": [
-                {
-                    "variables": [
-                        {
-                            "isCategorical": false,
-                            "code": "ab1_42",
-                            "sql_type": "real",
-                            "description": "A\\u03b2 is the main component of amyloid plaques (extracellular deposits found in the brains of patients with Alzheimer’s disease). Similar plaques appear in some variants of Lewy body dementia and in inclusion body myositis (a muscle disease), while A\\u03b2 can also form the aggregates that coat cerebral blood vessels in cerebral amyloid angiopathy. The plaques are composed of a tangle of regularly ordered fibrillar aggregates called amyloid fibers, a protein fold shared by other peptides such as the prions associated with protein misfolding diseases.",
-                            "label": "Level of amyloid beta 1-42 peptides in cerebrospinal fluid",
-                            "units": "",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "ab1_40",
-                            "sql_type": "real",
-                            "description": "A\\u03b2 is the main component of amyloid plaques (extracellular deposits found in the brains of patients with Alzheimer's disease). Similar plaques appear in some variants of Lewy body dementia and in inclusion body myositis (a muscle disease), while A\\u03b2 can also form the aggregates that coat cerebral blood vessels in cerebral amyloid angiopathy. The plaques are composed of a tangle of regularly ordered fibrillar aggregates called amyloid fibers, a protein fold shared by other peptides such as the prions associated with protein misfolding diseases.",
-                            "label": "Level od amyloid beta 1-40 peptides ion cerebrospinal fluid",
-                            "units": "",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "t_tau",
-                            "sql_type": "real",
-                            "description": "Tau proteins (or \\u03c4 proteins) are proteins that stabilize microtubules. They are abundant in neurons of the central nervous system and are less common elsewhere, but are also expressed at very low levels in CNS astrocytes and oligodendrocytes. Pathologies and dementias of the nervous system such as Alzheimer’s disease and Parkinson’s disease are associated with tau proteins that have become defective and no longer stabilize microtubules properly.",
-                            "label": "Total level of tau proteins in cerebrospinal fluid",
-                            "units": "",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "p_tau",
-                            "sql_type": "real",
-                            "description": "Hyperphosphorylation of the tau protein (tau inclusions, pTau) can result in the self-assembly of tangles of paired helical filaments and straight filaments, which are involved in the pathogenesis of Alzheimer's disease, frontotemporal dementia, and other tauopathies.",
-                            "label": "Level of phosphorylated tau proteins in cerebrospinal fluid",
-                            "units": "",
-                            "type": "real",
-                            "methodology": "mip-cde"
-                        }
-                    ],
-                    "code": "csf_proteome",
-                    "label": "Csf_proteome"
+          "isCategorical": false,
+          "minValue": 0,
+          "code": "subjectage",
+          "maxValue": 130,
+          "sql_type": "real",
+          "description": "Exact age of the subject  for datasets that allow such precision.",
+          "label": "Exact age",
+          "units": "years",
+          "type": "real",
+          "methodology": "mip-cde"
+        },
+        {
+          "isCategorical": false,
+          "minValue": 0,
+          "code": "subjectageyears",
+          "maxValue": 130,
+          "sql_type": "int",
+          "description": "Subject age in years.",
+          "label": "Age Years",
+          "units": "years",
+          "type": "integer",
+          "methodology": "mip-cde"
+        }
+      ],
+      "code": "demographics",
+      "label": "Demographics"
+    },
+    {
+      "code": "genetic",
+      "groups": [
+        {
+          "variables": [
+            {
+              "isCategorical": true,
+              "code": "apoe4",
+              "sql_type": "text",
+              "description": "Apolipoprotein E (APOE) e4 allele: is the strongest risk factor for Late Onset Alzheimer Disease (LOAD). At least one copy of APOE-e4 ",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "ApoE4",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs10498633_t",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs10498633_T",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs11136000_t",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs11136000_T",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs11767557_c",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs11767557_C",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs1476679_c",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs1476679_C",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs17125944_c",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs17125944_C",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs190982_g",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs190982_G",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs2718058_g",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs2718058_G",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs3764650_g",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs3764650_G",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs3818361_t",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs3818361_T",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs3851179_a",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs3851179_A",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs3865444_t",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
                 }
-            ],
-            "label": "Proteome"
+              ],
+              "label": "rs3865444_T",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs610932_a",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs610932_A",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": true,
+              "code": "rs744373_c",
+              "sql_type": "text",
+              "description": "",
+              "enumerations": [
+                {
+                  "code": "0",
+                  "label": "0"
+                },
+                {
+                  "code": "1",
+                  "label": "1"
+                },
+                {
+                  "code": "2",
+                  "label": "2"
+                }
+              ],
+              "label": "rs744373_C",
+              "units": "",
+              "type": "nominal",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "polymorphism",
+          "label": "Polymorphism"
+        }
+      ],
+      "label": "Genetic"
+    },
+    {
+      "code": "proteome",
+      "groups": [
+        {
+          "variables": [
+            {
+              "isCategorical": false,
+              "code": "ab1_42",
+              "sql_type": "real",
+              "description": "A\\u03b2 is the main component of amyloid plaques (extracellular deposits found in the brains of patients with Alzheimer’s disease). Similar plaques appear in some variants of Lewy body dementia and in inclusion body myositis (a muscle disease), while A\\u03b2 can also form the aggregates that coat cerebral blood vessels in cerebral amyloid angiopathy. The plaques are composed of a tangle of regularly ordered fibrillar aggregates called amyloid fibers, a protein fold shared by other peptides such as the prions associated with protein misfolding diseases.",
+              "label": "Level of amyloid beta 1-42 peptides in cerebrospinal fluid",
+              "units": "",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "ab1_40",
+              "sql_type": "real",
+              "description": "A\\u03b2 is the main component of amyloid plaques (extracellular deposits found in the brains of patients with Alzheimer's disease). Similar plaques appear in some variants of Lewy body dementia and in inclusion body myositis (a muscle disease), while A\\u03b2 can also form the aggregates that coat cerebral blood vessels in cerebral amyloid angiopathy. The plaques are composed of a tangle of regularly ordered fibrillar aggregates called amyloid fibers, a protein fold shared by other peptides such as the prions associated with protein misfolding diseases.",
+              "label": "Level od amyloid beta 1-40 peptides ion cerebrospinal fluid",
+              "units": "",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "t_tau",
+              "sql_type": "real",
+              "description": "Tau proteins (or \\u03c4 proteins) are proteins that stabilize microtubules. They are abundant in neurons of the central nervous system and are less common elsewhere, but are also expressed at very low levels in CNS astrocytes and oligodendrocytes. Pathologies and dementias of the nervous system such as Alzheimer’s disease and Parkinson’s disease are associated with tau proteins that have become defective and no longer stabilize microtubules properly.",
+              "label": "Total level of tau proteins in cerebrospinal fluid",
+              "units": "",
+              "type": "real",
+              "methodology": "mip-cde"
+            },
+            {
+              "isCategorical": false,
+              "code": "p_tau",
+              "sql_type": "real",
+              "description": "Hyperphosphorylation of the tau protein (tau inclusions, pTau) can result in the self-assembly of tangles of paired helical filaments and straight filaments, which are involved in the pathogenesis of Alzheimer's disease, frontotemporal dementia, and other tauopathies.",
+              "label": "Level of phosphorylated tau proteins in cerebrospinal fluid",
+              "units": "",
+              "type": "real",
+              "methodology": "mip-cde"
+            }
+          ],
+          "code": "csf_proteome",
+          "label": "Csf_proteome"
         }
-    ],
-    "label": "Dementia"
+      ],
+      "label": "Proteome"
+    }
+  ],
+  "label": "Dementia"
 }
diff --git a/controller/config/pathologies_metadata/mentalhealth.json b/controller/config/pathologies_metadata/mentalhealth.json
index 7fa9d70f..4933665d 100755
--- a/controller/config/pathologies_metadata/mentalhealth.json
+++ b/controller/config/pathologies_metadata/mentalhealth.json
@@ -1,2752 +1,2752 @@
 {
-    "variables": [
+  "variables": [
+    {
+      "isCategorical": true,
+      "code": "dataset",
+      "sql_type": "text",
+      "description": "",
+      "enumerations": [
         {
-            "isCategorical": true,
-            "code": "dataset",
-            "sql_type": "text",
-            "description": "",
-            "enumerations": [
-                {
-                    "code": "demo",
-                    "label": "Demo"
-                }
-            ],
-            "label": "dataset",
-            "units": "",
-            "type": "nominal",
-            "methodology": ""
+          "code": "demo",
+          "label": "Demo"
         }
-    ],
-    "code": "mentalhealth",
-    "groups": [
+      ],
+      "label": "dataset",
+      "units": "",
+      "type": "nominal",
+      "methodology": ""
+    }
+  ],
+  "code": "mentalhealth",
+  "groups": [
+    {
+      "variables": [
         {
-            "variables": [
-                {
-                    "isCategorical": true,
-                    "code": "sex",
-                    "sql_type": "text",
-                    "description": "gender of the subject",
-                    "enumerations": [
-                        {
-                            "code": "1",
-                            "label": "male"
-                        },
-                        {
-                            "code": "2",
-                            "label": "female"
-                        },
-                        {
-                            "code": "3",
-                            "label": "other"
-                        }
-                    ],
-                    "label": "sex",
-                    "units": "none",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "handedness",
-                    "sql_type": "text",
-                    "description": "handedness of the subject",
-                    "enumerations": [
-                        {
-                            "code": "right",
-                            "label": "right handed"
-                        },
-                        {
-                            "code": "left",
-                            "label": "left handed"
-                        },
-                        {
-                            "code": "unknown",
-                            "label": "unknown"
-                        }
-                    ],
-                    "label": "handedness",
-                    "units": "none",
-                    "type": "nominal",
-                    "methodology": ""
-                }
-            ],
-            "code": "demographic",
-            "label": "Demographic"
+          "isCategorical": true,
+          "code": "sex",
+          "sql_type": "text",
+          "description": "gender of the subject",
+          "enumerations": [
+            {
+              "code": "1",
+              "label": "male"
+            },
+            {
+              "code": "2",
+              "label": "female"
+            },
+            {
+              "code": "3",
+              "label": "other"
+            }
+          ],
+          "label": "sex",
+          "units": "none",
+          "type": "nominal",
+          "methodology": ""
         },
         {
-            "variables": [
-                {
-                    "isCategorical": true,
-                    "code": "A1a",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to mother",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1b",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to father",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1c",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to another mother figure",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1d",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to another father figure",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1e",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to one or more grandparents",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1f",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to one or more other adult relatives",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1g",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to childminder, nanny, au pair",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1h",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to one or more teachers",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1i",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to one or more adult non-relatives",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1k",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to one or more brothers, sisters or other young relatives",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A1l",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no or not applicable"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Special attachment to one or more friends",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A2",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Concern about separation over the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3a",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Concern about loss of, or harm of attachment figures over the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3b",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Unrealistic concern about being taken away from attachment figures over the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3c",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Not wanting to go to school due to fear of harm to attachment figure while at school in the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3d",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Concern about sleeping alone in the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3e",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Sleeping with or checking on attachment figures at night in the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3f",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Concern about sleeping in a strange place in the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3g",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Afraid of being alone at home for the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3h",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Nightmares about separation from attachment figures in the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3i",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Somatic symptoms linked to separations in the past 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A3j",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no more than others (or not applicable)"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little more than others"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot more than others"
-                        }
-                    ],
-                    "label": "Anticipatory anxiety of separations",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A4",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Presence of separation worries for at least 4 weeks",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": false,
-                    "code": "A5",
-                    "sql_type": "real",
-                    "description": "",
-                    "label": "Age of onset",
-                    "units": "",
-                    "type": "real",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A6",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Distress due to these worries",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A7a",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Impact on family life",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A7b",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Impact on frienships",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A7c",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Impact on learning or class work",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A7d",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Impact on leisure",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "A8",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Worries leading to burden on others",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                }
-            ],
-            "code": "separation_anxiety",
-            "label": "Separation_anxiety"
+          "isCategorical": true,
+          "code": "handedness",
+          "sql_type": "text",
+          "description": "handedness of the subject",
+          "enumerations": [
+            {
+              "code": "right",
+              "label": "right handed"
+            },
+            {
+              "code": "left",
+              "label": "left handed"
+            },
+            {
+              "code": "unknown",
+              "label": "unknown"
+            }
+          ],
+          "label": "handedness",
+          "units": "none",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "demographic",
+      "label": "Demographic"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "A1a",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to mother",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
         },
         {
-            "variables": [
-                {
-                    "isCategorical": true,
-                    "code": "B1a",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of animals",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1b",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of some aspects of the natural environment (e.g. storms, thunder, heights or water)",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1c",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of the dark",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1d",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of loud noises",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1e",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of blood - injection - injury",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1f",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of dentists or doctors",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1g",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of vomitting, choking or getting particular diseases",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1h",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of using particular types of transport",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1i",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of small enclosed spaces",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1j",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear od using the toilet",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1k",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear od specific types of people, e.g. clowns",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B1l",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Fear of imaginary or supernatural things",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": false,
-                    "code": "B1m",
-                    "sql_type": "text",
-                    "description": "",
-                    "label": "Any other specific fear (Describe)",
-                    "units": "",
-                    "type": "text",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B2",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "perhaps"
-                        },
-                        {
-                            "code": "2",
-                            "label": "definitely"
-                        }
-                    ],
-                    "label": "Fear is a nuisance to person or others",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B3",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "less than 1 month"
-                        },
-                        {
-                            "code": "1",
-                            "label": "1-5 months"
-                        },
-                        {
-                            "code": "2",
-                            "label": "6 months or more"
-                        }
-                    ],
-                    "label": "Duration in months",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B4",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Anxiety or very upset when fear is triggered",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B5",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "yes"
-                        }
-                    ],
-                    "label": "Upset every time confronted with fears",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B6",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "every now and then"
-                        },
-                        {
-                            "code": "1",
-                            "label": "most weeks"
-                        },
-                        {
-                            "code": "2",
-                            "label": "most days"
-                        },
-                        {
-                            "code": "3",
-                            "label": "many times a day"
-                        }
-                    ],
-                    "label": "How often is fear triggered",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B7",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Avoidance of the phobic stimulus",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B8",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a lot"
-                        }
-                    ],
-                    "label": "Interference of avoidance on daily life",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B9",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "perhaps"
-                        },
-                        {
-                            "code": "2",
-                            "label": "definitely"
-                        }
-                    ],
-                    "label": "Others think fear is excessive",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B10",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "no"
-                        },
-                        {
-                            "code": "1",
-                            "label": "perhaps"
-                        },
-                        {
-                            "code": "2",
-                            "label": "definitely"
-                        }
-                    ],
-                    "label": "Person themselves think fear is excessive",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": true,
-                    "code": "B11",
-                    "sql_type": "text",
-                    "description": "",
-                    "enumerations": [
-                        {
-                            "code": "0",
-                            "label": "not at all"
-                        },
-                        {
-                            "code": "1",
-                            "label": "a little"
-                        },
-                        {
-                            "code": "2",
-                            "label": "a medium amount"
-                        },
-                        {
-                            "code": "3",
-                            "label": "a great deal"
-                        }
-                    ],
-                    "label": "Fears leading to burden on others",
-                    "units": "",
-                    "type": "nominal",
-                    "methodology": ""
-                }
-            ],
-            "code": "Fears_of_specific_things_or_situations",
-            "label": "Fears_of_specific_things_or_situations"
+          "isCategorical": true,
+          "code": "A1b",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to father",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1c",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to another mother figure",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1d",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to another father figure",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1e",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to one or more grandparents",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1f",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to one or more other adult relatives",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1g",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to childminder, nanny, au pair",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1h",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to one or more teachers",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1i",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to one or more adult non-relatives",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1k",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to one or more brothers, sisters or other young relatives",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A1l",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no or not applicable"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Special attachment to one or more friends",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A2",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Concern about separation over the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3a",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Concern about loss of, or harm of attachment figures over the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3b",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Unrealistic concern about being taken away from attachment figures over the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3c",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Not wanting to go to school due to fear of harm to attachment figure while at school in the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3d",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Concern about sleeping alone in the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3e",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Sleeping with or checking on attachment figures at night in the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3f",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Concern about sleeping in a strange place in the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3g",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Afraid of being alone at home for the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3h",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Nightmares about separation from attachment figures in the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3i",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Somatic symptoms linked to separations in the past 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A3j",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no more than others (or not applicable)"
+            },
+            {
+              "code": "1",
+              "label": "a little more than others"
+            },
+            {
+              "code": "2",
+              "label": "a lot more than others"
+            }
+          ],
+          "label": "Anticipatory anxiety of separations",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A4",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Presence of separation worries for at least 4 weeks",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": false,
+          "code": "A5",
+          "sql_type": "real",
+          "description": "",
+          "label": "Age of onset",
+          "units": "",
+          "type": "real",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A6",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Distress due to these worries",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A7a",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Impact on family life",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A7b",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Impact on frienships",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A7c",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Impact on learning or class work",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A7d",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Impact on leisure",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "A8",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Worries leading to burden on others",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "separation_anxiety",
+      "label": "Separation_anxiety"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": true,
+          "code": "B1a",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of animals",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1b",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of some aspects of the natural environment (e.g. storms, thunder, heights or water)",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1c",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of the dark",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1d",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of loud noises",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1e",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of blood - injection - injury",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1f",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of dentists or doctors",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1g",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of vomitting, choking or getting particular diseases",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1h",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of using particular types of transport",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1i",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of small enclosed spaces",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1j",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear od using the toilet",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B1k",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear od specific types of people, e.g. clowns",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
         },
         {
-            "variables": [
-                {
-                    "isCategorical": false,
-                    "code": "brainstem",
-                    "sql_type": "real",
-                    "description": "Brainstem volume",
-                    "label": "Brainstem",
-                    "units": "cm3",
-                    "type": "real",
-                    "methodology": ""
-                },
-                {
-                    "isCategorical": false,
-                    "code": "tiv",
-                    "sql_type": "real",
-                    "description": "Total intra-cranial volume",
-                    "label": "TIV",
-                    "units": "cm3",
-                    "type": "real",
-                    "methodology": ""
+          "isCategorical": true,
+          "code": "B1l",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Fear of imaginary or supernatural things",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": false,
+          "code": "B1m",
+          "sql_type": "text",
+          "description": "",
+          "label": "Any other specific fear (Describe)",
+          "units": "",
+          "type": "text",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B2",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "perhaps"
+            },
+            {
+              "code": "2",
+              "label": "definitely"
+            }
+          ],
+          "label": "Fear is a nuisance to person or others",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B3",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "less than 1 month"
+            },
+            {
+              "code": "1",
+              "label": "1-5 months"
+            },
+            {
+              "code": "2",
+              "label": "6 months or more"
+            }
+          ],
+          "label": "Duration in months",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B4",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Anxiety or very upset when fear is triggered",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B5",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "yes"
+            }
+          ],
+          "label": "Upset every time confronted with fears",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B6",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "every now and then"
+            },
+            {
+              "code": "1",
+              "label": "most weeks"
+            },
+            {
+              "code": "2",
+              "label": "most days"
+            },
+            {
+              "code": "3",
+              "label": "many times a day"
+            }
+          ],
+          "label": "How often is fear triggered",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B7",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Avoidance of the phobic stimulus",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B8",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a lot"
+            }
+          ],
+          "label": "Interference of avoidance on daily life",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B9",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "perhaps"
+            },
+            {
+              "code": "2",
+              "label": "definitely"
+            }
+          ],
+          "label": "Others think fear is excessive",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B10",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "no"
+            },
+            {
+              "code": "1",
+              "label": "perhaps"
+            },
+            {
+              "code": "2",
+              "label": "definitely"
+            }
+          ],
+          "label": "Person themselves think fear is excessive",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        },
+        {
+          "isCategorical": true,
+          "code": "B11",
+          "sql_type": "text",
+          "description": "",
+          "enumerations": [
+            {
+              "code": "0",
+              "label": "not at all"
+            },
+            {
+              "code": "1",
+              "label": "a little"
+            },
+            {
+              "code": "2",
+              "label": "a medium amount"
+            },
+            {
+              "code": "3",
+              "label": "a great deal"
+            }
+          ],
+          "label": "Fears leading to burden on others",
+          "units": "",
+          "type": "nominal",
+          "methodology": ""
+        }
+      ],
+      "code": "Fears_of_specific_things_or_situations",
+      "label": "Fears_of_specific_things_or_situations"
+    },
+    {
+      "variables": [
+        {
+          "isCategorical": false,
+          "code": "brainstem",
+          "sql_type": "real",
+          "description": "Brainstem volume",
+          "label": "Brainstem",
+          "units": "cm3",
+          "type": "real",
+          "methodology": ""
+        },
+        {
+          "isCategorical": false,
+          "code": "tiv",
+          "sql_type": "real",
+          "description": "Total intra-cranial volume",
+          "label": "TIV",
+          "units": "cm3",
+          "type": "real",
+          "methodology": ""
+        }
+      ],
+      "code": "brain_anatomy",
+      "groups": [
+        {
+          "variables": [
+            {
+              "isCategorical": false,
+              "code": "_3rdventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "3rd Ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "_4thventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "4th Ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "csfglobal",
+              "sql_type": "real",
+              "description": "",
+              "label": "CSF global",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "leftinflatvent",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left inferior lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "leftlateralventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "rightinflatvent",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right inferior lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "rightlateralventricle",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right lateral ventricle",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            }
+          ],
+          "code": "csf_volume",
+          "label": "Csf_volume"
+        },
+        {
+          "code": "grey_matter_volume",
+          "groups": [
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "cerebellarvermallobulesiv",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Cerebellar Vermal Lobules I-V",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "cerebellarvermallobulesviiix",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Cerebellar Vermal Lobules VIII-X",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "cerebellarvermallobulesvivii",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Cerebellar Vermal Lobules VI-VII",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftcerebellumexterior",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Cerebellum Exterior",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcerebellumexterior",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Cerebellum Exterior",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                }
+              ],
+              "code": "cerebellum",
+              "label": "Cerebellum"
+            },
+            {
+              "code": "cerebral_nuclei",
+              "groups": [
+                {
+                  "variables": [
+                    {
+                      "isCategorical": false,
+                      "code": "leftamygdala",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Amygdala",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightamygdala",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Amygdala",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    }
+                  ],
+                  "code": "amygdala",
+                  "label": "Amygdala"
+                },
+                {
+                  "variables": [
+                    {
+                      "isCategorical": false,
+                      "code": "leftaccumbensarea",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Accumbens Area",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftbasalforebrain",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Basal Forebrain",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftcaudate",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Caudate",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftpallidum",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Pallidum",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "leftputamen",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Left Putamen",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightaccumbensarea",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Accumbens Area",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightbasalforebrain",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Basal Forebrain",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightcaudate",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Caudate",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightpallidum",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Pallidum",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    },
+                    {
+                      "isCategorical": false,
+                      "code": "rightputamen",
+                      "sql_type": "real",
+                      "description": "",
+                      "label": "Right Putamen",
+                      "units": "cm3",
+                      "type": "real",
+                      "methodology": ""
+                    }
+                  ],
+                  "code": "basal_ganglia",
+                  "label": "Basal_ganglia"
+                }
+              ],
+              "label": "Cerebral_nuclei"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftventraldc",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Ventral DC",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightventraldc",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Ventral DC",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                }
+              ],
+              "code": "diencephalon",
+              "label": "Diencephalon"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftaorganteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left anterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftcocentraloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left central operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftfofrontaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left frontal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftfrpfrontalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left frontal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftgregyrusrectus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left gyrus rectus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftlorglateralorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left lateral orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmfcmedialfrontalcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left medial frontal cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmfgmiddlefrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmorgmedialorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left medial orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmprgprecentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left precentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmsfgsuperiorfrontalgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior frontal gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftopifgopercularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left opercular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftorifgorbitalpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left orbital part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpoparietaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left parietal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftporgposteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left posterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftprgprecentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left precentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftscasubcallosalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left subcallosal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsfgsuperiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsmcsupplementarymotorcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left supplementary motor cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "lefttrifgtriangularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left triangular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightaorganteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right anterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcocentraloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right central operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightfofrontaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right frontal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightfrpfrontalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right frontal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightgregyrusrectus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right gyrus rectus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightlorglateralorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right lateral orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmfcmedialfrontalcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right medial frontal cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmfgmiddlefrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmorgmedialorbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right medial orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmprgprecentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right precentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmsfgsuperiorfrontalgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior frontal gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightopifgopercularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right opercular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightorifgorbitalpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right orbital part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpoparietaloperculum",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right parietal operculum",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightporgposteriororbitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right posterior orbital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightprgprecentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right precentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightscasubcallosalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right subcallosal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsfgsuperiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsmcsupplementarymotorcortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right supplementary motor cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "righttrifgtriangularpartoftheinferiorfrontalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right triangular part of the inferior frontal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                }
+              ],
+              "code": "frontal",
+              "label": "Frontal"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftainsanteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left anterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpinsposteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left posterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightainsanteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right anterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpinsposteriorinsula",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right posterior insula",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                }
+              ],
+              "code": "insula",
+              "label": "Insula"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftacgganteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left anterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftententorhinalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left entorhinal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "lefthippocampus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Hippocampus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmcggmiddlecingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpcggposteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left posterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftphgparahippocampalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left parahippocampal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftthalamusproper",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left Thalamus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightacgganteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right anterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightententorhinalarea",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right entorhinal area",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "righthippocampus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Hippocampus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmcggmiddlecingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpcggposteriorcingulategyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right posterior cingulate gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightphgparahippocampalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right parahippocampal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightthalamusproper",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right Thalamus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                }
+              ],
+              "code": "limbic",
+              "label": "Limbic"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftcalccalcarinecortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left calcarine cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftcuncuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left cuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftioginferioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left inferior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftliglingualgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left lingual gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmogmiddleoccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftocpoccipitalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left occipital pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftofugoccipitalfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left occipital fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsogsuperioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcalccalcarinecortex",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right calcarine cortex",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightcuncuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right cuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightioginferioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right inferior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightliglingualgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right lingual gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmogmiddleoccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightocpoccipitalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right occipital pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightofugoccipitalfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right occipital fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsogsuperioroccipitalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior occipital gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                }
+              ],
+              "code": "occipital",
+              "label": "Occipital"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftangangulargyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left angular gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmpogpostcentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left postcentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpcuprecuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left precuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftpogpostcentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left postcentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsmgsupramarginalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left supramarginal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftsplsuperiorparietallobule",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior parietal lobule",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightangangulargyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right angular gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmpogpostcentralgyrusmedialsegment",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right postcentral gyrus medial segment",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpcuprecuneus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right precuneus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightpogpostcentralgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right postcentral gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsmgsupramarginalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right supramarginal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightsplsuperiorparietallobule",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior parietal lobule",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
                 }
-            ],
-            "code": "brain_anatomy",
-            "groups": [
-                {
-                    "variables": [
-                        {
-                            "isCategorical": false,
-                            "code": "_3rdventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "3rd Ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "_4thventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "4th Ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "csfglobal",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "CSF global",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "leftinflatvent",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left inferior lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "leftlateralventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightinflatvent",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right inferior lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightlateralventricle",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right lateral ventricle",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        }
-                    ],
-                    "code": "csf_volume",
-                    "label": "Csf_volume"
-                },
-                {
-                    "code": "grey_matter_volume",
-                    "groups": [
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "cerebellarvermallobulesiv",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Cerebellar Vermal Lobules I-V",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "cerebellarvermallobulesviiix",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Cerebellar Vermal Lobules VIII-X",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "cerebellarvermallobulesvivii",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Cerebellar Vermal Lobules VI-VII",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcerebellumexterior",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Cerebellum Exterior",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcerebellumexterior",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Cerebellum Exterior",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "cerebellum",
-                            "label": "Cerebellum"
-                        },
-                        {
-                            "code": "cerebral_nuclei",
-                            "groups": [
-                                {
-                                    "variables": [
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftamygdala",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Amygdala",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightamygdala",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Amygdala",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        }
-                                    ],
-                                    "code": "amygdala",
-                                    "label": "Amygdala"
-                                },
-                                {
-                                    "variables": [
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftaccumbensarea",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Accumbens Area",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftbasalforebrain",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Basal Forebrain",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftcaudate",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Caudate",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftpallidum",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Pallidum",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "leftputamen",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Left Putamen",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightaccumbensarea",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Accumbens Area",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightbasalforebrain",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Basal Forebrain",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightcaudate",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Caudate",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightpallidum",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Pallidum",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        },
-                                        {
-                                            "isCategorical": false,
-                                            "code": "rightputamen",
-                                            "sql_type": "real",
-                                            "description": "",
-                                            "label": "Right Putamen",
-                                            "units": "cm3",
-                                            "type": "real",
-                                            "methodology": ""
-                                        }
-                                    ],
-                                    "code": "basal_ganglia",
-                                    "label": "Basal_ganglia"
-                                }
-                            ],
-                            "label": "Cerebral_nuclei"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftventraldc",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Ventral DC",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightventraldc",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Ventral DC",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "diencephalon",
-                            "label": "Diencephalon"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftaorganteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left anterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcocentraloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left central operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftfofrontaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left frontal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftfrpfrontalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left frontal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftgregyrusrectus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left gyrus rectus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftlorglateralorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left lateral orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmfcmedialfrontalcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left medial frontal cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmfgmiddlefrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmorgmedialorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left medial orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmprgprecentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left precentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmsfgsuperiorfrontalgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior frontal gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftopifgopercularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left opercular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftorifgorbitalpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left orbital part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpoparietaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left parietal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftporgposteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left posterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftprgprecentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left precentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftscasubcallosalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left subcallosal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsfgsuperiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsmcsupplementarymotorcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left supplementary motor cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "lefttrifgtriangularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left triangular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightaorganteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right anterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcocentraloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right central operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightfofrontaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right frontal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightfrpfrontalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right frontal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightgregyrusrectus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right gyrus rectus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightlorglateralorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right lateral orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmfcmedialfrontalcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right medial frontal cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmfgmiddlefrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmorgmedialorbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right medial orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmprgprecentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right precentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmsfgsuperiorfrontalgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior frontal gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightopifgopercularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right opercular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightorifgorbitalpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right orbital part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpoparietaloperculum",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right parietal operculum",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightporgposteriororbitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right posterior orbital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightprgprecentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right precentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightscasubcallosalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right subcallosal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsfgsuperiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsmcsupplementarymotorcortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right supplementary motor cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "righttrifgtriangularpartoftheinferiorfrontalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right triangular part of the inferior frontal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "frontal",
-                            "label": "Frontal"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftainsanteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left anterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpinsposteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left posterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightainsanteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right anterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpinsposteriorinsula",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right posterior insula",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "insula",
-                            "label": "Insula"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftacgganteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left anterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftententorhinalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left entorhinal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "lefthippocampus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Hippocampus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmcggmiddlecingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpcggposteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left posterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftphgparahippocampalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left parahippocampal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftthalamusproper",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left Thalamus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightacgganteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right anterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightententorhinalarea",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right entorhinal area",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "righthippocampus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Hippocampus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmcggmiddlecingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpcggposteriorcingulategyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right posterior cingulate gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightphgparahippocampalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right parahippocampal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightthalamusproper",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right Thalamus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "limbic",
-                            "label": "Limbic"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcalccalcarinecortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left calcarine cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftcuncuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left cuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftioginferioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left inferior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftliglingualgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left lingual gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmogmiddleoccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftocpoccipitalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left occipital pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftofugoccipitalfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left occipital fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsogsuperioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcalccalcarinecortex",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right calcarine cortex",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightcuncuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right cuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightioginferioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right inferior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightliglingualgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right lingual gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmogmiddleoccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightocpoccipitalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right occipital pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightofugoccipitalfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right occipital fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsogsuperioroccipitalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior occipital gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "occipital",
-                            "label": "Occipital"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftangangulargyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left angular gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmpogpostcentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left postcentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpcuprecuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left precuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftpogpostcentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left postcentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsmgsupramarginalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left supramarginal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftsplsuperiorparietallobule",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior parietal lobule",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightangangulargyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right angular gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmpogpostcentralgyrusmedialsegment",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right postcentral gyrus medial segment",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpcuprecuneus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right precuneus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightpogpostcentralgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right postcentral gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsmgsupramarginalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right supramarginal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightsplsuperiorparietallobule",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior parietal lobule",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "parietal",
-                            "label": "Parietal"
-                        },
-                        {
-                            "variables": [
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftfugfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftitginferiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left inferior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftmtgmiddletemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left middle temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftppplanumpolare",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left planum polare",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftptplanumtemporale",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left planum temporale",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftstgsuperiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left superior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "lefttmptemporalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left temporal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "leftttgtransversetemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Left transverse temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightfugfusiformgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right fusiform gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightitginferiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right inferior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightmtgmiddletemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right middle temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightppplanumpolare",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right planum polare",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightptplanumtemporale",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right planum temporale",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightstgsuperiortemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right superior temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "righttmptemporalpole",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right temporal pole",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                },
-                                {
-                                    "isCategorical": false,
-                                    "code": "rightttgtransversetemporalgyrus",
-                                    "sql_type": "real",
-                                    "description": "",
-                                    "label": "Right transverse temporal gyrus",
-                                    "units": "cm3",
-                                    "type": "real",
-                                    "methodology": ""
-                                }
-                            ],
-                            "code": "temporal",
-                            "label": "Temporal"
-                        }
-                    ],
-                    "label": "Grey_matter_volume"
-                },
-                {
-                    "variables": [
-                        {
-                            "isCategorical": false,
-                            "code": "leftcerebellumwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left Cerebellum White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "leftcerebralwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Left Cerebral White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "opticchiasm",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Optic chiasm",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightcerebellumwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right Cerebellum White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        },
-                        {
-                            "isCategorical": false,
-                            "code": "rightcerebralwhitematter",
-                            "sql_type": "real",
-                            "description": "",
-                            "label": "Right Cerebral White Matter",
-                            "units": "cm3",
-                            "type": "real",
-                            "methodology": ""
-                        }
-                    ],
-                    "code": "white_matter_volume",
-                    "label": "White_matter_volume"
+              ],
+              "code": "parietal",
+              "label": "Parietal"
+            },
+            {
+              "variables": [
+                {
+                  "isCategorical": false,
+                  "code": "leftfugfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftitginferiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left inferior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftmtgmiddletemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left middle temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftppplanumpolare",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left planum polare",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftptplanumtemporale",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left planum temporale",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftstgsuperiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left superior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "lefttmptemporalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left temporal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "leftttgtransversetemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Left transverse temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightfugfusiformgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right fusiform gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightitginferiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right inferior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightmtgmiddletemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right middle temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightppplanumpolare",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right planum polare",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightptplanumtemporale",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right planum temporale",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightstgsuperiortemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right superior temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "righttmptemporalpole",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right temporal pole",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
+                },
+                {
+                  "isCategorical": false,
+                  "code": "rightttgtransversetemporalgyrus",
+                  "sql_type": "real",
+                  "description": "",
+                  "label": "Right transverse temporal gyrus",
+                  "units": "cm3",
+                  "type": "real",
+                  "methodology": ""
                 }
-            ],
-            "label": "Brain_anatomy"
+              ],
+              "code": "temporal",
+              "label": "Temporal"
+            }
+          ],
+          "label": "Grey_matter_volume"
+        },
+        {
+          "variables": [
+            {
+              "isCategorical": false,
+              "code": "leftcerebellumwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left Cerebellum White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "leftcerebralwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Left Cerebral White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "opticchiasm",
+              "sql_type": "real",
+              "description": "",
+              "label": "Optic chiasm",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "rightcerebellumwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right Cerebellum White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            },
+            {
+              "isCategorical": false,
+              "code": "rightcerebralwhitematter",
+              "sql_type": "real",
+              "description": "",
+              "label": "Right Cerebral White Matter",
+              "units": "cm3",
+              "type": "real",
+              "methodology": ""
+            }
+          ],
+          "code": "white_matter_volume",
+          "label": "White_matter_volume"
         }
-    ],
-    "label": "Mentalhealth"
+      ],
+      "label": "Brain_anatomy"
+    }
+  ],
+  "label": "Mentalhealth"
 }
diff --git a/documentation/design_docs/MIP_Engine_Interface.yml b/documentation/design_docs/MIP_Engine_Interface.yml
index 6d6c10ac..0dfc8e67 100644
--- a/documentation/design_docs/MIP_Engine_Interface.yml
+++ b/documentation/design_docs/MIP_Engine_Interface.yml
@@ -49,122 +49,122 @@ paths:
                 $ref: '#/components/schemas/AlgorithmResult'
         '400':
           description: 'algorithm does not exist or badly formatted input'
-      
+
 
 components:
   schemas:
     Algorithm:
       description: All the details and properties that specify an algorithm.
       example: {
-                    "name": "ALGORITHMNAME",
-                    "desc": "This is an example algorithm.",
-                    "label": "My Algorithm",
-                    "inputdata": {
-                        "pathology": {
-                            "label": "Pathology of the data.",
-                            "desc": "The pathology that the algorithm will run on.",
-                            "types": ["text"],
-                            "notblank": true,
-                            "multiple": false
-                        },
-                        "dataset": {
-                            "label": "Set of data to use.",
-                            "desc": "The set of data to run the algorithm on.",
-                            "types": ["text"],
-                            "notblank": true,
-                            "multiple": true
-                        },
-                        "filter": {
-                            "label": "Filter on the data.",
-                            "desc": "Features used in my algorithm.",
-                            "types": ["json"],
-                            "notblank": false,
-                            "multiple": false
-                        },
-                        "x": {
-                            "label": "features",
-                            "desc": "Features used in my algorithm.",
-                            "types": ["int", "real", "text"],
-                            "stattypes": ["numerical", "nomimal"],
-                            "notblank": true,
-                            "multiple": true
-                        },
-                        "y": {
-                            "label": "target",
-                            "desc": "Target variable for my algorithm.",
-                            "types": ["text", "int"],
-                            "stattypes": ["nominal"],
-                            "enumslen": 2,
-                            "notblank": true,
-                            "multiple": false
-                        }
-                    },
-                    "parameters": {
-                        "my_enum_param": {
-                            "label": "Some param",
-                            "desc": "Example of parameter with enumerations.",
-                            "type": "text",
-                            "enums": ["a", "b", "c"],
-                            "default": "a",
-                            "notblank": true,
-                            "multiple": false
-                        },
-                        "my_int_param": {
-                            "label": "Some param",
-                            "desc": "Example of integer param.",
-                            "type": "int",
-                            "default": 4,
-                            "min": 2,
-                            "max": 4,
-                            "notblank": true,
-                            "multiple": false
-                        },
-                        "list_param": {
-                            "label": "Some param",
-                            "desc": "Example of list of floats param.",
-                            "type": "real",
-                            "default": [0.8, 0.95],
-                            "min": 0.0,
-                            "max": 1.0,
-                            "notblank": false,
-                            "multiple": true
-                        }
-                    },
-                    "crossvalidation": {
-                        "desc": "Module for performing cross validation on supervised learning models.",
-                        "label": "Cross Validation",
-                        "parameters": {
-                            "type": {
-                                "label": "Type of cross-validation",
-                                "desc": "Type of cross-validation",
-                                "type": "text",
-                                "enums": ["k_fold", "leave_dataset_out"],
-                                "default": "k_fold",
-                                "notblank": true,
-                                "multiple": false
-                            }, 
-                            "nsplits": {
-                                "label": "Number of splits",
-                                "desc": "Number of splits",
-                                "type": "int",
-                                "min": 2,
-                                "max": 20,
-                                "default": 5,
-                                "notblank": true,
-                                "multiple": false
-                            },
-                            "metrics": {
-                                "label": "Metrics",
-                                "desc": "Cross-validation metrics.",
-                                "type": "text",
-                                "enums": ["precision", "recall", "auc", "roc", "confusion_matrix", "f1_score"],
-                                "default": null,
-                                "notblank": true,
-                                "multiple": true
-                            }
-                        }
-                    }
-                }
+        "name": "ALGORITHMNAME",
+        "desc": "This is an example algorithm.",
+        "label": "My Algorithm",
+        "inputdata": {
+          "pathology": {
+            "label": "Pathology of the data.",
+            "desc": "The pathology that the algorithm will run on.",
+            "types": [ "text" ],
+            "notblank": true,
+            "multiple": false
+          },
+          "dataset": {
+            "label": "Set of data to use.",
+            "desc": "The set of data to run the algorithm on.",
+            "types": [ "text" ],
+            "notblank": true,
+            "multiple": true
+          },
+          "filter": {
+            "label": "Filter on the data.",
+            "desc": "Features used in my algorithm.",
+            "types": [ "json" ],
+            "notblank": false,
+            "multiple": false
+          },
+          "x": {
+            "label": "features",
+            "desc": "Features used in my algorithm.",
+            "types": [ "int", "real", "text" ],
+            "stattypes": [ "numerical", "nomimal" ],
+            "notblank": true,
+            "multiple": true
+          },
+          "y": {
+            "label": "target",
+            "desc": "Target variable for my algorithm.",
+            "types": [ "text", "int" ],
+            "stattypes": [ "nominal" ],
+            "enumslen": 2,
+            "notblank": true,
+            "multiple": false
+          }
+        },
+        "parameters": {
+          "my_enum_param": {
+            "label": "Some param",
+            "desc": "Example of parameter with enumerations.",
+            "type": "text",
+            "enums": [ "a", "b", "c" ],
+            "default": "a",
+            "notblank": true,
+            "multiple": false
+          },
+          "my_int_param": {
+            "label": "Some param",
+            "desc": "Example of integer param.",
+            "type": "int",
+            "default": 4,
+            "min": 2,
+            "max": 4,
+            "notblank": true,
+            "multiple": false
+          },
+          "list_param": {
+            "label": "Some param",
+            "desc": "Example of list of floats param.",
+            "type": "real",
+            "default": [ 0.8, 0.95 ],
+            "min": 0.0,
+            "max": 1.0,
+            "notblank": false,
+            "multiple": true
+          }
+        },
+        "crossvalidation": {
+          "desc": "Module for performing cross validation on supervised learning models.",
+          "label": "Cross Validation",
+          "parameters": {
+            "type": {
+              "label": "Type of cross-validation",
+              "desc": "Type of cross-validation",
+              "type": "text",
+              "enums": [ "k_fold", "leave_dataset_out" ],
+              "default": "k_fold",
+              "notblank": true,
+              "multiple": false
+            },
+            "nsplits": {
+              "label": "Number of splits",
+              "desc": "Number of splits",
+              "type": "int",
+              "min": 2,
+              "max": 20,
+              "default": 5,
+              "notblank": true,
+              "multiple": false
+            },
+            "metrics": {
+              "label": "Metrics",
+              "desc": "Cross-validation metrics.",
+              "type": "text",
+              "enums": [ "precision", "recall", "auc", "roc", "confusion_matrix", "f1_score" ],
+              "default": null,
+              "notblank": true,
+              "multiple": true
+            }
+          }
+        }
+      }
       type: object
       required:
         - name
@@ -194,49 +194,49 @@ components:
           properties:
             schema:
               $ref: '#/components/schemas/Algorithm'
-              
+
     AlgorithmInputData:
       description: Input parameters describing the data used to fit a statistical/ML model.
       example: {
-                    "pathology": {
-                        "label": "Pathology of the data.",
-                        "desc": "The pathology that the algorithm will run on.",
-                        "types": ["text"],
-                        "notblank": true,
-                        "multiple": false
-                    },
-                    "dataset": {
-                        "label": "Set of data to use.",
-                        "desc": "The set of data to run the algorithm on.",
-                        "types": ["text"],
-                        "notblank": true,
-                        "multiple": true
-                    },
-                    "filter": {
-                        "label": "Filter on the data.",
-                        "desc": "Features used in my algorithm.",
-                        "types": ["jsonObject"],
-                        "notblank": false,
-                        "multiple": false
-                    },
-                    "x": {
-                        "label": "features",
-                        "desc": "Features used in my algorithm.",
-                        "types": ["int", "real", "text"],
-                        "stattypes": ["numerical", "nomimal"],
-                        "notblank": true,
-                        "multiple": true
-                    },
-                    "y": {
-                        "label": "target",
-                        "desc": "Target variable for my algorithm.",
-                        "types": ["text", "int"],
-                        "stattypes": ["nominal"],
-                        "enumslen": 2,
-                        "notblank": true,
-                        "multiple": false
-                    }
-                }
+        "pathology": {
+          "label": "Pathology of the data.",
+          "desc": "The pathology that the algorithm will run on.",
+          "types": [ "text" ],
+          "notblank": true,
+          "multiple": false
+        },
+        "dataset": {
+          "label": "Set of data to use.",
+          "desc": "The set of data to run the algorithm on.",
+          "types": [ "text" ],
+          "notblank": true,
+          "multiple": true
+        },
+        "filter": {
+          "label": "Filter on the data.",
+          "desc": "Features used in my algorithm.",
+          "types": [ "jsonObject" ],
+          "notblank": false,
+          "multiple": false
+        },
+        "x": {
+          "label": "features",
+          "desc": "Features used in my algorithm.",
+          "types": [ "int", "real", "text" ],
+          "stattypes": [ "numerical", "nomimal" ],
+          "notblank": true,
+          "multiple": true
+        },
+        "y": {
+          "label": "target",
+          "desc": "Target variable for my algorithm.",
+          "types": [ "text", "int" ],
+          "stattypes": [ "nominal" ],
+          "enumslen": 2,
+          "notblank": true,
+          "multiple": false
+        }
+      }
       type: object
       additionalProperties:
         type: object
@@ -277,37 +277,37 @@ components:
     AlgorithmParameters:
       description: Algorithm parameters controlling the fitting process.
       example: {
-                    "my_enum_param": {
-                        "label": "Some param",
-                        "desc": "Example of parameter with enumerations.",
-                        "type": "text",
-                        "inputtype": "dropdown",
-                        "enums": ["a", "b", "c"],
-                        "default": "a",
-                        "notblank": true,
-                        "multiple": false
-                    },
-                    "my_int_param": {
-                        "label": "Some param",
-                        "desc": "Example of integer param.",
-                        "type": "int",
-                        "default": 4,
-                        "min": 2,
-                        "max": 4,
-                        "notblank": true,
-                        "multiple": false
-                    },
-                    "list_param": {
-                        "label": "Some param",
-                        "desc": "Example of list of floats param.",
-                        "type": "real",
-                        "default": [0.8, 0.95],
-                        "min": 0.0,
-                        "max": 1.0,
-                        "notblank": true,
-                        "multiple": true
-                    }
-                }
+        "my_enum_param": {
+          "label": "Some param",
+          "desc": "Example of parameter with enumerations.",
+          "type": "text",
+          "inputtype": "dropdown",
+          "enums": [ "a", "b", "c" ],
+          "default": "a",
+          "notblank": true,
+          "multiple": false
+        },
+        "my_int_param": {
+          "label": "Some param",
+          "desc": "Example of integer param.",
+          "type": "int",
+          "default": 4,
+          "min": 2,
+          "max": 4,
+          "notblank": true,
+          "multiple": false
+        },
+        "list_param": {
+          "label": "Some param",
+          "desc": "Example of list of floats param.",
+          "type": "real",
+          "default": [ 0.8, 0.95 ],
+          "min": 0.0,
+          "max": 1.0,
+          "notblank": true,
+          "multiple": true
+        }
+      }
       type: object
       additionalProperties:
         type: object
@@ -349,29 +349,29 @@ components:
     AlgorithmRequestBody:
       description: The request body of the call to run an algorithm.
       example: {
-                    "inputdata": {
-                        "pathology": "dementia",
-                        "dataset": ["adni", "ppmi"],
-                        "filter": {},
-                        "x": ["lefthippocampus", "righthippocampus"],
-                        "y": ["alzheimerbroadcategory"]
-                    },
-                    "parameters": {
-                        "my_enum_param": "a",
-                        "my_int_param": 3,
-                        "list_param": [0.8, 0.95]
-                    },
-                    "crossvalidation": {
-                        "type": "k_fold",
-                        "nsplits": 10,
-                        "metrics": ["precision","confusion_matrix"]
-                    }
-                }
+        "inputdata": {
+          "pathology": "dementia",
+          "dataset": [ "adni", "ppmi" ],
+          "filter": { },
+          "x": [ "lefthippocampus", "righthippocampus" ],
+          "y": [ "alzheimerbroadcategory" ]
+        },
+        "parameters": {
+          "my_enum_param": "a",
+          "my_int_param": 3,
+          "list_param": [ 0.8, 0.95 ]
+        },
+        "crossvalidation": {
+          "type": "k_fold",
+          "nsplits": 10,
+          "metrics": [ "precision","confusion_matrix" ]
+        }
+      }
       type: object
       required:
         - inputdata
       properties:
-        inputdata:    
+        inputdata:
           description: a dictionairy of parameters relative to the datasets
           type: object
           required:
@@ -425,31 +425,31 @@ components:
     AlgorithmResult:
       description: The result of an algorithm execution. A dictionairy of the available visualization types, containing a list of the different visualizations. Possible MIMETypes here https://redmine.hbpmip.link/issues/186
       example: {
-                    "application/json": [
-                        {
-                            "single":
-                            {
-                                "num_datapoints": 45
-                
-                            }
-                        },
-                        {
-                            "double":
-                            {
-                                "num_datapoints": 437
-                
-                            }
-                        }
-                    ],
-                    "application/vnd.highcharts+json": [
-                        {
-                            "visualization": "amazing visulizaiton"
-                        },
-                        {
-                            "visualization2": "amazing visulizaiton2"
-                        }
-                    ]
-                }
+        "application/json": [
+          {
+            "single":
+              {
+                "num_datapoints": 45
+
+              }
+          },
+          {
+            "double":
+              {
+                "num_datapoints": 437
+
+              }
+          }
+        ],
+        "application/vnd.highcharts+json": [
+          {
+            "visualization": "amazing visulizaiton"
+          },
+          {
+            "visualization2": "amazing visulizaiton2"
+          }
+        ]
+      }
       type: object
       additionalProperties:
         type: array
diff --git a/documentation/design_docs/WorkerServiceAPISpec.yml b/documentation/design_docs/WorkerServiceAPISpec.yml
index a69aacbc..f409b677 100644
--- a/documentation/design_docs/WorkerServiceAPISpec.yml
+++ b/documentation/design_docs/WorkerServiceAPISpec.yml
@@ -6,19 +6,19 @@ servers:
     url: https://virtserver.swaggerhub.com/apmar/WorkerServiceAPI/1.0.0
   - description: SwaggerHub API Auto Mocking
     url: https://app.swaggerhub.com/apis/apmar/WorkerServiceAPI/1.0.0
-  
+
 info:
   description: API for the Worker Service
   version: "1.0.0"
   title: Worker Service API
-  
+
 paths:
   /tables:
     get:
       summary: Returns a list of all local non-private tables of the worker. Returns a list of tuples [name,shema]
       responses:
         '200':
-          description:  A list of tuples [name,shema] for all non-private tables in the worker database
+          description: A list of tuples [name,shema] for all non-private tables in the worker database
           content:
             application/json:
               schema:
@@ -33,16 +33,16 @@ paths:
     post:
       summary: Creates a new table. The client only provides the schema, the worker will decide the name of the table and will return it in the response
       requestBody:
-          description: Create a table.
-          content:
-            application/json:
-              schema:
-                type: object
-                items:
-                  $ref: '#/components/schemas/TableSchema'
-              examples:
-                example1:
-                  $ref: '#/components/examples/TableSchema'
+        description: Create a table.
+        content:
+          application/json:
+            schema:
+              type: object
+              items:
+                $ref: '#/components/schemas/TableSchema'
+            examples:
+              example1:
+                $ref: '#/components/examples/TableSchema'
       responses:
         '201':
           description: 'table created'
@@ -57,7 +57,7 @@ paths:
                   $ref: '#/components/examples/TableInfo'
         '400':
           description: 'badly formatted input. The schema provided is not valid'
-                  
+
   /tables/{tableName}:
     get:
       summary: fetch table data
@@ -85,7 +85,7 @@ paths:
                   $ref: '#/components/examples/TableData'
         '404':
           description: table not found
-          
+
     delete:
       summary: delete the table
       parameters:
@@ -105,7 +105,7 @@ paths:
       summary: Returns a list of all view tables of the worker. Returns list of tuples [name,shema]
       responses:
         '200':
-          description:  List of tuples [name,shema] for all views in the worker database
+          description: List of tuples [name,shema] for all views in the worker database
           content:
             application/json:
               schema:
@@ -119,18 +119,18 @@ paths:
           description: The worker successfully processed the request, and is not returning any content. There aren't any view tables on the worker's database
     post:
       summary: Creates a new view
-      description: Creates a new view. The client only provides a TableView (datasets,columns,filters), the worker will decide the name of the table and return it on the response 
+      description: Creates a new view. The client only provides a TableView (datasets,columns,filters), the worker will decide the name of the table and return it on the response
       requestBody:
-          description: Creates a new view
-          content:
-            application/json:
-              schema:
-                type: object
-                items:
-                  $ref: '#/components/schemas/ViewTable'
-              examples:
-                example1:
-                  $ref: '#/components/examples/ViewTable'
+        description: Creates a new view
+        content:
+          application/json:
+            schema:
+              type: object
+              items:
+                $ref: '#/components/schemas/ViewTable'
+            examples:
+              example1:
+                $ref: '#/components/examples/ViewTable'
       responses:
         '201':
           description: 'view created'
@@ -145,7 +145,7 @@ paths:
                   $ref: '#/components/examples/ViewInfo'
         '400':
           description: 'badly formatted input'
-          
+
   /views/{viewName}:
     get:
       summary: fetch view data
@@ -157,7 +157,7 @@ paths:
           schema:
             type: string
           example: viewName1
-          
+
       responses:
         '200':
           description: The name and schema of the view along with the data of the view.
@@ -174,7 +174,7 @@ paths:
                   $ref: '#/components/examples/ViewData'
         '404':
           description: view not found
-    
+
     delete:
       summary: deletes a view
       parameters:
@@ -190,48 +190,48 @@ paths:
           description: 'view deleted'
 
   /remoteTables:
-      get:
-        summary: Returns a list of all the remote tables of the worker. Returns list of tuples [name,shema]
-        responses:
-          '200':
-            description:  List of tuples [name,shema] for all remote tables in the worker database
-            content:
-              application/json:
-                schema:
-                  type: array
-                  items:
-                    $ref: '#/components/schemas/TableInfo'
-                examples:
-                  example1:
-                    $ref: '#/components/examples/TableInfoArray'
-          '204':
-            description: The worker successfully processed the request, and is not returning any content. There aren't any remote tables in the worker's database
-      post:
-        summary: Creates a remote table. (instead of providing the url of the worker's db,workers can be aliased and resolved by a dns type of service.for now the url will provided for simplicity)
-        requestBody:
-            required: true
-            description: Creates a remote table
-            content:
-              application/json:
-                schema:
-                  type: object
-                  required:
-                    - tableName
-                    - workerAlias
-                  properties:
-                    tableName:
-                      type: string
-                    workerAlias:
-                      type: string
-                examples:
-                  example1:
-                    $ref: '#/components/examples/RemoteTableParams'
-        responses:
-          '201':
-            description: 'remote table created'
-          '400':
-            description: 'remote table does not exist or db on that url is unreachable....'
-            
+    get:
+      summary: Returns a list of all the remote tables of the worker. Returns list of tuples [name,shema]
+      responses:
+        '200':
+          description: List of tuples [name,shema] for all remote tables in the worker database
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: '#/components/schemas/TableInfo'
+              examples:
+                example1:
+                  $ref: '#/components/examples/TableInfoArray'
+        '204':
+          description: The worker successfully processed the request, and is not returning any content. There aren't any remote tables in the worker's database
+    post:
+      summary: Creates a remote table. (instead of providing the url of the worker's db,workers can be aliased and resolved by a dns type of service.for now the url will provided for simplicity)
+      requestBody:
+        required: true
+        description: Creates a remote table
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - tableName
+                - workerAlias
+              properties:
+                tableName:
+                  type: string
+                workerAlias:
+                  type: string
+            examples:
+              example1:
+                $ref: '#/components/examples/RemoteTableParams'
+      responses:
+        '201':
+          description: 'remote table created'
+        '400':
+          description: 'remote table does not exist or db on that url is unreachable....'
+
   /remoteTables/{remoteTableName}:
     get:
       summary: fetch remote table data
@@ -243,7 +243,7 @@ paths:
           schema:
             type: string
           example: remoteTableName1
-          
+
       responses:
         '200':
           description: The name and schema of the remote table along with the data.
@@ -280,7 +280,7 @@ paths:
       summary: Returns a list of all the merge tables of the worker. Returns list of tuples [name,shema]
       responses:
         '200':
-          description:  List of tuples [name,shema] for all remote tables in the worker database
+          description: List of tuples [name,shema] for all remote tables in the worker database
           content:
             application/json:
               schema:
@@ -295,20 +295,20 @@ paths:
     post:
       summary: Creates a marge table.
       requestBody:
-          required: true
-          description: Creates a merge table. The name of the table will be decided by the worker and returned in the response
-          content:
-            application/json:
-              schema:
-                type: object
-                required:
-                  - schema
-                properties:
-                  schema:
-                    type: string
-              examples:
-                example1:
-                  $ref: '#/components/examples/TableSchema'
+        required: true
+        description: Creates a merge table. The name of the table will be decided by the worker and returned in the response
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - schema
+              properties:
+                schema:
+                  type: string
+            examples:
+              example1:
+                $ref: '#/components/examples/TableSchema'
       responses:
         '201':
           description: 'remote table created'
@@ -326,7 +326,7 @@ paths:
           schema:
             type: string
           example: mergeTableName1
-          
+
       responses:
         '200':
           description: The name and schema of the merge table along with the data.
@@ -343,7 +343,7 @@ paths:
                   $ref: '#/components/examples/TableData'
         '404':
           description: merge table not found
-    
+
     patch:
       summary: adds a table to the merge table.
       parameters:
@@ -355,18 +355,18 @@ paths:
             type: string
           example: mergeTableName1
       requestBody:
-          required: true
-          description: adds a table to the merge table
-          content:
-            application/json:
-              schema:
-                type: object
-                required:
-                  - tableName
-                properties:
-                  schema:
-                    type: string
-              example: 'tableName1'
+        required: true
+        description: adds a table to the merge table
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - tableName
+              properties:
+                schema:
+                  type: string
+            example: 'tableName1'
       responses:
         '200':
           description: 'table added to the merged table'
@@ -392,7 +392,7 @@ paths:
       summary: Returns a list of all the User Defined Functions availiable to the worker. Returns list of tuples [name,udfHeader]
       responses:
         '200':
-          description:  List of tuples [name,shema] for all non-private tables in the worker database
+          description: List of tuples [name,shema] for all non-private tables in the worker database
           content:
             application/json:
               schema:
@@ -407,22 +407,22 @@ paths:
     post:
       summary: executes the udf, returns the name of the table containing the result
       requestBody:
-          description: execute udf.
-          content:
-            application/json:
-              schema:
-                type: object
-                required:
-                  - udfName
-                  - input
-                properties:
-                  udfName:
-                    type: string
-                  input:
-                    $ref: '#/components/schemas/TableNamesArray'
-              examples:
-                example1:
-                  $ref: '#/components/examples/UDFInput'
+        description: execute udf.
+        content:
+          application/json:
+            schema:
+              type: object
+              required:
+                - udfName
+                - input
+              properties:
+                udfName:
+                  type: string
+                input:
+                  $ref: '#/components/schemas/TableNamesArray'
+            examples:
+              example1:
+                $ref: '#/components/examples/UDFInput'
       responses:
         '201':
           description: 'A table containing the result of the udf has been created'
@@ -437,7 +437,7 @@ paths:
                   $ref: '#/components/examples/TableInfo'
         '400':
           description: 'badly formatted input. The schema provided is not valid'
-          
+
   /udfs/{udfName}:
     get:
       summary: Info about the UDF.
@@ -450,7 +450,7 @@ paths:
             type: string
       responses:
         '200':
-          description:  Info about the UDF.
+          description: Info about the UDF.
           content:
             application/json:
               schema:
@@ -460,7 +460,7 @@ paths:
               examples:
                 example1:
                   $ref: '#/components/examples/UDFInfo'
-      
+
         '404':
           description: udf not found
 
@@ -477,7 +477,7 @@ paths:
       responses:
         '204':
           description: 'udf deleted'
-          
+
 components:
   schemas:
     TableInfo:
@@ -503,7 +503,7 @@ components:
           $ref: '#/components/schemas/TableSchema'
         data:
           type: array
-          example: [[3,4.3,'male',False],[5,6.4,'female',True]]
+          example: [ [ 3,4.3,'male',False ],[ 5,6.4,'female',True ] ]
           items:
             type: array
             items:
@@ -512,15 +512,15 @@ components:
                 - type: integer
                 - type: number
                 - type: boolean
-          
+
     TableSchema:
       description: the schema of a database table
       type: array
       items:
         $ref: '#/components/schemas/NameTypeTuple'
-      example: 
-          $ref: '#/components/examples/TableSchema'
-        
+      example:
+        $ref: '#/components/examples/TableSchema'
+
 
     NameTypeTuple:
       type: object
@@ -533,20 +533,20 @@ components:
             - 'INT'
             - 'FLOAT'
             - 'TEXT'
-            
+
     ViewTable:
       type: object
       properties:
         datasets:
           description: 'The datasets on which to create the view.'
           type: array
-          example: ['adni', 'ppmi']
+          example: [ 'adni', 'ppmi' ]
           items:
             type: string
         columns:
           description: 'The columns to select from the table.'
           type: array
-          example: ['lefthippocampus', 'righthippocampus']
+          example: [ 'lefthippocampus', 'righthippocampus' ]
           items:
             type: string
         filters:
@@ -565,7 +565,7 @@ components:
           type: array
           items:
             type: string
-            
+
     UDFInfo:
       type: object
       properties:
@@ -573,43 +573,43 @@ components:
           type: string
         header:
           type: string
-          
-          
+
+
   examples:
     TableInfo:
-      value:  {"name":"tableName1","schema":["col1 INT","col2 FLOAT","col3 TEXT","col4 BOOLEAN"]}
+      value: { "name": "tableName1","schema": [ "col1 INT","col2 FLOAT","col3 TEXT","col4 BOOLEAN" ] }
     TableData:
-      value: {"schema":["col1 INT","col2 FLOAT","col3 TEXT","col4 BOOLEAN"],"data":[[3,4.3,'male',False],[5,6.4,'female',True]]}
+      value: { "schema": [ "col1 INT","col2 FLOAT","col3 TEXT","col4 BOOLEAN" ],"data": [ [ 3,4.3,'male',False ],[ 5,6.4,'female',True ] ] }
     TableSchema:
-      value:  [{"columnName":"col1","columnType":"INT"},{"columnName":"col2", "columnType":"FLOAT"},{"columnName":"col3","columnType":"TEXT"}]
+      value: [ { "columnName": "col1","columnType": "INT" },{ "columnName": "col2", "columnType": "FLOAT" },{ "columnName": "col3","columnType": "TEXT" } ]
     NameTypeTuple:
-      value: {"columnName":"col1","columnType":"INT"}
+      value: { "columnName": "col1","columnType": "INT" }
     TableNamesArray:
-      value: ["tableName8","tableName4","tableName34"]
+      value: [ "tableName8","tableName4","tableName34" ]
     TableInfoArray:
-      value: [{"name":"tableName8","schema":["c1 INT", "c2 TEXT"]}, {"name":"tableName4","schema":["c1 FLOAT","c2 BOOLEAN","c3 FLOAT"]}, {"name":"tableName34","schema":["c1 TEXT","c2 BOOLEAN"]}]
-      
+      value: [ { "name": "tableName8","schema": [ "c1 INT", "c2 TEXT" ] }, { "name": "tableName4","schema": [ "c1 FLOAT","c2 BOOLEAN","c3 FLOAT" ] }, { "name": "tableName34","schema": [ "c1 TEXT","c2 BOOLEAN" ] } ]
+
     ViewTable:
-      value: {"datasets":["adni", "ppmi"], "columns":["lefthippocampus", "righthippocampus"], "filters":["righthippocampus>1.6"]}
+      value: { "datasets": [ "adni", "ppmi" ], "columns": [ "lefthippocampus", "righthippocampus" ], "filters": [ "righthippocampus>1.6" ] }
     ViewInfo:
-      value:  {"name":"viewName1","schema":["lefthippocampus FLOAT","righthippocampus FLOAT"]}
+      value: { "name": "viewName1","schema": [ "lefthippocampus FLOAT","righthippocampus FLOAT" ] }
     ViewData:
-      value: {"schema":["lefthippocampus FLOAT","righthippocampus FLOAT"],"data":[[3.54,4.6],[8.8,7.3],[9.8,5.3],[9.4,4.7]]}
+      value: { "schema": [ "lefthippocampus FLOAT","righthippocampus FLOAT" ],"data": [ [ 3.54,4.6 ],[ 8.8,7.3 ],[ 9.8,5.3 ],[ 9.4,4.7 ] ] }
     ViewSchema:
-      value:  [{"columnName":"col1","columnType":"INT"},{"columnName":"col2", "columnType":"FLOAT"},{"columnName":"col3","columnType":"TEXT"}]
+      value: [ { "columnName": "col1","columnType": "INT" },{ "columnName": "col2", "columnType": "FLOAT" },{ "columnName": "col3","columnType": "TEXT" } ]
     ViewNamesArray:
-      value: ["ViewName8","ViewName4","ViewName34"]
+      value: [ "ViewName8","ViewName4","ViewName34" ]
     ViewInfoArray:
-      value: [{"name":"viewName8","schema":["c1 INT", "c2 TEXT"]}, {"name":"viewName4","schema":["c1 FLOAT","c2 BOOLEAN","c3 FLOAT"]}, {"name":"viewName34","schema":["c1 TEXT","c2 BOOLEAN"]}]
-    
+      value: [ { "name": "viewName8","schema": [ "c1 INT", "c2 TEXT" ] }, { "name": "viewName4","schema": [ "c1 FLOAT","c2 BOOLEAN","c3 FLOAT" ] }, { "name": "viewName34","schema": [ "c1 TEXT","c2 BOOLEAN" ] } ]
+
     RemoteTableParams:
-     value: {"tableName":"remoteTable123","workerAlias":"workerAlias1234"}
-    
+      value: { "tableName": "remoteTable123","workerAlias": "workerAlias1234" }
+
     UDFInfo:
-      value: {"name":"kmeans_local1","code":"CREATE FUNCTION <udfName1>(var1 FLOAT,var2 INT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON"}
+      value: { "name": "kmeans_local1","code": "CREATE FUNCTION <udfName1>(var1 FLOAT,var2 INT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON" }
     UDFCode:
-      value: {"code":"CREATE FUNCTION kmeans_local1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON{ ... return result}"}
+      value: { "code": "CREATE FUNCTION kmeans_local1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON{ ... return result}" }
     UDFInput:
-      value: {"udfName":"kmeans_local1","input":["viewName5","viewName12"]}
+      value: { "udfName": "kmeans_local1","input": [ "viewName5","viewName12" ] }
     UDFInfoArray:
-      value: [{"name":"kmeans_local_1","code":"CREATE FUNCTION kmeans_local_1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON"},{"name":"kmeans_local_2","code":"CREATE FUNCTION kmeans_local_2(var1 FLOAT,var2 FLOAT,var3 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT,r3 FLOAT) LANGUAGE PYTHON"},{"name":"pearson_local1","code":"CREATE FUNCTION pearson_local1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON"},{"name":"logreg_local1","code":"CREATE FUNCTION logreg_local1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON"}]
+      value: [ { "name": "kmeans_local_1","code": "CREATE FUNCTION kmeans_local_1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON" },{ "name": "kmeans_local_2","code": "CREATE FUNCTION kmeans_local_2(var1 FLOAT,var2 FLOAT,var3 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT,r3 FLOAT) LANGUAGE PYTHON" },{ "name": "pearson_local1","code": "CREATE FUNCTION pearson_local1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON" },{ "name": "logreg_local1","code": "CREATE FUNCTION logreg_local1(var1 FLOAT,var2 FLOAT) RETURNS TABLE(r1 FLOAT,r2 FLOAT) LANGUAGE PYTHON" } ]
diff --git a/documentation/design_docs/privacy-tools-specs.md b/documentation/design_docs/privacy-tools-specs.md
index 339f4e5e..8c7e9c6a 100644
--- a/documentation/design_docs/privacy-tools-specs.md
+++ b/documentation/design_docs/privacy-tools-specs.md
@@ -1,71 +1,65 @@
 ## Specification for privacy tools for the MIP
 
 ### Setting
-The MIP is an tool for data analysis on the combined databases of a federation
-of medical centers across Europe. Structurally it is composed of multiple local
-nodes, one for each medical center, and one global node which coordinates the
-computation.
 
-Each local node communicates solely with the global node and is allowed to
-share only aggregate information. The global node acquires the local aggregates
-and merges them into a global aggregate. For simple queries (usually
-statistical tests and processes) there is only one, or a small fixed number or
-local/global iterations. More complex queries (mostly machine learning model
-training) usually require an unbounded iteration.
+The MIP is an tool for data analysis on the combined databases of a federation of medical centers across Europe.
+Structurally it is composed of multiple local nodes, one for each medical center, and one global node which coordinates
+the computation.
 
-The merging stage in the global node depends on the particular query but we can
-formulate some general laws:
+Each local node communicates solely with the global node and is allowed to share only aggregate information. The global
+node acquires the local aggregates and merges them into a global aggregate. For simple queries (usually statistical
+tests and processes) there is only one, or a small fixed number or local/global iterations. More complex queries (mostly
+machine learning model training) usually require an unbounded iteration.
+
+The merging stage in the global node depends on the particular query but we can formulate some general laws:
 
 1. **Associativity**
+
 ```
 (a + b) + c = a + (b + c)
 ```
-   It should not matter if the global node folds the local aggregates
-   left-to-right or right-to-left.
+
+It should not matter if the global node folds the local aggregates left-to-right or right-to-left.
 
 2. **Commutativity**
+
 ```
 a + b = b + a
 ```
-   We cannot guarantee the order by which the local nodes will broadcast their
-   results, hence the order should be irrelevant.
+
+We cannot guarantee the order by which the local nodes will broadcast their results, hence the order should be
+irrelevant.
 
 3. **Identity element**
+
 ```
 a + e = e + a = a
 ```
-   An identity is useful when one local node cannot produce results if, for
-   example, it doesn't have the data asked by the query or if it is left out by
-   the computation for some reason (e.g. in some cross-validation settings).
-    
-The algebraic structure described by those laws is that of a **Commutative Monoid**. 
-Therefore, in the general case, the local aggregates must be elements of some
-commutative monoid and the merging operation its corresponding law.  In
-practice, however, the majority of cases corresponds to simple summation of
-numbers. In some cases (e.g. to compute some global descriptive statistics) we
-use the min/max operation over numbers. It can also happen that the local
-aggregates are sets and the monoid operation is set union.
-
-### Privacy tools 
-In order to provide privacy guaranties to the members of the federation, we
-wish to introduce a privacy mechanism in the MIP. This mechanism will be
-composed of two layers. The first layer uses Secure Multi-Party Computation
-(SMPC) to compute the global aggregate result. Its purpose
-is to minimize the leakage of information from the local databases by making
-sure that local aggregates are never known to the global node. The second layer
-of privacy will introduce some random noise to the final result as described by
-the Differential Privacy theory. The purpose of this layer is to provide
-protection for individual medical records by providing guaranties against the
-use of differential attacks on the federation.
-
-Structurally, the first mechanism (SMPC) will be implemented as a component
-mediating the communication from the local nodes to the global. This component
-should receive the local aggregates from the local nodes and output the merged
+
+An identity is useful when one local node cannot produce results if, for example, it doesn't have the data asked by the
+query or if it is left out by the computation for some reason (e.g. in some cross-validation settings).
+
+The algebraic structure described by those laws is that of a **Commutative Monoid**. Therefore, in the general case, the
+local aggregates must be elements of some commutative monoid and the merging operation its corresponding law. In
+practice, however, the majority of cases corresponds to simple summation of numbers. In some cases (e.g. to compute some
+global descriptive statistics) we use the min/max operation over numbers. It can also happen that the local aggregates
+are sets and the monoid operation is set union.
+
+### Privacy tools
+
+In order to provide privacy guaranties to the members of the federation, we wish to introduce a privacy mechanism in the
+MIP. This mechanism will be composed of two layers. The first layer uses Secure Multi-Party Computation
+(SMPC) to compute the global aggregate result. Its purpose is to minimize the leakage of information from the local
+databases by making sure that local aggregates are never known to the global node. The second layer of privacy will
+introduce some random noise to the final result as described by the Differential Privacy theory. The purpose of this
+layer is to provide protection for individual medical records by providing guaranties against the use of differential
+attacks on the federation.
+
+Structurally, the first mechanism (SMPC) will be implemented as a component mediating the communication from the local
+nodes to the global. This component should receive the local aggregates from the local nodes and output the merged
 result (as described by the monoid laws above) to the global node.
 
-The second mechanism is much simpler and can be a component that adds DP noise
-to the final result. In that simple case this component sits between the global
-node and the User Interface. Arguably a better solution would be to add DP
-noise already in the local aggregates so that if the global node is compromised
-DP guaranties still hold. In that case it would be implemented as a component
-between the local node and the SMPC layer.
+The second mechanism is much simpler and can be a component that adds DP noise to the final result. In that simple case
+this component sits between the global node and the User Interface. Arguably a better solution would be to add DP noise
+already in the local aggregates so that if the global node is compromised DP guaranties still hold. In that case it
+would be implemented as a component between the local node and the SMPC layer.
diff --git a/documentation/user_stories/User-stories.md b/documentation/user_stories/User-stories.md
index 5a4e176d..f69b3fcd 100644
--- a/documentation/user_stories/User-stories.md
+++ b/documentation/user_stories/User-stories.md
@@ -1,89 +1,89 @@
 # User stories
 
 #### Definitions
+
 * In what follows, an **algorithm** is understood as being a *statistics* or
-  *machine learning* algorithm which typically expects some data tables as
-  input and outputs a *model* and/or some *statistics*. This model can be of
-  interest to the user on its own, or can be used in further computations.
-* **Federated** algorithm means that the work is divided into smaller tasks,
-  each executed on a different **node** of the federation. The primary
-  consideration of this design is the preservation of data privacy. One node is
-  special, named `global node`, and doesn't contain any primary data. All other
-  nodes, named `local nodes` contain their own data which they are not allowed
-  to share with other nodes. The following diagram illustrates the execution flow
-  of a federated algorithm.
+  *machine learning* algorithm which typically expects some data tables as input and outputs a *model* and/or some *
+  statistics*. This model can be of interest to the user on its own, or can be used in further computations.
+* **Federated** algorithm means that the work is divided into smaller tasks, each executed on a different **node** of
+  the federation. The primary consideration of this design is the preservation of data privacy. One node is special,
+  named `global node`, and doesn't contain any primary data. All other nodes, named `local nodes` contain their own data
+  which they are not allowed to share with other nodes. The following diagram illustrates the execution flow of a
+  federated algorithm.
 
 ![federated algorithm activity diagram](federated-algorithm.png)
 *Federated algorithm execution flow*
 
-The horizontal bars represent synchronization points. The number of local tasks
-can vary depending on the context. The whole `local`/`global` step can be
-repeated any number of times.
+The horizontal bars represent synchronization points. The number of local tasks can vary depending on the context. The
+whole `local`/`global` step can be repeated any number of times.
 
 #### Sequence diagrams
-In what follows we present a number of sequence diagrams to accompany the user
-stories. These diagrams represent the sequence of events for each setting where
-time flows from top to bottom. The color coding is 
-<span style="color:green">*green*: remote invocations</span>, 
-<span style="color:red">*red*: data transfer</span> and 
+
+In what follows we present a number of sequence diagrams to accompany the user stories. These diagrams represent the
+sequence of events for each setting where time flows from top to bottom. The color coding is
+<span style="color:green">*green*: remote invocations</span>,
+<span style="color:red">*red*: data transfer</span> and
 <span style="color:blue">*blue*: local transformation of data</span>.
 
 ## User persona: Medical Researcher
-Might be a doctor, a neuroscientist, a biologist, a pharmaceutical researcher or
-anyone interested in conducting research with medical data.  Might have a
-background in statistics/machine learning/data science, ranging from basic to
+
+Might be a doctor, a neuroscientist, a biologist, a pharmaceutical researcher or anyone interested in conducting
+research with medical data. Might have a background in statistics/machine learning/data science, ranging from basic to
 expert-level.
 
 #### Basic federated analysis
+
 A *medical researcher* wants to perform **basic federated analysis** on a set of
 *medical centers*<sup id="a1">[1](#f1)</sup>. This means running one *algorithm*
-on a dataset which is scattered across multiple medical centers.  
+on a dataset which is scattered across multiple medical centers.
 
-The following *sequence* diagrams illustrate the sequence of events in such
-setting. 
+The following *sequence* diagrams illustrate the sequence of events in such setting.
 
 ![one step algorithm](1-onestep.png)
 *Single step algorithm*
 
 ![multi step algorithm](2-multistep.png)
 *Multi step algorithm*
-  
+
 #### Prediction
+
 A *medical researcher* wants to use a previously trained model to perform
 **prediction** on some new medical records.
-  
+
 ![prediction diagram](5-predict.png)
 *Prediction/Testing*
 
 #### Cross-validation
-A *medical researcher* wants to **cross-validate** her models in order to asses
-the quality of fit. The user wants to choose among multiple CV strategies.
-  * *k-fold* CV, medical-center-agnostic.
-  * *Cluster* CV where a cluster here corresponds a medical center.
+
+A *medical researcher* wants to **cross-validate** her models in order to asses the quality of fit. The user wants to
+choose among multiple CV strategies.
+
+* *k-fold* CV, medical-center-agnostic.
+* *Cluster* CV where a cluster here corresponds a medical center.
 
 ![k-fold cv diagram](7-cvkfold.png)
 *k-fold cross-validation*
 
 ![cluster dv diagram](8-cvcluster.png)
 *Cluster cross-validation*
-    
+
 #### Model selection
-A *medical researcher* wants to perform formalized **model selection**. After
-training multiple models on the same dataset, the user wants to select the
-*best* one according to criteria usually related to the model's
-prediction/cross-validation performance.
+
+A *medical researcher* wants to perform formalized **model selection**. After training multiple models on the same
+dataset, the user wants to select the
+*best* one according to criteria usually related to the model's prediction/cross-validation performance.
 
 ![model selection diagram](9-model-selection.png)
 *Model selection*
-  
+
 #### Data preprocessing/transformations
-A *medical researcher* wants to be able to **pre-process data** using a variety
-of tools. 
- * In simple cases the pre-processing can be done **locally** in each
-   medical center. *E.g.* creating interaction terms, *i.e.* creating new columns
-   as products of existing ones.
- * In other cases the pre-processing itself needs to happen **globally**.
-   *E.g.* centering or standardizing data.
+
+A *medical researcher* wants to be able to **pre-process data** using a variety of tools.
+
+* In simple cases the pre-processing can be done **locally** in each medical center. *E.g.* creating interaction
+  terms, *i.e.* creating new columns as products of existing ones.
+* In other cases the pre-processing itself needs to happen **globally**.
+  *E.g.* centering or standardizing data.
 
 ![local transform diagram](3-transformation-local.png)
 *Local data transformation*
@@ -92,42 +92,39 @@ of tools.
 *Global data transformation*
 
 #### Algorithm pipelines
-A *medical researcher* wants to run **algorithm pipelines**. Typical flow: one
-algorithm run results in a model. This model is used to transform some data
-(*e.g.* via prediction). The transformed data is inputted to the next algorithm
-etc.
+
+A *medical researcher* wants to run **algorithm pipelines**. Typical flow: one algorithm run results in a model. This
+model is used to transform some data
+(*e.g.* via prediction). The transformed data is inputted to the next algorithm etc.
 
 ![pipelines diagram](6-pipeline.png)
 *Algorithm pipeline*
 
 #### Similarity search
-A *medical researcher* wants to perform **similarity search** across different
-medical centers. Given a small number (possibly one) of patients located in some
-medical center or whose medical record is inputted manually by the user, find
-other medical centers hosting *similar* cases. Similarity can have multiple
-definitions.
+
+A *medical researcher* wants to perform **similarity search** across different medical centers. Given a small number (
+possibly one) of patients located in some medical center or whose medical record is inputted manually by the user, find
+other medical centers hosting *similar* cases. Similarity can have multiple definitions.
 
 ![similarity search diagram](10-similarity.png)
 *Similarity search*
-  
+
 #### Saving
-A *medical researcher* wants to **save elements of her computations** for later
-use. These element can be models, data-views, transformed datasets etc.
+
+A *medical researcher* wants to **save elements of her computations** for later use. These element can be models,
+data-views, transformed datasets etc.
 
 ## User persona: Algorithm Developer
-A third party algorithm developer (as opposed to the developer of native
-algorithms).
 
-* An **algorithm developer** wants to supply the federation with her own
-  algorithm, written in some machine learning friendly language (python, R,
-  ...). Ideally:
-    * The user is agnostic of the inner workings of the system, only being aware of
-      the existence of many local and one global nodes.
-    * The system enforces privacy restrictions independently of how the
-      algorithm is written.
+A third party algorithm developer (as opposed to the developer of native algorithms).
+
+* An **algorithm developer** wants to supply the federation with her own algorithm, written in some machine learning
+  friendly language (python, R, ...). Ideally:
+    * The user is agnostic of the inner workings of the system, only being aware of the existence of many local and one
+      global nodes.
+    * The system enforces privacy restrictions independently of how the algorithm is written.
 
 ---
-<b id="f1">1</b> A **medical center** is understood as being a member of the
-federation. It stores and contributes data in the form of medical records as
-well as some computing power. It is potentially geographically distinct from
-other medical centers.[^](#a1) 
+<b id="f1">1</b> A **medical center** is understood as being a member of the federation. It stores and contributes data
+in the form of medical records as well as some computing power. It is potentially geographically distinct from other
+medical centers.[^](#a1) 
-- 
GitLab


From 3002052439460ce1c0dfa5486331bd00e129dfe4 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Mon, 8 Feb 2021 21:49:54 +0200
Subject: [PATCH 13/30] Added inputdata parameters validation.

---
 .../api/DTOs/AlgorithmSpecificationsDTOs.py   |  12 +-
 controller/api/api_controller.py              |   4 +-
 controller/api/services/run_algorithm.py      | 148 +-----------
 .../services/validate_algorithm_parameters.py | 224 ++++++++++++++++++
 controller/worker_catalogue.py                |   8 +
 5 files changed, 249 insertions(+), 147 deletions(-)
 create mode 100644 controller/api/services/validate_algorithm_parameters.py

diff --git a/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index 379f1a6b..f046c454 100644
--- a/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -6,6 +6,12 @@ from dataclasses_json import dataclass_json
 from controller.algorithms import GenericParameter, Algorithm, CROSSVALIDATION_ALGORITHM_NAME, Algorithms
 from controller.utils import Singleton
 
+INPUTDATA_PATHOLOGY_PARAMETER_NAME = "pathology"
+INPUTDATA_DATASET_PARAMETER_NAME = "dataset"
+INPUTDATA_FILTERS_PARAMETER_NAME = "filter"
+INPUTDATA_X_PARAMETER_NAME = "x"
+INPUTDATA_Y_PARAMETER_NAME = "y"
+
 
 @dataclass_json
 @dataclass
@@ -115,9 +121,9 @@ class AlgorithmDTO:
         }
 
         # Adding the 3 "system" input data parameters
-        self.inputdata["pathology"] = get_pathology_parameter()
-        self.inputdata["dataset"] = get_dataset_parameter()
-        self.inputdata["filter"] = get_filter_parameter()
+        self.inputdata[INPUTDATA_PATHOLOGY_PARAMETER_NAME] = get_pathology_parameter()
+        self.inputdata[INPUTDATA_DATASET_PARAMETER_NAME] = get_dataset_parameter()
+        self.inputdata[INPUTDATA_FILTERS_PARAMETER_NAME] = get_filter_parameter()
 
         # Adding the crossvalidation algorithm as a nested algorithm
         if (CROSSVALIDATION_ALGORITHM_NAME in algorithm.flags.keys()
diff --git a/controller/api/api_controller.py b/controller/api/api_controller.py
index a0691d87..489b16fe 100644
--- a/controller/api/api_controller.py
+++ b/controller/api/api_controller.py
@@ -28,8 +28,8 @@ async def post_algorithm(algorithm_name: str) -> str:
 
     try:
         response = run_algorithm(algorithm_name, request_body)
-    except BadRequest as e:
-        raise e
+    except BadRequest as exc:
+        raise exc
     except:
         logging.error(f"Unhandled exception: \n {traceback.format_exc()}")
         raise BadRequest("Something went wrong. "
diff --git a/controller/api/services/run_algorithm.py b/controller/api/services/run_algorithm.py
index 531ee87c..d829800d 100644
--- a/controller/api/services/run_algorithm.py
+++ b/controller/api/services/run_algorithm.py
@@ -1,12 +1,11 @@
 import logging
 import traceback
-from typing import Optional, Dict, Any, List
 
-from controller.algorithms import Algorithms, GenericParameter
+from controller.algorithms import Algorithms
 from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
-from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications, AlgorithmDTO, \
-    InputDataParameterDTO, CrossValidationParametersDTO
+from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications
 from controller.api.errors import BadRequest
+from controller.api.services.validate_algorithm_parameters import validate_algorithm_parameters
 
 
 def run_algorithm(algorithm_name: str, request_body: str):
@@ -22,144 +21,9 @@ def run_algorithm(algorithm_name: str, request_body: str):
                       f"Exception: \n {traceback.format_exc()}")
         raise BadRequest(f"The algorithm body does not have the proper format.")
 
-    # Get algorithm specification and validate the request
+    # Get algorithm specification and validate the algorithm input
     algorithm_specs = AlgorithmSpecifications().algorithms_dict[algorithm_name]
-    validate_parameters(algorithm_specs, algorithm_request)
+    validate_algorithm_parameters(algorithm_specs, algorithm_request)
 
-    # TODO Run algorithm on the controller
+    # TODO Trigger algorithm execution on the controller
     pass
-
-
-def validate_parameters(algorithm_specs: AlgorithmDTO,
-                        algorithm_request: AlgorithmRequestDTO):
-    # Validate inputdata
-    validate_inputdata(algorithm_specs.inputdata,
-                       algorithm_request.inputdata)
-
-    # Validate generic parameters
-    validate_generic_parameters(algorithm_specs.parameters,
-                                algorithm_request.parameters)
-
-    # Validate crossvalidation parameters
-    validate_crossvalidation_parameters(algorithm_specs.crossvalidation,
-                                        algorithm_request.crossvalidation)
-    pass
-
-
-def validate_inputdata(inputdata_specs: Dict[str, InputDataParameterDTO],
-                       input_data: Dict[str, Any]):
-    for inputdata_name, inputdata_spec in inputdata_specs.items():
-        pass
-
-
-def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericParameter]],
-                                parameters: Optional[Dict[str, Any]]):
-    if parameters_specs is None:
-        return
-
-    if parameters is None:
-        raise BadRequest("Algorithm parameters not provided.")
-
-    for parameter_name, parameter_spec in parameters_specs.items():
-        if parameter_name not in parameters.keys():
-            if parameter_spec.notblank:
-                raise BadRequest(f"Parameter '{parameter_name}' should not be blank.")
-            else:
-                continue
-
-        parameter_value = parameters[parameter_name]
-        validate_parameter_proper_values(parameter_name,
-                                         parameter_value,
-                                         parameter_spec.type,
-                                         parameter_spec.enums,
-                                         parameter_spec.min,
-                                         parameter_spec.max,
-                                         parameter_spec.multiple)
-
-
-def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationParametersDTO],
-                                        crossvalidation: Optional[Dict[str, Any]]):
-    pass
-
-
-def validate_parameter_proper_values(parameter_name: str,
-                                     parameter_value: Any,
-                                     parameter_type: str,
-                                     parameter_enums: Optional[List[Any]],
-                                     parameter_min_value: Optional[int],
-                                     parameter_max_value: Optional[int],
-                                     multiple_allowed: bool
-                                     ):
-    if multiple_allowed and not isinstance(parameter_value, list):
-        raise BadRequest(f"Parameter '{parameter_name}' should be a list.")
-
-    # If the parameter value is a list, check each elements
-    if multiple_allowed:
-        for element in parameter_value:
-            validate_parameter_proper_type(parameter_name,
-                                           element,
-                                           parameter_type)
-
-            validate_parameter_proper_enumerations(parameter_name,
-                                                   element,
-                                                   parameter_enums)
-
-            validate_parameter_inside_min_max(parameter_name,
-                                              element,
-                                              parameter_min_value,
-                                              parameter_max_value)
-    else:
-        validate_parameter_proper_type(parameter_name,
-                                       parameter_value,
-                                       parameter_type)
-
-        validate_parameter_proper_enumerations(parameter_name,
-                                               parameter_value,
-                                               parameter_enums)
-
-        validate_parameter_inside_min_max(parameter_name,
-                                          parameter_value,
-                                          parameter_min_value,
-                                          parameter_max_value)
-
-
-def validate_parameter_proper_type(parameter_name: str,
-                                   parameter_value: Any,
-                                   parameter_type: str
-                                   ):
-    mip_types_to_python_types = {
-        "text": [str],
-        "int": [int],
-        "real": [float, int],
-        "jsonObject": [dict]
-    }
-    if type(parameter_value) not in mip_types_to_python_types[parameter_type]:
-        raise BadRequest(f"Parameter '{parameter_name}' values should be of type '{parameter_type}'.")
-
-
-def validate_parameter_proper_enumerations(parameter_name: str,
-                                           parameter_value: Any,
-                                           enumerations: Optional[List[Any]]
-                                           ):
-    if enumerations is None:
-        return
-
-    if parameter_value not in enumerations:
-        raise BadRequest(f"Parameter '{parameter_name}' values should be one of the following: '{str(enumerations)}' .")
-
-
-def validate_parameter_inside_min_max(parameter_name: str,
-                                      parameter_value: Any,
-                                      min: Optional[int],
-                                      max: Optional[int]
-                                      ):
-    if min is None and max is None:
-        return
-
-    if min is not None and parameter_value < min:
-        raise BadRequest(
-            f"Parameter '{parameter_name}' values should be greater than {min} .")
-
-    if max is not None and parameter_value > max:
-        raise BadRequest(
-            f"Parameter '{parameter_name}' values should be lower than {max} .")
diff --git a/controller/api/services/validate_algorithm_parameters.py b/controller/api/services/validate_algorithm_parameters.py
new file mode 100644
index 00000000..9aa86d5d
--- /dev/null
+++ b/controller/api/services/validate_algorithm_parameters.py
@@ -0,0 +1,224 @@
+from typing import Optional, Dict, Any, List
+
+from controller.algorithms import GenericParameter
+from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, \
+    InputDataParameterDTO, CrossValidationParametersDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
+    INPUTDATA_DATASET_PARAMETER_NAME, \
+    INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME
+from controller.api.errors import BadRequest
+from controller.worker_catalogue import WorkerCatalogue
+
+
+def validate_algorithm_parameters(algorithm_specs: AlgorithmDTO,
+                                  algorithm_request: AlgorithmRequestDTO):
+    # Validate inputdata
+    validate_inputdata(algorithm_specs.inputdata,
+                       algorithm_request.inputdata)
+
+    # Validate generic parameters
+    validate_generic_parameters(algorithm_specs.parameters,
+                                algorithm_request.parameters)
+
+    # Validate crossvalidation parameters
+    validate_crossvalidation_parameters(algorithm_specs.crossvalidation,
+                                        algorithm_request.crossvalidation)
+
+
+def validate_inputdata(inputdata_specs: Dict[str, InputDataParameterDTO],
+                       input_data: Dict[str, Any]):
+    """
+    Validates that the:
+    1) datasets/pathology exist,
+    2) datasets belong in the pathology,
+    3) filters have proper format
+    4) and the cdes parameters have proper values.
+
+    Validates that the algorithm's input data follow the specs.
+
+    """
+    validate_proper_pathology_and_dataset_values(input_data[INPUTDATA_PATHOLOGY_PARAMETER_NAME],
+                                                 input_data[INPUTDATA_DATASET_PARAMETER_NAME])
+
+    validate_proper_filters(input_data[INPUTDATA_FILTERS_PARAMETER_NAME])
+
+    validate_proper_cde_values(inputdata_specs[INPUTDATA_X_PARAMETER_NAME],
+                               input_data[INPUTDATA_X_PARAMETER_NAME])
+
+    validate_proper_cde_values(inputdata_specs[INPUTDATA_Y_PARAMETER_NAME],
+                               input_data[INPUTDATA_Y_PARAMETER_NAME])
+
+
+def validate_proper_pathology_and_dataset_values(pathology: str,
+                                                 datasets: List[str]):
+    """
+    Validates that the pathology, dataset values exists and
+    that the datasets belong in the pathology.
+    """
+    # TODO Maybe change bad request to a user error???
+
+    worker_catalogue = WorkerCatalogue()
+    if pathology not in worker_catalogue.pathologies.keys():
+        raise BadRequest(f"Pathology '{pathology}' does not exist.")
+
+    if type(datasets) is not list:
+        raise BadRequest(f"Datasets parameter should be a list.")
+
+    if not all(dataset in worker_catalogue.pathologies[pathology] for dataset in datasets):
+        raise BadRequest(f"Datasets '{datasets}' do not belong in pathology '{pathology}'.")
+
+
+def validate_proper_filters(filters):
+    """
+    Validates that the filters provided have the correct format
+    following: https://querybuilder.js.org/
+    """
+    # TODO Add filters
+    pass
+
+
+def validate_proper_cde_values(cde_parameter_specs: InputDataParameterDTO,
+                               cde_parameter_value: List[str]):
+    """
+    Validates that a cde parameter follows the specs provided
+    in the algorithm properties.
+    """
+    # TODO Next one!
+    pass
+
+
+def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericParameter]],
+                                parameters: Optional[Dict[str, Any]]):
+    """
+    If the algorithm has generic parameters (parameters),
+    it validates that they follow the algorithm specs.
+    """
+    if parameters_specs is None:
+        return
+
+    if parameters is None:
+        raise BadRequest("Algorithm parameters not provided.")
+
+    for parameter_name, parameter_spec in parameters_specs.items():
+        if parameter_name not in parameters.keys():
+            if parameter_spec.notblank:
+                raise BadRequest(f"Parameter '{parameter_name}' should not be blank.")
+            else:
+                continue
+
+        parameter_value = parameters[parameter_name]
+        validate_proper_parameter_values(parameter_name,
+                                         parameter_value,
+                                         parameter_spec.type,
+                                         parameter_spec.enums,
+                                         parameter_spec.min,
+                                         parameter_spec.max,
+                                         parameter_spec.multiple)
+
+
+def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationParametersDTO],
+                                        crossvalidation: Optional[Dict[str, Any]]):
+    """
+    If crossvalidation is enabled, it validates that the algorithm's
+    crossvalidation parameters follow the specs.
+    """
+
+    if crossvalidation_specs is None:
+        return
+
+    if crossvalidation is None:
+        raise BadRequest("Crossvalidation parameters not provided.")
+
+    validate_generic_parameters(crossvalidation_specs.parameters,
+                                crossvalidation)
+
+
+def validate_proper_parameter_values(parameter_name: str,
+                                     parameter_value: Any,
+                                     parameter_type: str,
+                                     parameter_enums: Optional[List[Any]],
+                                     parameter_min_value: Optional[int],
+                                     parameter_max_value: Optional[int],
+                                     multiple_allowed: bool
+                                     ):
+    """
+    Validates that the parameter value follows the specs and :
+    1) has proper type,
+    2) has proper enumerations, if any,
+    3) is inside the min-max limits, if any,
+    4) and follows the multiple values rule.
+    """
+    if multiple_allowed and not isinstance(parameter_value, list):
+        raise BadRequest(f"Parameter '{parameter_name}' should be a list.")
+
+    # If the parameter value is a list, check each elements
+    if multiple_allowed:
+        for element in parameter_value:
+            validate_proper_parameter_type(parameter_name,
+                                           element,
+                                           parameter_type)
+
+            validate_proper_parameter_enumerations(parameter_name,
+                                                   element,
+                                                   parameter_enums)
+
+            validate_parameter_inside_min_max(parameter_name,
+                                              element,
+                                              parameter_min_value,
+                                              parameter_max_value)
+    else:
+        validate_proper_parameter_type(parameter_name,
+                                       parameter_value,
+                                       parameter_type)
+
+        validate_proper_parameter_enumerations(parameter_name,
+                                               parameter_value,
+                                               parameter_enums)
+
+        validate_parameter_inside_min_max(parameter_name,
+                                          parameter_value,
+                                          parameter_min_value,
+                                          parameter_max_value)
+
+
+def validate_proper_parameter_type(parameter_name: str,
+                                   parameter_value: Any,
+                                   parameter_type: str
+                                   ):
+    mip_types_to_python_types = {
+        "text": [str],
+        "int": [int],
+        "real": [float, int],
+        "jsonObject": [dict]
+    }
+    if type(parameter_value) not in mip_types_to_python_types[parameter_type]:
+        raise BadRequest(f"Parameter '{parameter_name}' values should be of type '{parameter_type}'.")
+
+
+def validate_proper_parameter_enumerations(parameter_name: str,
+                                           parameter_value: Any,
+                                           parameter_enums: Optional[List[Any]]
+                                           ):
+    if parameter_enums is None:
+        return
+
+    if parameter_value not in parameter_enums:
+        raise BadRequest(
+            f"Parameter '{parameter_name}' values should be one of the following: '{str(parameter_enums)}' .")
+
+
+def validate_parameter_inside_min_max(parameter_name: str,
+                                      parameter_value: Any,
+                                      parameter_min_value: Optional[int],
+                                      parameter_max_value: Optional[int]
+                                      ):
+    if parameter_min_value is None and parameter_max_value is None:
+        return
+
+    if parameter_min_value is not None and parameter_value < parameter_min_value:
+        raise BadRequest(
+            f"Parameter '{parameter_name}' values should be greater than {parameter_min_value} .")
+
+    if parameter_max_value is not None and parameter_value > parameter_max_value:
+        raise BadRequest(
+            f"Parameter '{parameter_name}' values should be lower than {parameter_max_value} .")
diff --git a/controller/worker_catalogue.py b/controller/worker_catalogue.py
index 06c2d3b6..77428349 100644
--- a/controller/worker_catalogue.py
+++ b/controller/worker_catalogue.py
@@ -21,12 +21,20 @@ class Worker:
 @dataclass
 class WorkerCatalogue(metaclass=Singleton):
     workers: Dict[str, Worker]
+    pathologies: Dict[str, List[str]]
 
     def __init__(self):
         worker_catalogue_str = pkg_resources.read_text(config, 'worker_catalogue.json')
         workers_dict: Dict[str, Worker] = json.loads(worker_catalogue_str)
         self.workers = {worker_name: Worker.from_dict(worker_values)
                         for worker_name, worker_values in workers_dict.items()}
+        self.pathologies = {}
+        for worker in self.workers.values():
+            for pathology_name, datasets in worker.data.items():
+                if pathology_name not in self.pathologies.keys():
+                    self.pathologies[pathology_name] = datasets
+                else:
+                    self.pathologies[pathology_name].extend(datasets)
 
 
 WorkerCatalogue()
-- 
GitLab


From 172af8604a4fc57f7c73285af48ac8e7127c6384 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Tue, 9 Feb 2021 18:49:08 +0200
Subject: [PATCH 14/30] Added api inputdata validation.

---
 controller/api/api_controller.py              |  11 +-
 controller/api/errors.py                      |  11 +-
 controller/api/services/run_algorithm.py      |   2 +-
 .../services/validate_algorithm_parameters.py | 286 +++++++++++-------
 controller/common_data_elements.py            |  31 +-
 5 files changed, 217 insertions(+), 124 deletions(-)

diff --git a/controller/api/api_controller.py b/controller/api/api_controller.py
index 489b16fe..64c0ee5c 100644
--- a/controller/api/api_controller.py
+++ b/controller/api/api_controller.py
@@ -4,7 +4,7 @@ import traceback
 from quart import Quart, request
 
 from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, AlgorithmSpecifications
-from controller.api.errors import BadRequest
+from controller.api.errors import BadRequest, BadUserInput
 from controller.api.services.run_algorithm import run_algorithm
 
 app = Quart(__name__)
@@ -28,16 +28,21 @@ async def post_algorithm(algorithm_name: str) -> str:
 
     try:
         response = run_algorithm(algorithm_name, request_body)
-    except BadRequest as exc:
+    except (BadRequest, BadUserInput) as exc:
         raise exc
     except:
         logging.error(f"Unhandled exception: \n {traceback.format_exc()}")
         raise BadRequest("Something went wrong. "
                          "Please inform the system administrator or try again later.")
 
-    return "Success!"
+    return response
 
 
 @app.errorhandler(BadRequest)
 def handle_bad_request(error: BadRequest):
     return error.message, error.status_code
+
+
+@app.errorhandler(BadUserInput)
+def handle_bad_user_input(error: BadUserInput):
+    return error.message, error.status_code
diff --git a/controller/api/errors.py b/controller/api/errors.py
index 17cff568..b88b9ee8 100644
--- a/controller/api/errors.py
+++ b/controller/api/errors.py
@@ -5,5 +5,12 @@ class BadRequest(Exception):
         self.message = message
 
 
-class UserError(Exception):
-    pass
+class BadUserInput(Exception):
+    def __init__(self, message):
+        Exception.__init__(self)
+        self.status_code = 200
+        self.message = create_response("text/plain+user_error", message)
+
+
+def create_response(mime_type: str, message: str):
+    return {mime_type: message}
diff --git a/controller/api/services/run_algorithm.py b/controller/api/services/run_algorithm.py
index d829800d..1a8ec8de 100644
--- a/controller/api/services/run_algorithm.py
+++ b/controller/api/services/run_algorithm.py
@@ -26,4 +26,4 @@ def run_algorithm(algorithm_name: str, request_body: str):
     validate_algorithm_parameters(algorithm_specs, algorithm_request)
 
     # TODO Trigger algorithm execution on the controller
-    pass
+    return "Success!"
diff --git a/controller/api/services/validate_algorithm_parameters.py b/controller/api/services/validate_algorithm_parameters.py
index 9aa86d5d..bf62615b 100644
--- a/controller/api/services/validate_algorithm_parameters.py
+++ b/controller/api/services/validate_algorithm_parameters.py
@@ -6,7 +6,8 @@ from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, \
     InputDataParameterDTO, CrossValidationParametersDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
     INPUTDATA_DATASET_PARAMETER_NAME, \
     INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME
-from controller.api.errors import BadRequest
+from controller.api.errors import BadRequest, BadUserInput
+from controller.common_data_elements import CommonDataElements, CommonDataElement
 from controller.worker_catalogue import WorkerCatalogue
 
 
@@ -37,38 +38,34 @@ def validate_inputdata(inputdata_specs: Dict[str, InputDataParameterDTO],
     Validates that the algorithm's input data follow the specs.
 
     """
-    validate_proper_pathology_and_dataset_values(input_data[INPUTDATA_PATHOLOGY_PARAMETER_NAME],
-                                                 input_data[INPUTDATA_DATASET_PARAMETER_NAME])
+    validate_inputdata_pathology_and_dataset_values(input_data[INPUTDATA_PATHOLOGY_PARAMETER_NAME],
+                                                    input_data[INPUTDATA_DATASET_PARAMETER_NAME])
 
-    validate_proper_filters(input_data[INPUTDATA_FILTERS_PARAMETER_NAME])
+    validate_inputdata_filters(input_data[INPUTDATA_FILTERS_PARAMETER_NAME])
 
-    validate_proper_cde_values(inputdata_specs[INPUTDATA_X_PARAMETER_NAME],
-                               input_data[INPUTDATA_X_PARAMETER_NAME])
+    validate_inputdata_cdes(inputdata_specs,
+                            input_data)
 
-    validate_proper_cde_values(inputdata_specs[INPUTDATA_Y_PARAMETER_NAME],
-                               input_data[INPUTDATA_Y_PARAMETER_NAME])
 
-
-def validate_proper_pathology_and_dataset_values(pathology: str,
-                                                 datasets: List[str]):
+def validate_inputdata_pathology_and_dataset_values(pathology: str,
+                                                    datasets: List[str]):
     """
     Validates that the pathology, dataset values exists and
     that the datasets belong in the pathology.
     """
-    # TODO Maybe change bad request to a user error???
 
     worker_catalogue = WorkerCatalogue()
     if pathology not in worker_catalogue.pathologies.keys():
-        raise BadRequest(f"Pathology '{pathology}' does not exist.")
+        raise BadUserInput(f"Pathology '{pathology}' does not exist.")
 
     if type(datasets) is not list:
         raise BadRequest(f"Datasets parameter should be a list.")
 
     if not all(dataset in worker_catalogue.pathologies[pathology] for dataset in datasets):
-        raise BadRequest(f"Datasets '{datasets}' do not belong in pathology '{pathology}'.")
+        raise BadUserInput(f"Datasets '{datasets}' do not belong in pathology '{pathology}'.")
 
 
-def validate_proper_filters(filters):
+def validate_inputdata_filters(filters):
     """
     Validates that the filters provided have the correct format
     following: https://querybuilder.js.org/
@@ -77,14 +74,102 @@ def validate_proper_filters(filters):
     pass
 
 
-def validate_proper_cde_values(cde_parameter_specs: InputDataParameterDTO,
-                               cde_parameter_value: List[str]):
+def validate_inputdata_cdes(input_data_specs: Dict[str, InputDataParameterDTO],
+                            input_data: Dict[str, Any]):
     """
-    Validates that a cde parameter follows the specs provided
-    in the algorithm properties.
+    Validates that the cdes input data (x,y) follow the specs provided
+    in the algorithm specifications.
     """
-    # TODO Next one!
-    pass
+
+    for cde_parameter_name in [INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME]:
+        # Validate that the cde parameters were provided, if required.
+        cde_parameter_specs = input_data_specs[cde_parameter_name]
+        if cde_parameter_specs.notblank \
+                and cde_parameter_name not in input_data.keys():
+            raise BadUserInput(f"Inputdata '{cde_parameter_name}' should be provided.")
+
+        # Continue if the cde parameter was not provided
+        if cde_parameter_name not in input_data.keys():
+            continue
+
+        cde_parameter_value = input_data[cde_parameter_name]
+        validate_inputdata_cdes_length(cde_parameter_name, cde_parameter_value, cde_parameter_specs)
+
+        pathology = input_data[INPUTDATA_PATHOLOGY_PARAMETER_NAME]
+        for cde in cde_parameter_value:
+            validate_inputdata_cde_value(cde, cde_parameter_name, cde_parameter_specs, pathology)
+
+
+def validate_inputdata_cdes_length(cde_parameter_name: str,
+                                   cde_parameter_value: Any,
+                                   cde_parameter_specs: InputDataParameterDTO):
+    """
+    Validate that the cde inputdata has proper list length
+    """
+    if type(cde_parameter_value) is not list:
+        raise BadRequest(f"Inputdata '{cde_parameter_name}' should be a list.")
+
+    if not cde_parameter_specs.multiple and len(cde_parameter_value) > 1:
+        raise BadUserInput(f"Inputdata '{cde_parameter_name}' cannot have multiple values.")
+
+
+def validate_inputdata_cde_value(cde: str,
+                                 cde_parameter_name: str,
+                                 cde_parameter_specs: InputDataParameterDTO,
+                                 pathology: str):
+    """
+    Validation of a specific cde in a parameter for the following:
+    1) that it exists in the pathology CDEs,
+    2) that it has a type allowed from the specification,
+    3) that it has a statistical type allowed from the specification and
+    4) that it has the proper amount of enumerations.
+    """
+    pathology_cdes: Dict[str, CommonDataElement] = CommonDataElements().pathologies[pathology]
+    if cde not in pathology_cdes.keys():
+        raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
+                           f"does not exist in pathology '{pathology}'.")
+
+    cde_metadata: CommonDataElement = pathology_cdes[cde]
+    validate_inputdata_cde_types(cde, cde_metadata, cde_parameter_name, cde_parameter_specs)
+    validate_inputdata_cde_stattypes(cde, cde_metadata, cde_parameter_name, cde_parameter_specs)
+    validate_inputdata_cde_enumerations(cde, cde_metadata, cde_parameter_name, cde_parameter_specs)
+
+
+def validate_inputdata_cde_types(cde: str,
+                                 cde_metadata: CommonDataElement,
+                                 cde_parameter_name: str,
+                                 cde_parameter_specs: InputDataParameterDTO):
+    # Validate that the cde belongs in the allowed types
+    if cde_metadata.sql_type not in cde_parameter_specs.types:
+        # If "real" is allowed, "int" is allowed as well
+        if cde_metadata.sql_type != "int" \
+                or "real" not in cde_parameter_specs.types:
+            raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
+                               f"doesn't have one of the allowed types "
+                               f"'{cde_parameter_specs.types}'.")
+
+
+def validate_inputdata_cde_stattypes(cde: str,
+                                     cde_metadata: CommonDataElement,
+                                     cde_parameter_name: str,
+                                     cde_parameter_specs: InputDataParameterDTO):
+    if cde_metadata.categorical and "nominal" not in cde_parameter_specs.stattypes:
+        raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
+                           f"should be categorical.")
+
+    if not cde_metadata.categorical and "numerical" not in cde_parameter_specs.stattypes:
+        raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
+                           f"should NOT be categorical.")
+
+
+def validate_inputdata_cde_enumerations(cde: str,
+                                        cde_metadata: CommonDataElement,
+                                        cde_parameter_name: str,
+                                        cde_parameter_specs: InputDataParameterDTO):
+    if cde_parameter_specs.enumslen is not None and \
+            cde_parameter_specs.enumslen != len(cde_metadata.enumerations):
+        raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
+                           f"should have {cde_parameter_specs.enumslen} enumerations.")
 
 
 def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericParameter]],
@@ -96,51 +181,32 @@ def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericPara
     if parameters_specs is None:
         return
 
-    if parameters is None:
-        raise BadRequest("Algorithm parameters not provided.")
-
+    # Validating that the parameters match with the notblank spec.
     for parameter_name, parameter_spec in parameters_specs.items():
+        if not parameter_spec.notblank:
+            continue
+        if not parameters:
+            raise BadRequest(f"Algorithm parameters not provided.")
         if parameter_name not in parameters.keys():
-            if parameter_spec.notblank:
-                raise BadRequest(f"Parameter '{parameter_name}' should not be blank.")
-            else:
-                continue
+            raise BadUserInput(f"Parameter '{parameter_name}' should not be blank.")
 
         parameter_value = parameters[parameter_name]
-        validate_proper_parameter_values(parameter_name,
-                                         parameter_value,
-                                         parameter_spec.type,
-                                         parameter_spec.enums,
-                                         parameter_spec.min,
-                                         parameter_spec.max,
-                                         parameter_spec.multiple)
-
-
-def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationParametersDTO],
-                                        crossvalidation: Optional[Dict[str, Any]]):
-    """
-    If crossvalidation is enabled, it validates that the algorithm's
-    crossvalidation parameters follow the specs.
-    """
-
-    if crossvalidation_specs is None:
-        return
-
-    if crossvalidation is None:
-        raise BadRequest("Crossvalidation parameters not provided.")
-
-    validate_generic_parameters(crossvalidation_specs.parameters,
-                                crossvalidation)
+        validate_generic_parameter_values(parameter_name,
+                                          parameter_value,
+                                          parameter_spec.type,
+                                          parameter_spec.enums,
+                                          parameter_spec.min,
+                                          parameter_spec.max,
+                                          parameter_spec.multiple)
 
 
-def validate_proper_parameter_values(parameter_name: str,
-                                     parameter_value: Any,
-                                     parameter_type: str,
-                                     parameter_enums: Optional[List[Any]],
-                                     parameter_min_value: Optional[int],
-                                     parameter_max_value: Optional[int],
-                                     multiple_allowed: bool
-                                     ):
+def validate_generic_parameter_values(parameter_name: str,
+                                      parameter_value: Any,
+                                      parameter_type: str,
+                                      parameter_enums: Optional[List[Any]],
+                                      parameter_min_value: Optional[int],
+                                      parameter_max_value: Optional[int],
+                                      multiple_allowed: bool):
     """
     Validates that the parameter value follows the specs and :
     1) has proper type,
@@ -149,42 +215,42 @@ def validate_proper_parameter_values(parameter_name: str,
     4) and follows the multiple values rule.
     """
     if multiple_allowed and not isinstance(parameter_value, list):
-        raise BadRequest(f"Parameter '{parameter_name}' should be a list.")
+        raise BadUserInput(f"Parameter '{parameter_name}' should be a list.")
 
     # If the parameter value is a list, check each elements
     if multiple_allowed:
         for element in parameter_value:
-            validate_proper_parameter_type(parameter_name,
-                                           element,
-                                           parameter_type)
-
-            validate_proper_parameter_enumerations(parameter_name,
-                                                   element,
-                                                   parameter_enums)
-
-            validate_parameter_inside_min_max(parameter_name,
-                                              element,
-                                              parameter_min_value,
-                                              parameter_max_value)
+            validate_generic_parameter_type(parameter_name,
+                                            element,
+                                            parameter_type)
+
+            validate_generic_parameter_enumerations(parameter_name,
+                                                    element,
+                                                    parameter_enums)
+
+            validate_generic_parameter_inside_min_max(parameter_name,
+                                                      element,
+                                                      parameter_min_value,
+                                                      parameter_max_value)
     else:
-        validate_proper_parameter_type(parameter_name,
-                                       parameter_value,
-                                       parameter_type)
+        validate_generic_parameter_type(parameter_name,
+                                        parameter_value,
+                                        parameter_type)
 
-        validate_proper_parameter_enumerations(parameter_name,
-                                               parameter_value,
-                                               parameter_enums)
+        validate_generic_parameter_enumerations(parameter_name,
+                                                parameter_value,
+                                                parameter_enums)
 
-        validate_parameter_inside_min_max(parameter_name,
-                                          parameter_value,
-                                          parameter_min_value,
-                                          parameter_max_value)
+        validate_generic_parameter_inside_min_max(parameter_name,
+                                                  parameter_value,
+                                                  parameter_min_value,
+                                                  parameter_max_value)
 
 
-def validate_proper_parameter_type(parameter_name: str,
-                                   parameter_value: Any,
-                                   parameter_type: str
-                                   ):
+def validate_generic_parameter_type(parameter_name: str,
+                                    parameter_value: Any,
+                                    parameter_type: str
+                                    ):
     mip_types_to_python_types = {
         "text": [str],
         "int": [int],
@@ -192,33 +258,47 @@ def validate_proper_parameter_type(parameter_name: str,
         "jsonObject": [dict]
     }
     if type(parameter_value) not in mip_types_to_python_types[parameter_type]:
-        raise BadRequest(f"Parameter '{parameter_name}' values should be of type '{parameter_type}'.")
+        raise BadUserInput(f"Parameter '{parameter_name}' values should be of type '{parameter_type}'.")
 
 
-def validate_proper_parameter_enumerations(parameter_name: str,
-                                           parameter_value: Any,
-                                           parameter_enums: Optional[List[Any]]
-                                           ):
+def validate_generic_parameter_enumerations(parameter_name: str,
+                                            parameter_value: Any,
+                                            parameter_enums: Optional[List[Any]]):
     if parameter_enums is None:
         return
 
     if parameter_value not in parameter_enums:
-        raise BadRequest(
-            f"Parameter '{parameter_name}' values should be one of the following: '{str(parameter_enums)}' .")
+        raise BadUserInput(f"Parameter '{parameter_name}' values "
+                           f"should be one of the following: '{str(parameter_enums)}'.")
 
 
-def validate_parameter_inside_min_max(parameter_name: str,
-                                      parameter_value: Any,
-                                      parameter_min_value: Optional[int],
-                                      parameter_max_value: Optional[int]
-                                      ):
+def validate_generic_parameter_inside_min_max(parameter_name: str,
+                                              parameter_value: Any,
+                                              parameter_min_value: Optional[int],
+                                              parameter_max_value: Optional[int]
+                                              ):
     if parameter_min_value is None and parameter_max_value is None:
         return
 
     if parameter_min_value is not None and parameter_value < parameter_min_value:
-        raise BadRequest(
-            f"Parameter '{parameter_name}' values should be greater than {parameter_min_value} .")
+        raise BadUserInput(f"Parameter '{parameter_name}' values "
+                           f"should be greater than {parameter_min_value} .")
 
     if parameter_max_value is not None and parameter_value > parameter_max_value:
-        raise BadRequest(
-            f"Parameter '{parameter_name}' values should be lower than {parameter_max_value} .")
+        raise BadUserInput(f"Parameter '{parameter_name}' values "
+                           f"should be lower than {parameter_max_value} .")
+
+
+def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationParametersDTO],
+                                        crossvalidation: Optional[Dict[str, Any]]):
+    """
+    If crossvalidation is enabled, it validates that the algorithm's
+    crossvalidation parameters follow the specs.
+    """
+
+    # Cross validation is optional, if not present, do nothing
+    if crossvalidation_specs is None or crossvalidation is None:
+        return
+
+    validate_generic_parameters(crossvalidation_specs.parameters,
+                                crossvalidation)
diff --git a/controller/common_data_elements.py b/controller/common_data_elements.py
index fb0329e7..4ad66e8f 100644
--- a/controller/common_data_elements.py
+++ b/controller/common_data_elements.py
@@ -5,8 +5,8 @@ from typing import List, Optional, Set, Dict
 
 from dataclasses_json import dataclass_json
 
-# TODO How can we read all algorithm.json files without relative paths?
-RELATIVE_METADATA_PATH = "config/pathologies_metadata"
+# TODO How can we read the pathologies' metadata  files without relative paths?
+RELATIVE_METADATA_PATH = "../config/pathologies_metadata"
 
 
 @dataclass_json
@@ -43,7 +43,7 @@ class MetadataGroup:
 
 
 @dataclass
-class CommonDataElementMetadata:
+class CommonDataElement:
     sql_type: str
     categorical: bool
     enumerations: Optional[Set] = None
@@ -57,30 +57,31 @@ class CommonDataElementMetadata:
 
 @dataclass
 class CommonDataElements:
-    elements: Dict[str, Dict[str, CommonDataElementMetadata]]
+    pathologies: Dict[str, Dict[str, CommonDataElement]]
 
     def __init__(self):
 
-        def iterate_metadata_groups(metadata_group: MetadataGroup) -> Dict[str, CommonDataElementMetadata]:
-            group_elements: Dict[str, CommonDataElementMetadata] = {}
+        def iterate_metadata_groups(metadata_group: MetadataGroup) -> Dict[str, CommonDataElement]:
+            group_elements: Dict[str, CommonDataElement] = {}
             for variable in metadata_group.variables:
-                group_elements[variable.code] = CommonDataElementMetadata(variable)
+                group_elements[variable.code] = CommonDataElement(variable)
             for sub_group in metadata_group.groups:
                 group_elements.update(iterate_metadata_groups(sub_group))
             return group_elements
 
-        metadata_paths = [os.path.join(RELATIVE_METADATA_PATH, json_file)
-                          for json_file in os.listdir(RELATIVE_METADATA_PATH)
-                          if json_file.endswith('.json')]
+        print(os.getcwd())
+        pathology_metadata_files = [os.path.join(RELATIVE_METADATA_PATH, json_file)
+                                    for json_file in os.listdir(RELATIVE_METADATA_PATH)
+                                    if json_file.endswith('.json')]
 
-        self.elements = {}
-        for metadata_path in metadata_paths:
+        self.pathologies = {}
+        for pathology_metadata_file in pathology_metadata_files:
             try:
-                pathology_metadata = MetadataGroup.from_json(open(metadata_path).read())
-                self.elements[pathology_metadata.code] = iterate_metadata_groups(pathology_metadata)
+                pathology_metadata = MetadataGroup.from_json(open(pathology_metadata_file).read())
+                self.pathologies[pathology_metadata.code] = iterate_metadata_groups(pathology_metadata)
 
             except Exception as e:
-                logging.error(f"Parsing metadata file: {metadata_path}")
+                logging.error(f"Parsing metadata file: {pathology_metadata_file}")
                 raise e
 
 
-- 
GitLab


From 1f45396a4d33b1f24480bf0aa0f490f04163da76 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Tue, 9 Feb 2021 19:20:31 +0200
Subject: [PATCH 15/30] API restructure in app/views/errors submodules.

---
 controller/api/__init__.py                    |  1 +
 controller/api/app.py                         |  8 +++++++
 controller/api/errors/__init__.py             |  0
 controller/api/errors/error_handlers.py       | 15 ++++++++++++
 .../api/{errors.py => errors/exceptions.py}   |  0
 controller/api/services/run_algorithm.py      |  2 +-
 .../services/validate_algorithm_parameters.py |  2 +-
 controller/api/views/__init__.py              |  0
 .../algorithms.py}                            | 23 ++++---------------
 9 files changed, 31 insertions(+), 20 deletions(-)
 create mode 100644 controller/api/app.py
 create mode 100644 controller/api/errors/__init__.py
 create mode 100644 controller/api/errors/error_handlers.py
 rename controller/api/{errors.py => errors/exceptions.py} (100%)
 create mode 100644 controller/api/views/__init__.py
 rename controller/api/{api_controller.py => views/algorithms.py} (65%)

diff --git a/controller/api/__init__.py b/controller/api/__init__.py
index e69de29b..8b137891 100644
--- a/controller/api/__init__.py
+++ b/controller/api/__init__.py
@@ -0,0 +1 @@
+
diff --git a/controller/api/app.py b/controller/api/app.py
new file mode 100644
index 00000000..e978b326
--- /dev/null
+++ b/controller/api/app.py
@@ -0,0 +1,8 @@
+from quart import Quart
+
+from errors.error_handlers import error_handlers
+from views.algorithms import algorithms
+
+app = Quart(__name__)
+app.register_blueprint(algorithms)
+app.register_blueprint(error_handlers)
diff --git a/controller/api/errors/__init__.py b/controller/api/errors/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/api/errors/error_handlers.py b/controller/api/errors/error_handlers.py
new file mode 100644
index 00000000..f65bcc77
--- /dev/null
+++ b/controller/api/errors/error_handlers.py
@@ -0,0 +1,15 @@
+from quart import Blueprint
+
+from controller.api.errors.exceptions import BadRequest, BadUserInput
+
+error_handlers = Blueprint('error_handlers', __name__)
+
+
+@error_handlers.app_errorhandler(BadRequest)
+def handle_bad_request(error: BadRequest):
+    return error.message, error.status_code
+
+
+@error_handlers.app_errorhandler(BadUserInput)
+def handle_bad_user_input(error: BadUserInput):
+    return error.message, error.status_code
diff --git a/controller/api/errors.py b/controller/api/errors/exceptions.py
similarity index 100%
rename from controller/api/errors.py
rename to controller/api/errors/exceptions.py
diff --git a/controller/api/services/run_algorithm.py b/controller/api/services/run_algorithm.py
index 1a8ec8de..11ff16e5 100644
--- a/controller/api/services/run_algorithm.py
+++ b/controller/api/services/run_algorithm.py
@@ -4,7 +4,7 @@ import traceback
 from controller.algorithms import Algorithms
 from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
 from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications
-from controller.api.errors import BadRequest
+from controller.api.errors.exceptions import BadRequest
 from controller.api.services.validate_algorithm_parameters import validate_algorithm_parameters
 
 
diff --git a/controller/api/services/validate_algorithm_parameters.py b/controller/api/services/validate_algorithm_parameters.py
index bf62615b..8cc32e7b 100644
--- a/controller/api/services/validate_algorithm_parameters.py
+++ b/controller/api/services/validate_algorithm_parameters.py
@@ -6,7 +6,7 @@ from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, \
     InputDataParameterDTO, CrossValidationParametersDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
     INPUTDATA_DATASET_PARAMETER_NAME, \
     INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME
-from controller.api.errors import BadRequest, BadUserInput
+from controller.api.errors.exceptions import BadRequest, BadUserInput
 from controller.common_data_elements import CommonDataElements, CommonDataElement
 from controller.worker_catalogue import WorkerCatalogue
 
diff --git a/controller/api/views/__init__.py b/controller/api/views/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/controller/api/api_controller.py b/controller/api/views/algorithms.py
similarity index 65%
rename from controller/api/api_controller.py
rename to controller/api/views/algorithms.py
index 64c0ee5c..a7dd074f 100644
--- a/controller/api/api_controller.py
+++ b/controller/api/views/algorithms.py
@@ -1,26 +1,23 @@
 import logging
 import traceback
 
-from quart import Quart, request
+from quart import request, Blueprint
 
 from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, AlgorithmSpecifications
-from controller.api.errors import BadRequest, BadUserInput
+from controller.api.errors.exceptions import BadRequest, BadUserInput
 from controller.api.services.run_algorithm import run_algorithm
 
-app = Quart(__name__)
+algorithms = Blueprint('algorithms_endpoint', __name__)
 
 
-# TODO break into views/app/errors
-
-
-@app.route("/algorithms")
+@algorithms.route("/algorithms")
 async def get_algorithms() -> str:
     algorithm_specifications = AlgorithmSpecifications().algorithms_list
 
     return AlgorithmDTO.schema().dumps(algorithm_specifications, many=True)
 
 
-@app.route("/algorithms/<algorithm_name>", methods=['POST'])
+@algorithms.route("/algorithms/<algorithm_name>", methods=['POST'])
 async def post_algorithm(algorithm_name: str) -> str:
     logging.info(f"Algorithm execution with name {algorithm_name}.")
 
@@ -36,13 +33,3 @@ async def post_algorithm(algorithm_name: str) -> str:
                          "Please inform the system administrator or try again later.")
 
     return response
-
-
-@app.errorhandler(BadRequest)
-def handle_bad_request(error: BadRequest):
-    return error.message, error.status_code
-
-
-@app.errorhandler(BadUserInput)
-def handle_bad_user_input(error: BadUserInput):
-    return error.message, error.status_code
-- 
GitLab


From 46ad3b172be77ec9c5e014f5cfd703f47b4471bf Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 10 Feb 2021 12:13:34 +0200
Subject: [PATCH 16/30] Project restructure and relative import fixes.

---
 CODEOWNERS                                    |  8 ++--
 controller/api/app.py                         |  8 ----
 __init__.py => mipengine/__init__.py          |  0
 .../algorithms}/.gitignore                    |  0
 .../algorithms}/crossvalidation.json          |  0
 .../algorithms}/test.json                     |  0
 .../controller}/.gitignore                    |  0
 .../controller}/__init__.py                   |  0
 .../controller/algorithms_specifications.py   | 24 +++++-----
 .../api/DTOs/AlgorithmExecutionDTOs.py        |  0
 .../api/DTOs/AlgorithmSpecificationsDTOs.py   | 45 ++++++++++---------
 .../controller}/api/DTOs/__init__.py          |  0
 .../controller}/api/__init__.py               |  0
 mipengine/controller/api/app.py               |  8 ++++
 .../controller}/api/errors/__init__.py        |  0
 .../controller}/api/errors/error_handlers.py  |  2 +-
 .../controller}/api/errors/exceptions.py      |  0
 .../controller}/api/services/__init__.py      |  0
 .../controller}/api/services/run_algorithm.py | 12 ++---
 .../services/validate_algorithm_parameters.py | 32 ++++++-------
 .../controller}/api/views/__init__.py         |  0
 .../controller}/api/views/algorithms.py       |  8 ++--
 .../controller}/common_data_elements.py       |  0
 .../controller}/config/__init__.py            |  0
 .../config/pathologies_metadata/dementia.json |  0
 .../pathologies_metadata/mentalhealth.json    |  0
 .../config/pathologies_metadata/tbi.json      |  0
 .../controller}/config/worker_catalogue.json  |  0
 .../controller}/requirements.txt              |  0
 {controller => mipengine/controller}/utils.py |  0
 .../controller}/worker_catalogue.py           |  4 +-
 {worker => mipengine/worker}/.gitignore       |  0
 .../worker}/tasks/merge_tables.py             |  0
 .../worker}/tasks/remote_tables.py            |  0
 {worker => mipengine/worker}/tasks/tables.py  |  0
 {worker => mipengine/worker}/tasks/udfs.py    |  0
 {worker => mipengine/worker}/tasks/views.py   |  0
 .../worker}/udf_generator/.gitignore          |  0
 38 files changed, 77 insertions(+), 74 deletions(-)
 delete mode 100644 controller/api/app.py
 rename __init__.py => mipengine/__init__.py (100%)
 rename {algorithms => mipengine/algorithms}/.gitignore (100%)
 rename {algorithms => mipengine/algorithms}/crossvalidation.json (100%)
 rename {algorithms => mipengine/algorithms}/test.json (100%)
 rename {controller => mipengine/controller}/.gitignore (100%)
 rename {controller => mipengine/controller}/__init__.py (100%)
 rename controller/algorithms.py => mipengine/controller/algorithms_specifications.py (80%)
 rename {controller => mipengine/controller}/api/DTOs/AlgorithmExecutionDTOs.py (100%)
 rename {controller => mipengine/controller}/api/DTOs/AlgorithmSpecificationsDTOs.py (66%)
 rename {controller => mipengine/controller}/api/DTOs/__init__.py (100%)
 rename {controller => mipengine/controller}/api/__init__.py (100%)
 create mode 100644 mipengine/controller/api/app.py
 rename {controller => mipengine/controller}/api/errors/__init__.py (100%)
 rename {controller => mipengine/controller}/api/errors/error_handlers.py (81%)
 rename {controller => mipengine/controller}/api/errors/exceptions.py (100%)
 rename {controller => mipengine/controller}/api/services/__init__.py (100%)
 rename {controller => mipengine/controller}/api/services/run_algorithm.py (62%)
 rename {controller => mipengine/controller}/api/services/validate_algorithm_parameters.py (92%)
 rename {controller => mipengine/controller}/api/views/__init__.py (100%)
 rename {controller => mipengine/controller}/api/views/algorithms.py (70%)
 rename {controller => mipengine/controller}/common_data_elements.py (100%)
 rename {controller => mipengine/controller}/config/__init__.py (100%)
 rename {controller => mipengine/controller}/config/pathologies_metadata/dementia.json (100%)
 rename {controller => mipengine/controller}/config/pathologies_metadata/mentalhealth.json (100%)
 rename {controller => mipengine/controller}/config/pathologies_metadata/tbi.json (100%)
 rename {controller => mipengine/controller}/config/worker_catalogue.json (100%)
 rename {controller => mipengine/controller}/requirements.txt (100%)
 rename {controller => mipengine/controller}/utils.py (100%)
 rename {controller => mipengine/controller}/worker_catalogue.py (92%)
 rename {worker => mipengine/worker}/.gitignore (100%)
 rename {worker => mipengine/worker}/tasks/merge_tables.py (100%)
 rename {worker => mipengine/worker}/tasks/remote_tables.py (100%)
 rename {worker => mipengine/worker}/tasks/tables.py (100%)
 rename {worker => mipengine/worker}/tasks/udfs.py (100%)
 rename {worker => mipengine/worker}/tasks/views.py (100%)
 rename {worker => mipengine/worker}/udf_generator/.gitignore (100%)

diff --git a/CODEOWNERS b/CODEOWNERS
index c7da7c76..7bfbda52 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -1,11 +1,11 @@
 # CodeOwners
 
 # Algorithms
-/algorithms/ @jassak
+/mipengine/algorithms/ @jassak
 
 # Controller service
-/controller/ @apmariglis @ThanKarab
+/mipengine/controller/ @apmariglis @ThanKarab
 
 # Worker service
-/worker/ @apmariglis @ThanKarab
-/worker/udf_generator/ @jassak
+/mipengine/worker/ @apmariglis @ThanKarab
+/mipengine/worker/udf_generator/ @jassak
diff --git a/controller/api/app.py b/controller/api/app.py
deleted file mode 100644
index e978b326..00000000
--- a/controller/api/app.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from quart import Quart
-
-from errors.error_handlers import error_handlers
-from views.algorithms import algorithms
-
-app = Quart(__name__)
-app.register_blueprint(algorithms)
-app.register_blueprint(error_handlers)
diff --git a/__init__.py b/mipengine/__init__.py
similarity index 100%
rename from __init__.py
rename to mipengine/__init__.py
diff --git a/algorithms/.gitignore b/mipengine/algorithms/.gitignore
similarity index 100%
rename from algorithms/.gitignore
rename to mipengine/algorithms/.gitignore
diff --git a/algorithms/crossvalidation.json b/mipengine/algorithms/crossvalidation.json
similarity index 100%
rename from algorithms/crossvalidation.json
rename to mipengine/algorithms/crossvalidation.json
diff --git a/algorithms/test.json b/mipengine/algorithms/test.json
similarity index 100%
rename from algorithms/test.json
rename to mipengine/algorithms/test.json
diff --git a/controller/.gitignore b/mipengine/controller/.gitignore
similarity index 100%
rename from controller/.gitignore
rename to mipengine/controller/.gitignore
diff --git a/controller/__init__.py b/mipengine/controller/__init__.py
similarity index 100%
rename from controller/__init__.py
rename to mipengine/controller/__init__.py
diff --git a/controller/algorithms.py b/mipengine/controller/algorithms_specifications.py
similarity index 80%
rename from controller/algorithms.py
rename to mipengine/controller/algorithms_specifications.py
index 31a7a489..12b1bd39 100644
--- a/controller/algorithms.py
+++ b/mipengine/controller/algorithms_specifications.py
@@ -6,7 +6,7 @@ from typing import List, Dict, Optional, Any
 
 from dataclasses_json import dataclass_json
 
-from controller.utils import Singleton
+from mipengine.controller.utils import Singleton
 
 # TODO How can we read all algorithm.json files without relative paths?
 RELATIVE_ALGORITHMS_PATH = "../../algorithms"
@@ -15,7 +15,7 @@ CROSSVALIDATION_ALGORITHM_NAME = "crossvalidation"
 
 @dataclass_json
 @dataclass
-class InputData:
+class InputDataSpecification:
     label: str
     desc: str
     types: List[str]
@@ -36,7 +36,7 @@ class InputData:
 
 @dataclass_json
 @dataclass
-class GenericParameter:
+class GenericParameterSpecification:
     label: str
     desc: str
     type: str
@@ -55,19 +55,19 @@ class GenericParameter:
 
 @dataclass_json
 @dataclass
-class Algorithm:
+class AlgorithmSpecifications:
     name: str
     desc: str
     label: str
     enabled: bool
-    inputdata: Optional[Dict[str, InputData]] = None
-    parameters: Optional[Dict[str, GenericParameter]] = None
+    inputdata: Optional[Dict[str, InputDataSpecification]] = None
+    parameters: Optional[Dict[str, GenericParameterSpecification]] = None
     flags: Optional[Dict[str, bool]] = None
 
 
-class Algorithms(metaclass=Singleton):
-    crossvalidation: Algorithm
-    available: Dict[str, Algorithm]
+class AlgorithmsSpecifications(metaclass=Singleton):
+    crossvalidation: AlgorithmSpecifications
+    enabled_algorithms: Dict[str, AlgorithmSpecifications]
 
     def __init__(self):
         algorithm_property_paths = [os.path.join(RELATIVE_ALGORITHMS_PATH, json_file)
@@ -77,13 +77,13 @@ class Algorithms(metaclass=Singleton):
         all_algorithms = {}
         for algorithm_property_path in algorithm_property_paths:
             try:
-                algorithm = Algorithm.from_json(open(algorithm_property_path).read())
+                algorithm = AlgorithmSpecifications.from_json(open(algorithm_property_path).read())
             except Exception as e:
                 logging.error(f"Parsing property file: {algorithm_property_path}")
                 raise e
             all_algorithms[algorithm.name] = algorithm
 
-        self.available = {
+        self.enabled_algorithms = {
             algorithm.name: algorithm
             for algorithm in all_algorithms.values()
             if algorithm.enabled and algorithm.name != CROSSVALIDATION_ALGORITHM_NAME}
@@ -94,4 +94,4 @@ class Algorithms(metaclass=Singleton):
             self.crossvalidation = all_algorithms[CROSSVALIDATION_ALGORITHM_NAME]
 
 
-Algorithms()
+AlgorithmsSpecifications()
diff --git a/controller/api/DTOs/AlgorithmExecutionDTOs.py b/mipengine/controller/api/DTOs/AlgorithmExecutionDTOs.py
similarity index 100%
rename from controller/api/DTOs/AlgorithmExecutionDTOs.py
rename to mipengine/controller/api/DTOs/AlgorithmExecutionDTOs.py
diff --git a/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
similarity index 66%
rename from controller/api/DTOs/AlgorithmSpecificationsDTOs.py
rename to mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index f046c454..c2e9819a 100644
--- a/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -3,8 +3,9 @@ from typing import List, Optional, Dict
 
 from dataclasses_json import dataclass_json
 
-from controller.algorithms import GenericParameter, Algorithm, CROSSVALIDATION_ALGORITHM_NAME, Algorithms
-from controller.utils import Singleton
+from mipengine.controller.algorithms_specifications import CROSSVALIDATION_ALGORITHM_NAME, \
+    GenericParameterSpecification, AlgorithmSpecifications, AlgorithmsSpecifications
+from mipengine.controller.utils import Singleton
 
 INPUTDATA_PATHOLOGY_PARAMETER_NAME = "pathology"
 INPUTDATA_DATASET_PARAMETER_NAME = "dataset"
@@ -15,7 +16,7 @@ INPUTDATA_Y_PARAMETER_NAME = "y"
 
 @dataclass_json
 @dataclass
-class InputDataParameterDTO:
+class InputDataSpecificationDTO:
     """
     InputDataParameterDTO is different from the InputDataParameter
     on the stattypes field.
@@ -31,7 +32,7 @@ class InputDataParameterDTO:
 
 
 def get_pathology_parameter():
-    return InputDataParameterDTO(
+    return InputDataSpecificationDTO(
         "Pathology of the data.",
         "The pathology that the algorithm will run on.",
         ["text"],
@@ -43,7 +44,7 @@ def get_pathology_parameter():
 
 
 def get_dataset_parameter():
-    return InputDataParameterDTO(
+    return InputDataSpecificationDTO(
         "Set of data to use.",
         "The set of data to run the algorithm on.",
         ["text"],
@@ -55,7 +56,7 @@ def get_dataset_parameter():
 
 
 def get_filter_parameter():
-    return InputDataParameterDTO(
+    return InputDataSpecificationDTO(
         "Filter on the data.",
         "Features used in my algorithm.",
         ["jsonObject"],
@@ -68,9 +69,9 @@ def get_filter_parameter():
 
 @dataclass_json
 @dataclass
-class GenericParameterDTO(GenericParameter):
+class GenericParameterSpecificationDTO(GenericParameterSpecification):
     """
-    GenericParameterDTO is identical to the GenericParameter
+    GenericParameterDTO is identical to the GenericParameterSpecification
     but exists for consistency and future use if needed.
     """
     pass
@@ -85,12 +86,12 @@ class CrossValidationParametersDTO:
     """
     desc: str
     label: str
-    parameters: Dict[str, GenericParameter]
+    parameters: Dict[str, GenericParameterSpecification]
 
 
 @dataclass_json
 @dataclass
-class AlgorithmDTO:
+class AlgorithmSpecificationDTO:
     """
     AlgorithmDTO is used to provide the UI the requirements
     of each algorithm.
@@ -99,16 +100,16 @@ class AlgorithmDTO:
     name: str
     desc: str
     label: str
-    inputdata: Dict[str, InputDataParameterDTO]
-    parameters: Optional[Dict[str, GenericParameter]] = None
+    inputdata: Dict[str, InputDataSpecificationDTO]
+    parameters: Optional[Dict[str, GenericParameterSpecification]] = None
     crossvalidation: Optional[CrossValidationParametersDTO] = None
 
-    def __init__(self, algorithm: Algorithm, crossvalidation: Algorithm):
+    def __init__(self, algorithm: AlgorithmSpecifications, crossvalidation: AlgorithmSpecifications):
         self.name = algorithm.name
         self.desc = algorithm.desc
         self.label = algorithm.label
         self.parameters = algorithm.parameters
-        self.inputdata = {name: InputDataParameterDTO(
+        self.inputdata = {name: InputDataSpecificationDTO(
             parameter.label,
             parameter.desc,
             parameter.types,
@@ -135,13 +136,15 @@ class AlgorithmDTO:
             )
 
 
-class AlgorithmSpecifications(metaclass=Singleton):
-    algorithms_list = List[AlgorithmDTO]
-    algorithms_dict = Dict[str, AlgorithmDTO]
+class AlgorithmSpecificationsDTOs(metaclass=Singleton):
+    algorithms_list = List[AlgorithmSpecificationDTO]
+    algorithms_dict = Dict[str, AlgorithmSpecificationDTO]
 
     def __init__(self):
-        self.algorithms_list = [AlgorithmDTO(algorithm, Algorithms().crossvalidation)
-                                for algorithm in Algorithms().available.values()]
+        algorithms_specifications = AlgorithmsSpecifications
+        self.algorithms_list = [AlgorithmSpecificationDTO(algorithm, algorithms_specifications.crossvalidation)
+                                for algorithm in algorithms_specifications.enabled_algorithms.values()]
 
-        self.algorithms_dict = {algorithm.name: AlgorithmDTO(algorithm, Algorithms().crossvalidation)
-                                for algorithm in Algorithms().available.values()}
+        self.algorithms_dict = {
+            algorithm.name: AlgorithmSpecificationDTO(algorithm, algorithms_specifications.crossvalidation)
+            for algorithm in algorithms_specifications.enabled_algorithms.values()}
diff --git a/controller/api/DTOs/__init__.py b/mipengine/controller/api/DTOs/__init__.py
similarity index 100%
rename from controller/api/DTOs/__init__.py
rename to mipengine/controller/api/DTOs/__init__.py
diff --git a/controller/api/__init__.py b/mipengine/controller/api/__init__.py
similarity index 100%
rename from controller/api/__init__.py
rename to mipengine/controller/api/__init__.py
diff --git a/mipengine/controller/api/app.py b/mipengine/controller/api/app.py
new file mode 100644
index 00000000..8f415830
--- /dev/null
+++ b/mipengine/controller/api/app.py
@@ -0,0 +1,8 @@
+from quart import Quart
+
+from mipengine.controller.api.errors.error_handlers import error_handlers
+from mipengine.controller.api.views.algorithms import algorithms
+
+app = Quart(__name__)
+app.register_blueprint(algorithms)
+app.register_blueprint(error_handlers)
diff --git a/controller/api/errors/__init__.py b/mipengine/controller/api/errors/__init__.py
similarity index 100%
rename from controller/api/errors/__init__.py
rename to mipengine/controller/api/errors/__init__.py
diff --git a/controller/api/errors/error_handlers.py b/mipengine/controller/api/errors/error_handlers.py
similarity index 81%
rename from controller/api/errors/error_handlers.py
rename to mipengine/controller/api/errors/error_handlers.py
index f65bcc77..00e8da17 100644
--- a/controller/api/errors/error_handlers.py
+++ b/mipengine/controller/api/errors/error_handlers.py
@@ -1,6 +1,6 @@
 from quart import Blueprint
 
-from controller.api.errors.exceptions import BadRequest, BadUserInput
+from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
 
 error_handlers = Blueprint('error_handlers', __name__)
 
diff --git a/controller/api/errors/exceptions.py b/mipengine/controller/api/errors/exceptions.py
similarity index 100%
rename from controller/api/errors/exceptions.py
rename to mipengine/controller/api/errors/exceptions.py
diff --git a/controller/api/services/__init__.py b/mipengine/controller/api/services/__init__.py
similarity index 100%
rename from controller/api/services/__init__.py
rename to mipengine/controller/api/services/__init__.py
diff --git a/controller/api/services/run_algorithm.py b/mipengine/controller/api/services/run_algorithm.py
similarity index 62%
rename from controller/api/services/run_algorithm.py
rename to mipengine/controller/api/services/run_algorithm.py
index 11ff16e5..d8cabca9 100644
--- a/controller/api/services/run_algorithm.py
+++ b/mipengine/controller/api/services/run_algorithm.py
@@ -1,16 +1,16 @@
 import logging
 import traceback
 
-from controller.algorithms import Algorithms
-from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
-from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications
-from controller.api.errors.exceptions import BadRequest
-from controller.api.services.validate_algorithm_parameters import validate_algorithm_parameters
+from mipengine.controller.algorithms_specifications import AlgorithmsSpecifications
+from mipengine.controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications
+from mipengine.controller.api.errors.exceptions import BadRequest
+from mipengine.controller.api.services.validate_algorithm_parameters import validate_algorithm_parameters
 
 
 def run_algorithm(algorithm_name: str, request_body: str):
     # Check that algorithm exists
-    if str.lower(algorithm_name) not in Algorithms().available.keys():
+    if str.lower(algorithm_name) not in AlgorithmsSpecifications().enabled_algorithms.keys():
         raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
 
     # Validate algorithm body has proper format
diff --git a/controller/api/services/validate_algorithm_parameters.py b/mipengine/controller/api/services/validate_algorithm_parameters.py
similarity index 92%
rename from controller/api/services/validate_algorithm_parameters.py
rename to mipengine/controller/api/services/validate_algorithm_parameters.py
index 8cc32e7b..bb5662a1 100644
--- a/controller/api/services/validate_algorithm_parameters.py
+++ b/mipengine/controller/api/services/validate_algorithm_parameters.py
@@ -1,17 +1,17 @@
 from typing import Optional, Dict, Any, List
 
-from controller.algorithms import GenericParameter
-from controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
-from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, \
-    InputDataParameterDTO, CrossValidationParametersDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
+from mipengine.controller.algorithms_specifications import GenericParameterSpecification
+from mipengine.controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
+    InputDataSpecificationDTO, CrossValidationParametersDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
     INPUTDATA_DATASET_PARAMETER_NAME, \
     INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME
-from controller.api.errors.exceptions import BadRequest, BadUserInput
-from controller.common_data_elements import CommonDataElements, CommonDataElement
-from controller.worker_catalogue import WorkerCatalogue
+from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
+from mipengine.controller.common_data_elements import CommonDataElements, CommonDataElement
+from mipengine.controller.worker_catalogue import WorkerCatalogue
 
 
-def validate_algorithm_parameters(algorithm_specs: AlgorithmDTO,
+def validate_algorithm_parameters(algorithm_specs: AlgorithmSpecificationDTO,
                                   algorithm_request: AlgorithmRequestDTO):
     # Validate inputdata
     validate_inputdata(algorithm_specs.inputdata,
@@ -26,7 +26,7 @@ def validate_algorithm_parameters(algorithm_specs: AlgorithmDTO,
                                         algorithm_request.crossvalidation)
 
 
-def validate_inputdata(inputdata_specs: Dict[str, InputDataParameterDTO],
+def validate_inputdata(inputdata_specs: Dict[str, InputDataSpecificationDTO],
                        input_data: Dict[str, Any]):
     """
     Validates that the:
@@ -74,7 +74,7 @@ def validate_inputdata_filters(filters):
     pass
 
 
-def validate_inputdata_cdes(input_data_specs: Dict[str, InputDataParameterDTO],
+def validate_inputdata_cdes(input_data_specs: Dict[str, InputDataSpecificationDTO],
                             input_data: Dict[str, Any]):
     """
     Validates that the cdes input data (x,y) follow the specs provided
@@ -102,7 +102,7 @@ def validate_inputdata_cdes(input_data_specs: Dict[str, InputDataParameterDTO],
 
 def validate_inputdata_cdes_length(cde_parameter_name: str,
                                    cde_parameter_value: Any,
-                                   cde_parameter_specs: InputDataParameterDTO):
+                                   cde_parameter_specs: InputDataSpecificationDTO):
     """
     Validate that the cde inputdata has proper list length
     """
@@ -115,7 +115,7 @@ def validate_inputdata_cdes_length(cde_parameter_name: str,
 
 def validate_inputdata_cde_value(cde: str,
                                  cde_parameter_name: str,
-                                 cde_parameter_specs: InputDataParameterDTO,
+                                 cde_parameter_specs: InputDataSpecificationDTO,
                                  pathology: str):
     """
     Validation of a specific cde in a parameter for the following:
@@ -138,7 +138,7 @@ def validate_inputdata_cde_value(cde: str,
 def validate_inputdata_cde_types(cde: str,
                                  cde_metadata: CommonDataElement,
                                  cde_parameter_name: str,
-                                 cde_parameter_specs: InputDataParameterDTO):
+                                 cde_parameter_specs: InputDataSpecificationDTO):
     # Validate that the cde belongs in the allowed types
     if cde_metadata.sql_type not in cde_parameter_specs.types:
         # If "real" is allowed, "int" is allowed as well
@@ -152,7 +152,7 @@ def validate_inputdata_cde_types(cde: str,
 def validate_inputdata_cde_stattypes(cde: str,
                                      cde_metadata: CommonDataElement,
                                      cde_parameter_name: str,
-                                     cde_parameter_specs: InputDataParameterDTO):
+                                     cde_parameter_specs: InputDataSpecificationDTO):
     if cde_metadata.categorical and "nominal" not in cde_parameter_specs.stattypes:
         raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
                            f"should be categorical.")
@@ -165,14 +165,14 @@ def validate_inputdata_cde_stattypes(cde: str,
 def validate_inputdata_cde_enumerations(cde: str,
                                         cde_metadata: CommonDataElement,
                                         cde_parameter_name: str,
-                                        cde_parameter_specs: InputDataParameterDTO):
+                                        cde_parameter_specs: InputDataSpecificationDTO):
     if cde_parameter_specs.enumslen is not None and \
             cde_parameter_specs.enumslen != len(cde_metadata.enumerations):
         raise BadUserInput(f"The CDE '{cde}', of inputdata '{cde_parameter_name}', "
                            f"should have {cde_parameter_specs.enumslen} enumerations.")
 
 
-def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericParameter]],
+def validate_generic_parameters(parameters_specs: Optional[Dict[str, GenericParameterSpecification]],
                                 parameters: Optional[Dict[str, Any]]):
     """
     If the algorithm has generic parameters (parameters),
diff --git a/controller/api/views/__init__.py b/mipengine/controller/api/views/__init__.py
similarity index 100%
rename from controller/api/views/__init__.py
rename to mipengine/controller/api/views/__init__.py
diff --git a/controller/api/views/algorithms.py b/mipengine/controller/api/views/algorithms.py
similarity index 70%
rename from controller/api/views/algorithms.py
rename to mipengine/controller/api/views/algorithms.py
index a7dd074f..fe6cb2e3 100644
--- a/controller/api/views/algorithms.py
+++ b/mipengine/controller/api/views/algorithms.py
@@ -3,9 +3,9 @@ import traceback
 
 from quart import request, Blueprint
 
-from controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmDTO, AlgorithmSpecifications
-from controller.api.errors.exceptions import BadRequest, BadUserInput
-from controller.api.services.run_algorithm import run_algorithm
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, AlgorithmSpecifications
+from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
+from mipengine.controller.api.services.run_algorithm import run_algorithm
 
 algorithms = Blueprint('algorithms_endpoint', __name__)
 
@@ -14,7 +14,7 @@ algorithms = Blueprint('algorithms_endpoint', __name__)
 async def get_algorithms() -> str:
     algorithm_specifications = AlgorithmSpecifications().algorithms_list
 
-    return AlgorithmDTO.schema().dumps(algorithm_specifications, many=True)
+    return AlgorithmSpecificationDTO.schema().dumps(algorithm_specifications, many=True)
 
 
 @algorithms.route("/algorithms/<algorithm_name>", methods=['POST'])
diff --git a/controller/common_data_elements.py b/mipengine/controller/common_data_elements.py
similarity index 100%
rename from controller/common_data_elements.py
rename to mipengine/controller/common_data_elements.py
diff --git a/controller/config/__init__.py b/mipengine/controller/config/__init__.py
similarity index 100%
rename from controller/config/__init__.py
rename to mipengine/controller/config/__init__.py
diff --git a/controller/config/pathologies_metadata/dementia.json b/mipengine/controller/config/pathologies_metadata/dementia.json
similarity index 100%
rename from controller/config/pathologies_metadata/dementia.json
rename to mipengine/controller/config/pathologies_metadata/dementia.json
diff --git a/controller/config/pathologies_metadata/mentalhealth.json b/mipengine/controller/config/pathologies_metadata/mentalhealth.json
similarity index 100%
rename from controller/config/pathologies_metadata/mentalhealth.json
rename to mipengine/controller/config/pathologies_metadata/mentalhealth.json
diff --git a/controller/config/pathologies_metadata/tbi.json b/mipengine/controller/config/pathologies_metadata/tbi.json
similarity index 100%
rename from controller/config/pathologies_metadata/tbi.json
rename to mipengine/controller/config/pathologies_metadata/tbi.json
diff --git a/controller/config/worker_catalogue.json b/mipengine/controller/config/worker_catalogue.json
similarity index 100%
rename from controller/config/worker_catalogue.json
rename to mipengine/controller/config/worker_catalogue.json
diff --git a/controller/requirements.txt b/mipengine/controller/requirements.txt
similarity index 100%
rename from controller/requirements.txt
rename to mipengine/controller/requirements.txt
diff --git a/controller/utils.py b/mipengine/controller/utils.py
similarity index 100%
rename from controller/utils.py
rename to mipengine/controller/utils.py
diff --git a/controller/worker_catalogue.py b/mipengine/controller/worker_catalogue.py
similarity index 92%
rename from controller/worker_catalogue.py
rename to mipengine/controller/worker_catalogue.py
index 77428349..3fc38793 100644
--- a/controller/worker_catalogue.py
+++ b/mipengine/controller/worker_catalogue.py
@@ -5,8 +5,8 @@ from typing import Dict, List
 
 from dataclasses_json import dataclass_json
 
-from controller import config
-from controller.utils import Singleton
+from mipengine.controller import config
+from mipengine.controller.utils import Singleton
 
 
 @dataclass_json
diff --git a/worker/.gitignore b/mipengine/worker/.gitignore
similarity index 100%
rename from worker/.gitignore
rename to mipengine/worker/.gitignore
diff --git a/worker/tasks/merge_tables.py b/mipengine/worker/tasks/merge_tables.py
similarity index 100%
rename from worker/tasks/merge_tables.py
rename to mipengine/worker/tasks/merge_tables.py
diff --git a/worker/tasks/remote_tables.py b/mipengine/worker/tasks/remote_tables.py
similarity index 100%
rename from worker/tasks/remote_tables.py
rename to mipengine/worker/tasks/remote_tables.py
diff --git a/worker/tasks/tables.py b/mipengine/worker/tasks/tables.py
similarity index 100%
rename from worker/tasks/tables.py
rename to mipengine/worker/tasks/tables.py
diff --git a/worker/tasks/udfs.py b/mipengine/worker/tasks/udfs.py
similarity index 100%
rename from worker/tasks/udfs.py
rename to mipengine/worker/tasks/udfs.py
diff --git a/worker/tasks/views.py b/mipengine/worker/tasks/views.py
similarity index 100%
rename from worker/tasks/views.py
rename to mipengine/worker/tasks/views.py
diff --git a/worker/udf_generator/.gitignore b/mipengine/worker/udf_generator/.gitignore
similarity index 100%
rename from worker/udf_generator/.gitignore
rename to mipengine/worker/udf_generator/.gitignore
-- 
GitLab


From bb1e01c89416ce88450fd1b2e218e54dd878d3f6 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 10 Feb 2021 14:10:33 +0200
Subject: [PATCH 17/30] Added tests for GET /algorithms.

---
 mipengine/algorithms/{test.json => demo.json} |   6 +-
 .../api/DTOs/AlgorithmSpecificationsDTOs.py   |   8 +-
 .../controller/api/services/run_algorithm.py  |   4 +-
 .../services/validate_algorithm_parameters.py |   4 +-
 mipengine/controller/api/views/algorithms.py  |   5 +-
 mipengine/tests/__init__.py                   |   1 +
 mipengine/tests/controller/__init__.py        |   1 +
 mipengine/tests/controller/api/__init__.py    |   1 +
 .../controller/api/test_get_algorithms.py     | 180 ++++++++++++++++++
 9 files changed, 197 insertions(+), 13 deletions(-)
 rename mipengine/algorithms/{test.json => demo.json} (94%)
 create mode 100644 mipengine/tests/__init__.py
 create mode 100644 mipengine/tests/controller/__init__.py
 create mode 100644 mipengine/tests/controller/api/__init__.py
 create mode 100644 mipengine/tests/controller/api/test_get_algorithms.py

diff --git a/mipengine/algorithms/test.json b/mipengine/algorithms/demo.json
similarity index 94%
rename from mipengine/algorithms/test.json
rename to mipengine/algorithms/demo.json
index 85f13e79..c3031adf 100644
--- a/mipengine/algorithms/test.json
+++ b/mipengine/algorithms/demo.json
@@ -1,7 +1,7 @@
 {
-  "name": "test",
-  "desc": "This is a test algorithm.",
-  "label": "TEST",
+  "name": "demo",
+  "desc": "This is a demo algorithm.",
+  "label": "DEMO",
   "enabled": true,
   "inputdata": {
     "x": {
diff --git a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index c2e9819a..a5243b21 100644
--- a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -79,7 +79,7 @@ class GenericParameterSpecificationDTO(GenericParameterSpecification):
 
 @dataclass_json
 @dataclass
-class CrossValidationParametersDTO:
+class CrossValidationSpecificationsDTO:
     """
     CrossValidationDTO is a nested object, that contains
     all the information need to run crossvalidation on an algorithm.
@@ -102,7 +102,7 @@ class AlgorithmSpecificationDTO:
     label: str
     inputdata: Dict[str, InputDataSpecificationDTO]
     parameters: Optional[Dict[str, GenericParameterSpecification]] = None
-    crossvalidation: Optional[CrossValidationParametersDTO] = None
+    crossvalidation: Optional[CrossValidationSpecificationsDTO] = None
 
     def __init__(self, algorithm: AlgorithmSpecifications, crossvalidation: AlgorithmSpecifications):
         self.name = algorithm.name
@@ -129,7 +129,7 @@ class AlgorithmSpecificationDTO:
         # Adding the crossvalidation algorithm as a nested algorithm
         if (CROSSVALIDATION_ALGORITHM_NAME in algorithm.flags.keys()
                 and algorithm.flags[CROSSVALIDATION_ALGORITHM_NAME]):
-            self.crossvalidation = CrossValidationParametersDTO(
+            self.crossvalidation = CrossValidationSpecificationsDTO(
                 crossvalidation.desc,
                 crossvalidation.label,
                 crossvalidation.parameters,
@@ -141,7 +141,7 @@ class AlgorithmSpecificationsDTOs(metaclass=Singleton):
     algorithms_dict = Dict[str, AlgorithmSpecificationDTO]
 
     def __init__(self):
-        algorithms_specifications = AlgorithmsSpecifications
+        algorithms_specifications = AlgorithmsSpecifications()
         self.algorithms_list = [AlgorithmSpecificationDTO(algorithm, algorithms_specifications.crossvalidation)
                                 for algorithm in algorithms_specifications.enabled_algorithms.values()]
 
diff --git a/mipengine/controller/api/services/run_algorithm.py b/mipengine/controller/api/services/run_algorithm.py
index d8cabca9..2003063d 100644
--- a/mipengine/controller/api/services/run_algorithm.py
+++ b/mipengine/controller/api/services/run_algorithm.py
@@ -1,7 +1,7 @@
 import logging
 import traceback
 
-from mipengine.controller.algorithms_specifications import AlgorithmsSpecifications
+from mipengine.controller.algorithms_specifications import AlgorithmSpecifications
 from mipengine.controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
 from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications
 from mipengine.controller.api.errors.exceptions import BadRequest
@@ -10,7 +10,7 @@ from mipengine.controller.api.services.validate_algorithm_parameters import vali
 
 def run_algorithm(algorithm_name: str, request_body: str):
     # Check that algorithm exists
-    if str.lower(algorithm_name) not in AlgorithmsSpecifications().enabled_algorithms.keys():
+    if str.lower(algorithm_name) not in AlgorithmSpecifications().enabled_algorithms.keys():
         raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
 
     # Validate algorithm body has proper format
diff --git a/mipengine/controller/api/services/validate_algorithm_parameters.py b/mipengine/controller/api/services/validate_algorithm_parameters.py
index bb5662a1..22b62489 100644
--- a/mipengine/controller/api/services/validate_algorithm_parameters.py
+++ b/mipengine/controller/api/services/validate_algorithm_parameters.py
@@ -3,7 +3,7 @@ from typing import Optional, Dict, Any, List
 from mipengine.controller.algorithms_specifications import GenericParameterSpecification
 from mipengine.controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
 from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
-    InputDataSpecificationDTO, CrossValidationParametersDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
+    InputDataSpecificationDTO, CrossValidationSpecificationsDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
     INPUTDATA_DATASET_PARAMETER_NAME, \
     INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME
 from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
@@ -289,7 +289,7 @@ def validate_generic_parameter_inside_min_max(parameter_name: str,
                            f"should be lower than {parameter_max_value} .")
 
 
-def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationParametersDTO],
+def validate_crossvalidation_parameters(crossvalidation_specs: Optional[CrossValidationSpecificationsDTO],
                                         crossvalidation: Optional[Dict[str, Any]]):
     """
     If crossvalidation is enabled, it validates that the algorithm's
diff --git a/mipengine/controller/api/views/algorithms.py b/mipengine/controller/api/views/algorithms.py
index fe6cb2e3..ffc71c07 100644
--- a/mipengine/controller/api/views/algorithms.py
+++ b/mipengine/controller/api/views/algorithms.py
@@ -3,7 +3,8 @@ import traceback
 
 from quart import request, Blueprint
 
-from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, AlgorithmSpecifications
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
+    AlgorithmSpecificationsDTOs
 from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
 from mipengine.controller.api.services.run_algorithm import run_algorithm
 
@@ -12,7 +13,7 @@ algorithms = Blueprint('algorithms_endpoint', __name__)
 
 @algorithms.route("/algorithms")
 async def get_algorithms() -> str:
-    algorithm_specifications = AlgorithmSpecifications().algorithms_list
+    algorithm_specifications = AlgorithmSpecificationsDTOs().algorithms_list
 
     return AlgorithmSpecificationDTO.schema().dumps(algorithm_specifications, many=True)
 
diff --git a/mipengine/tests/__init__.py b/mipengine/tests/__init__.py
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/mipengine/tests/__init__.py
@@ -0,0 +1 @@
+
diff --git a/mipengine/tests/controller/__init__.py b/mipengine/tests/controller/__init__.py
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/mipengine/tests/controller/__init__.py
@@ -0,0 +1 @@
+
diff --git a/mipengine/tests/controller/api/__init__.py b/mipengine/tests/controller/api/__init__.py
new file mode 100644
index 00000000..0adee064
--- /dev/null
+++ b/mipengine/tests/controller/api/__init__.py
@@ -0,0 +1 @@
+mip_engine_url = "http://127.0.0.1:5000"
diff --git a/mipengine/tests/controller/api/test_get_algorithms.py b/mipengine/tests/controller/api/test_get_algorithms.py
new file mode 100644
index 00000000..0d6a5a27
--- /dev/null
+++ b/mipengine/tests/controller/api/test_get_algorithms.py
@@ -0,0 +1,180 @@
+import json
+import logging
+import unittest
+
+import requests
+
+from mipengine.tests.controller.api import mip_engine_url
+
+algorithms_url = mip_engine_url + "/algorithms"
+
+demo_algorithm_path = "../../../algorithms/demo.json"
+
+
+def test_get_algorithms():
+    logging.info("---------- TEST : Get algorithms")
+    request = requests.get(algorithms_url)
+    result = json.loads(request.text)
+    assert len(result) > 0
+
+
+def test_get_demo_algorithm():
+    logging.info("---------- TEST : Get demo algorithms")
+    request = requests.get(algorithms_url)
+    algorithms = json.loads(request.text)
+    found = False
+    for algorithm in algorithms:
+        if algorithm["name"] == "demo":
+            assert algorithm == json.loads(get_demo_algorithm())
+            found = True
+    assert found is True
+
+
+def get_demo_algorithm():
+    return '''
+    {
+        "name": "demo",
+        "crossvalidation":
+        {
+            "parameters":
+            {
+                "type":
+                {
+                    "multiple": false,
+                    "enums": ["k_fold", "leave_dataset_out"],
+                    "notblank": true,
+                    "min": null,
+                    "default": "k_fold",
+                    "label": "Type of cross-validation",
+                    "desc": "Type of cross-validation",
+                    "type": "text",
+                    "max": null
+                },
+                "nsplits":
+                {
+                    "multiple": false,
+                    "enums": null,
+                    "notblank": true,
+                    "min": 2,
+                    "default": 5,
+                    "label": "Number of splits",
+                    "desc": "Number of splits",
+                    "type": "int",
+                    "max": 20
+                },
+                "metrics":
+                {
+                    "multiple": true,
+                    "enums": ["precision", "recall", "auc", "roc", "confusion_matrix", "f1_score"],
+                    "notblank": true,
+                    "min": null,
+                    "default": null,
+                    "label": "Metrics",
+                    "desc": "Cross-validation metrics.",
+                    "type": "text",
+                    "max": null
+                }
+            },
+            "label": "Cross Validation",
+            "desc": "Module for performing cross validation on supervised learning models."
+        },
+        "inputdata":
+        {
+            "x":
+            {
+                "types": ["real", "int", "text"],
+                "stattypes": ["numerical", "nominal"],
+                "multiple": true,
+                "enumslen": null,
+                "notblank": true,
+                "label": "features",
+                "desc": "Features used in my algorithm."
+            },
+            "y":
+            {
+                "types": ["text", "int"],
+                "stattypes": ["nominal"],
+                "multiple": false,
+                "enumslen": 2,
+                "notblank": true,
+                "label": "target",
+                "desc": "Target variable for my algorithm."
+            },
+            "pathology":
+            {
+                "types": ["text"],
+                "stattypes": null,
+                "multiple": false,
+                "enumslen": null,
+                "notblank": true,
+                "label": "Pathology of the data.",
+                "desc": "The pathology that the algorithm will run on."
+            },
+            "dataset":
+            {
+                "types": ["text"],
+                "stattypes": null,
+                "multiple": true,
+                "enumslen": null,
+                "notblank": true,
+                "label": "Set of data to use.",
+                "desc": "The set of data to run the algorithm on."
+            },
+            "filter":
+            {
+                "types": ["jsonObject"],
+                "stattypes": null,
+                "multiple": false,
+                "enumslen": null,
+                "notblank": false,
+                "label": "Filter on the data.",
+                "desc": "Features used in my algorithm."
+            }
+        },
+        "parameters":
+        {
+            "my_enum_param":
+            {
+                "multiple": false,
+                "enums": ["a", "b", "c"],
+                "notblank": true,
+                "min": null,
+                "default": "a",
+                "label": "Some param",
+                "desc": "Example of parameter with enumerations.",
+                "type": "text",
+                "max": null
+            },
+            "my_int_param":
+            {
+                "multiple": false,
+                "enums": null,
+                "notblank": true,
+                "min": 2,
+                "default": 4,
+                "label": "Some param",
+                "desc": "Example of integer param.",
+                "type": "int",
+                "max": 4
+            },
+            "list_param":
+            {
+                "multiple": true,
+                "enums": null,
+                "notblank": false,
+                "min": 0,
+                "default": [0.8, 0.95],
+                "label": "Some param",
+                "desc": "Example of list of floats param.",
+                "type": "real",
+                "max": 1
+            }
+        },
+        "label": "DEMO",
+        "desc": "This is a demo algorithm."
+    }
+    '''
+
+
+if __name__ == "__main__":
+    unittest.main()
-- 
GitLab


From 2d5dcd7bcd56742f748592e4d97bfd3a2725fe2d Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 10 Feb 2021 14:21:04 +0200
Subject: [PATCH 18/30] Added tox.

---
 requirements.txt |  2 ++
 tox.ini          | 10 ++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 requirements.txt
 create mode 100644 tox.ini

diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..9cda381d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+pytest
+pytest-xdist
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 00000000..355201a1
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,10 @@
+[tox]
+skipsdist = True
+
+[testenv]
+basepython = python3.8
+deps = -rrequirements.txt
+
+[testenv:api]
+changedir = mipengine/tests/controller/api
+commands = python -m pytest -n 5
-- 
GitLab


From c8a386456de62f2fa82e79b0cb5580aba15bb7d3 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Wed, 10 Feb 2021 18:33:59 +0200
Subject: [PATCH 19/30] Added some tests for POST /algorithms and small
 beautifications.

---
 mipengine/algorithms/demo.json                |   2 +-
 ...xecutionDTOs.py => AlgorithmRequestDTO.py} |   0
 .../controller/api/services/run_algorithm.py  |  29 -----
 ...hm_parameters.py => validate_algorithm.py} |  32 ++++-
 mipengine/controller/api/views/algorithms.py  |  13 +-
 mipengine/tests/controller/api/__init__.py    |   2 +-
 .../api/test_algorithm_validation.py          | 121 ++++++++++++++++++
 .../controller/api/test_get_algorithms.py     |   8 +-
 requirements.txt                              |   3 +-
 9 files changed, 168 insertions(+), 42 deletions(-)
 rename mipengine/controller/api/DTOs/{AlgorithmExecutionDTOs.py => AlgorithmRequestDTO.py} (100%)
 delete mode 100644 mipengine/controller/api/services/run_algorithm.py
 rename mipengine/controller/api/services/{validate_algorithm_parameters.py => validate_algorithm.py} (91%)
 create mode 100644 mipengine/tests/controller/api/test_algorithm_validation.py

diff --git a/mipengine/algorithms/demo.json b/mipengine/algorithms/demo.json
index c3031adf..8d64cee0 100644
--- a/mipengine/algorithms/demo.json
+++ b/mipengine/algorithms/demo.json
@@ -29,7 +29,7 @@
       "stattypes": [
         "nominal"
       ],
-      "enumslen": 2,
+      "enumslen": 4,
       "notblank": true,
       "multiple": false
     }
diff --git a/mipengine/controller/api/DTOs/AlgorithmExecutionDTOs.py b/mipengine/controller/api/DTOs/AlgorithmRequestDTO.py
similarity index 100%
rename from mipengine/controller/api/DTOs/AlgorithmExecutionDTOs.py
rename to mipengine/controller/api/DTOs/AlgorithmRequestDTO.py
diff --git a/mipengine/controller/api/services/run_algorithm.py b/mipengine/controller/api/services/run_algorithm.py
deleted file mode 100644
index 2003063d..00000000
--- a/mipengine/controller/api/services/run_algorithm.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import logging
-import traceback
-
-from mipengine.controller.algorithms_specifications import AlgorithmSpecifications
-from mipengine.controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
-from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecifications
-from mipengine.controller.api.errors.exceptions import BadRequest
-from mipengine.controller.api.services.validate_algorithm_parameters import validate_algorithm_parameters
-
-
-def run_algorithm(algorithm_name: str, request_body: str):
-    # Check that algorithm exists
-    if str.lower(algorithm_name) not in AlgorithmSpecifications().enabled_algorithms.keys():
-        raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
-
-    # Validate algorithm body has proper format
-    try:
-        algorithm_request = AlgorithmRequestDTO.from_json(request_body)
-    except Exception:
-        logging.error(f"Could not parse the algorithm request body. "
-                      f"Exception: \n {traceback.format_exc()}")
-        raise BadRequest(f"The algorithm body does not have the proper format.")
-
-    # Get algorithm specification and validate the algorithm input
-    algorithm_specs = AlgorithmSpecifications().algorithms_dict[algorithm_name]
-    validate_algorithm_parameters(algorithm_specs, algorithm_request)
-
-    # TODO Trigger algorithm execution on the controller
-    return "Success!"
diff --git a/mipengine/controller/api/services/validate_algorithm_parameters.py b/mipengine/controller/api/services/validate_algorithm.py
similarity index 91%
rename from mipengine/controller/api/services/validate_algorithm_parameters.py
rename to mipengine/controller/api/services/validate_algorithm.py
index 22b62489..d600c0d6 100644
--- a/mipengine/controller/api/services/validate_algorithm_parameters.py
+++ b/mipengine/controller/api/services/validate_algorithm.py
@@ -1,16 +1,44 @@
+import logging
+import traceback
 from typing import Optional, Dict, Any, List
 
 from mipengine.controller.algorithms_specifications import GenericParameterSpecification
-from mipengine.controller.api.DTOs.AlgorithmExecutionDTOs import AlgorithmRequestDTO
+from mipengine.controller.api.DTOs.AlgorithmRequestDTO import AlgorithmRequestDTO
 from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
     InputDataSpecificationDTO, CrossValidationSpecificationsDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
     INPUTDATA_DATASET_PARAMETER_NAME, \
-    INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME
+    INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME, \
+    AlgorithmSpecificationsDTOs
 from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
 from mipengine.controller.common_data_elements import CommonDataElements, CommonDataElement
 from mipengine.controller.worker_catalogue import WorkerCatalogue
 
 
+def validate_algorithm(algorithm_name: str, request_body: str):
+    """
+    Validates the proper usage of the algorithm:
+    1) algorithm exists,
+    2) algorithm body has proper format and
+    3) algorithm input matches the algorithm specifications.
+    """
+
+    # Check that algorithm exists
+    if str.lower(algorithm_name) not in AlgorithmSpecificationsDTOs().algorithms_dict.keys():
+        raise BadRequest(f"Algorithm '{algorithm_name}' does not exist.")
+
+    # Validate algorithm body has proper format
+    try:
+        algorithm_request = AlgorithmRequestDTO.from_json(request_body)
+    except Exception:
+        logging.error(f"Could not parse the algorithm request body. "
+                      f"Exception: \n {traceback.format_exc()}")
+        raise BadRequest(f"The algorithm body does not have the proper format.")
+
+    # Get algorithm specification and validate the algorithm input
+    algorithm_specs = AlgorithmSpecificationsDTOs().algorithms_dict[algorithm_name]
+    validate_algorithm_parameters(algorithm_specs, algorithm_request)
+
+
 def validate_algorithm_parameters(algorithm_specs: AlgorithmSpecificationDTO,
                                   algorithm_request: AlgorithmRequestDTO):
     # Validate inputdata
diff --git a/mipengine/controller/api/views/algorithms.py b/mipengine/controller/api/views/algorithms.py
index ffc71c07..31d1c242 100644
--- a/mipengine/controller/api/views/algorithms.py
+++ b/mipengine/controller/api/views/algorithms.py
@@ -6,7 +6,7 @@ from quart import request, Blueprint
 from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
     AlgorithmSpecificationsDTOs
 from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
-from mipengine.controller.api.services.run_algorithm import run_algorithm
+from mipengine.controller.api.services.validate_algorithm import validate_algorithm
 
 algorithms = Blueprint('algorithms_endpoint', __name__)
 
@@ -25,12 +25,19 @@ async def post_algorithm(algorithm_name: str) -> str:
     request_body = await request.data
 
     try:
-        response = run_algorithm(algorithm_name, request_body)
+        validate_algorithm(algorithm_name, request_body)
     except (BadRequest, BadUserInput) as exc:
         raise exc
+    except:
+        logging.error(f"Unhandled exception: \n {traceback.format_exc()}")
+        raise BadRequest("Algorithm validation failed.")
+
+    try:
+        # Execute algorithm
+        pass
     except:
         logging.error(f"Unhandled exception: \n {traceback.format_exc()}")
         raise BadRequest("Something went wrong. "
                          "Please inform the system administrator or try again later.")
 
-    return response
+    return "Success!"
diff --git a/mipengine/tests/controller/api/__init__.py b/mipengine/tests/controller/api/__init__.py
index 0adee064..de5a718f 100644
--- a/mipengine/tests/controller/api/__init__.py
+++ b/mipengine/tests/controller/api/__init__.py
@@ -1 +1 @@
-mip_engine_url = "http://127.0.0.1:5000"
+algorithms_url = "http://127.0.0.1:5000/algorithms"
diff --git a/mipengine/tests/controller/api/test_algorithm_validation.py b/mipengine/tests/controller/api/test_algorithm_validation.py
new file mode 100644
index 00000000..d38fca2c
--- /dev/null
+++ b/mipengine/tests/controller/api/test_algorithm_validation.py
@@ -0,0 +1,121 @@
+import json
+import logging
+
+import requests
+
+from mipengine.tests.controller.api import algorithms_url
+
+demo_algorithm_path = "../../../algorithms/demo.json"
+
+
+def test_wrong_algorithm_name():
+    logging.info("---------- TEST : POST non existing algorithm")
+
+    request_url = algorithms_url + "/not_existing"
+
+    request = requests.post(request_url)
+
+    assert request.status_code == 400
+
+    assert request.text == "Algorithm 'not_existing' does not exist."
+
+
+def test_wrong_pathology():
+    logging.info("---------- TEST : POST non existing pathology")
+
+    request_url = algorithms_url + "/demo"
+    request_body = {
+        "inputdata": {
+            "pathology": "wrong",
+            "dataset": ["adni"],
+            "filter": {},
+            "x": ["lefthippocampus", "righthippocampus"],
+            "y": ["alzheimerbroadcategory"]
+        },
+        "parameters": {
+            "my_enum_param": "a",
+            "my_int_param": 3,
+            "list_param": [0.8, 0.95]
+        },
+        "crossvalidation": {
+            "type": "k_fold",
+            "nsplits": 10,
+            "metrics": ["precision", "confusion_matrix"]
+        }
+    }
+    headers = {"Content-type": "application/json", "Accept": "text/plain"}
+
+    request = requests.post(request_url, data=json.dumps(request_body), headers=headers)
+
+    assert request.status_code == 200
+
+    assert json.loads(request.text) == get_user_error_response("Pathology 'wrong' does not exist.")
+
+
+def test_wrong_dataset():
+    logging.info("---------- TEST : POST non existing dataset")
+
+    request_url = algorithms_url + "/demo"
+    request_body = {
+        "inputdata": {
+            "pathology": "dementia",
+            "dataset": ["wrong"],
+            "filter": {},
+            "x": ["lefthippocampus", "righthippocampus"],
+            "y": ["alzheimerbroadcategory"]
+        },
+        "parameters": {
+            "my_enum_param": "a",
+            "my_int_param": 3,
+            "list_param": [0.8, 0.95]
+        },
+        "crossvalidation": {
+            "type": "k_fold",
+            "nsplits": 10,
+            "metrics": ["precision", "confusion_matrix"]
+        }
+    }
+    headers = {"Content-type": "application/json", "Accept": "text/plain"}
+
+    request = requests.post(request_url, data=json.dumps(request_body), headers=headers)
+
+    assert request.status_code == 200
+
+    assert json.loads(request.text) == \
+           get_user_error_response("Datasets '['wrong']' do not belong in pathology 'dementia'.")
+
+
+def test_proper_algorithm():
+    logging.info("---------- TEST : POST proper algorithm")
+
+    request_url = algorithms_url + "/demo"
+    request_body = {
+        "inputdata": {
+            "pathology": "dementia",
+            "dataset": ["adni"],
+            "filter": {},
+            "x": ["lefthippocampus", "righthippocampus"],
+            "y": ["alzheimerbroadcategory"]
+        },
+        "parameters": {
+            "my_enum_param": "a",
+            "my_int_param": 3,
+            "list_param": [0.8, 0.95]
+        },
+        "crossvalidation": {
+            "type": "k_fold",
+            "nsplits": 10,
+            "metrics": ["precision", "confusion_matrix"]
+        }
+    }
+    headers = {"Content-type": "application/json", "Accept": "text/plain"}
+
+    request = requests.post(request_url, data=json.dumps(request_body), headers=headers)
+
+    assert request.status_code == 200
+
+    assert request.text == "Success!"
+
+
+def get_user_error_response(message: str):
+    return {"text/plain+user_error": message}
diff --git a/mipengine/tests/controller/api/test_get_algorithms.py b/mipengine/tests/controller/api/test_get_algorithms.py
index 0d6a5a27..1104fa03 100644
--- a/mipengine/tests/controller/api/test_get_algorithms.py
+++ b/mipengine/tests/controller/api/test_get_algorithms.py
@@ -4,9 +4,7 @@ import unittest
 
 import requests
 
-from mipengine.tests.controller.api import mip_engine_url
-
-algorithms_url = mip_engine_url + "/algorithms"
+from mipengine.tests.controller.api import algorithms_url
 
 demo_algorithm_path = "../../../algorithms/demo.json"
 
@@ -30,7 +28,7 @@ def test_get_demo_algorithm():
     assert found is True
 
 
-def get_demo_algorithm():
+def get_demo_algorithm() -> str:
     return '''
     {
         "name": "demo",
@@ -95,7 +93,7 @@ def get_demo_algorithm():
                 "types": ["text", "int"],
                 "stattypes": ["nominal"],
                 "multiple": false,
-                "enumslen": 2,
+                "enumslen": 4,
                 "notblank": true,
                 "label": "target",
                 "desc": "Target variable for my algorithm."
diff --git a/requirements.txt b/requirements.txt
index 9cda381d..0488cb0f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
-pytest
+pytest~=6.2.2
 pytest-xdist
+requests~=2.22.0
-- 
GitLab


From 7cdd067c7ebc8030420dd7d8e7286b95f5b385a3 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Thu, 11 Feb 2021 11:31:40 +0200
Subject: [PATCH 20/30] Split requirements in different folders.

---
 requirements.txt => requirements/tests.txt | 0
 tox.ini                                    | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename requirements.txt => requirements/tests.txt (100%)

diff --git a/requirements.txt b/requirements/tests.txt
similarity index 100%
rename from requirements.txt
rename to requirements/tests.txt
diff --git a/tox.ini b/tox.ini
index 355201a1..611ae6be 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@ skipsdist = True
 
 [testenv]
 basepython = python3.8
-deps = -rrequirements.txt
+deps = -r requirements/tests.txt
 
 [testenv:api]
 changedir = mipengine/tests/controller/api
-- 
GitLab


From a31be18b95a9450ab8e380361726e91ae031077c Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Thu, 11 Feb 2021 11:51:56 +0200
Subject: [PATCH 21/30] Controller API packages restructure.

---
 .../controller/api/DTOs/AlgorithmSpecificationsDTOs.py      | 2 +-
 mipengine/controller/api/services/validate_algorithm.py     | 6 +++---
 mipengine/controller/{config => common}/__init__.py         | 0
 .../controller/{ => common}/algorithms_specifications.py    | 0
 mipengine/controller/{ => common}/common_data_elements.py   | 2 +-
 mipengine/controller/{ => common}/worker_catalogue.py       | 4 ++--
 mipengine/controller/resources/__init__.py                  | 0
 .../pathologies_metadata/dementia.json                      | 0
 .../pathologies_metadata/mentalhealth.json                  | 0
 .../{config => resources}/pathologies_metadata/tbi.json     | 0
 .../controller/{config => resources}/worker_catalogue.json  | 0
 .../requirements.txt => requirements/controller.txt         | 0
 12 files changed, 7 insertions(+), 7 deletions(-)
 rename mipengine/controller/{config => common}/__init__.py (100%)
 rename mipengine/controller/{ => common}/algorithms_specifications.py (100%)
 rename mipengine/controller/{ => common}/common_data_elements.py (97%)
 rename mipengine/controller/{ => common}/worker_catalogue.py (89%)
 create mode 100644 mipengine/controller/resources/__init__.py
 rename mipengine/controller/{config => resources}/pathologies_metadata/dementia.json (100%)
 rename mipengine/controller/{config => resources}/pathologies_metadata/mentalhealth.json (100%)
 rename mipengine/controller/{config => resources}/pathologies_metadata/tbi.json (100%)
 rename mipengine/controller/{config => resources}/worker_catalogue.json (100%)
 rename mipengine/controller/requirements.txt => requirements/controller.txt (100%)

diff --git a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index a5243b21..450ff72e 100644
--- a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -3,7 +3,7 @@ from typing import List, Optional, Dict
 
 from dataclasses_json import dataclass_json
 
-from mipengine.controller.algorithms_specifications import CROSSVALIDATION_ALGORITHM_NAME, \
+from mipengine.controller.common.algorithms_specifications import CROSSVALIDATION_ALGORITHM_NAME, \
     GenericParameterSpecification, AlgorithmSpecifications, AlgorithmsSpecifications
 from mipengine.controller.utils import Singleton
 
diff --git a/mipengine/controller/api/services/validate_algorithm.py b/mipengine/controller/api/services/validate_algorithm.py
index d600c0d6..25c0da9c 100644
--- a/mipengine/controller/api/services/validate_algorithm.py
+++ b/mipengine/controller/api/services/validate_algorithm.py
@@ -2,7 +2,7 @@ import logging
 import traceback
 from typing import Optional, Dict, Any, List
 
-from mipengine.controller.algorithms_specifications import GenericParameterSpecification
+from mipengine.controller.common.algorithms_specifications import GenericParameterSpecification
 from mipengine.controller.api.DTOs.AlgorithmRequestDTO import AlgorithmRequestDTO
 from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
     InputDataSpecificationDTO, CrossValidationSpecificationsDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
@@ -10,8 +10,8 @@ from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmS
     INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME, \
     AlgorithmSpecificationsDTOs
 from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
-from mipengine.controller.common_data_elements import CommonDataElements, CommonDataElement
-from mipengine.controller.worker_catalogue import WorkerCatalogue
+from mipengine.controller.common.common_data_elements import CommonDataElements, CommonDataElement
+from mipengine.controller.common.worker_catalogue import WorkerCatalogue
 
 
 def validate_algorithm(algorithm_name: str, request_body: str):
diff --git a/mipengine/controller/config/__init__.py b/mipengine/controller/common/__init__.py
similarity index 100%
rename from mipengine/controller/config/__init__.py
rename to mipengine/controller/common/__init__.py
diff --git a/mipengine/controller/algorithms_specifications.py b/mipengine/controller/common/algorithms_specifications.py
similarity index 100%
rename from mipengine/controller/algorithms_specifications.py
rename to mipengine/controller/common/algorithms_specifications.py
diff --git a/mipengine/controller/common_data_elements.py b/mipengine/controller/common/common_data_elements.py
similarity index 97%
rename from mipengine/controller/common_data_elements.py
rename to mipengine/controller/common/common_data_elements.py
index 4ad66e8f..49b3c965 100644
--- a/mipengine/controller/common_data_elements.py
+++ b/mipengine/controller/common/common_data_elements.py
@@ -6,7 +6,7 @@ from typing import List, Optional, Set, Dict
 from dataclasses_json import dataclass_json
 
 # TODO How can we read the pathologies' metadata  files without relative paths?
-RELATIVE_METADATA_PATH = "../config/pathologies_metadata"
+RELATIVE_METADATA_PATH = "../resources/pathologies_metadata"
 
 
 @dataclass_json
diff --git a/mipengine/controller/worker_catalogue.py b/mipengine/controller/common/worker_catalogue.py
similarity index 89%
rename from mipengine/controller/worker_catalogue.py
rename to mipengine/controller/common/worker_catalogue.py
index 3fc38793..51eb58da 100644
--- a/mipengine/controller/worker_catalogue.py
+++ b/mipengine/controller/common/worker_catalogue.py
@@ -5,7 +5,7 @@ from typing import Dict, List
 
 from dataclasses_json import dataclass_json
 
-from mipengine.controller import config
+from mipengine.controller import resources
 from mipengine.controller.utils import Singleton
 
 
@@ -24,7 +24,7 @@ class WorkerCatalogue(metaclass=Singleton):
     pathologies: Dict[str, List[str]]
 
     def __init__(self):
-        worker_catalogue_str = pkg_resources.read_text(config, 'worker_catalogue.json')
+        worker_catalogue_str = pkg_resources.read_text(resources, 'worker_catalogue.json')
         workers_dict: Dict[str, Worker] = json.loads(worker_catalogue_str)
         self.workers = {worker_name: Worker.from_dict(worker_values)
                         for worker_name, worker_values in workers_dict.items()}
diff --git a/mipengine/controller/resources/__init__.py b/mipengine/controller/resources/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/mipengine/controller/config/pathologies_metadata/dementia.json b/mipengine/controller/resources/pathologies_metadata/dementia.json
similarity index 100%
rename from mipengine/controller/config/pathologies_metadata/dementia.json
rename to mipengine/controller/resources/pathologies_metadata/dementia.json
diff --git a/mipengine/controller/config/pathologies_metadata/mentalhealth.json b/mipengine/controller/resources/pathologies_metadata/mentalhealth.json
similarity index 100%
rename from mipengine/controller/config/pathologies_metadata/mentalhealth.json
rename to mipengine/controller/resources/pathologies_metadata/mentalhealth.json
diff --git a/mipengine/controller/config/pathologies_metadata/tbi.json b/mipengine/controller/resources/pathologies_metadata/tbi.json
similarity index 100%
rename from mipengine/controller/config/pathologies_metadata/tbi.json
rename to mipengine/controller/resources/pathologies_metadata/tbi.json
diff --git a/mipengine/controller/config/worker_catalogue.json b/mipengine/controller/resources/worker_catalogue.json
similarity index 100%
rename from mipengine/controller/config/worker_catalogue.json
rename to mipengine/controller/resources/worker_catalogue.json
diff --git a/mipengine/controller/requirements.txt b/requirements/controller.txt
similarity index 100%
rename from mipengine/controller/requirements.txt
rename to requirements/controller.txt
-- 
GitLab


From 682b73c942a10f788e19be13cf227cddf8015268 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Thu, 11 Feb 2021 11:53:57 +0200
Subject: [PATCH 22/30] Added Kostas as worker CODEOWNER.

---
 CODEOWNERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CODEOWNERS b/CODEOWNERS
index 7bfbda52..39fd710f 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -7,5 +7,5 @@
 /mipengine/controller/ @apmariglis @ThanKarab
 
 # Worker service
-/mipengine/worker/ @apmariglis @ThanKarab
+/mipengine/worker/ @KFilippopolitis @ThanKarab
 /mipengine/worker/udf_generator/ @jassak
-- 
GitLab


From ae5da6b1403e18f4cdeb7f3e5fc211b3e8040553 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Thu, 11 Feb 2021 13:20:04 +0200
Subject: [PATCH 23/30] Renamed worker to node.

---
 CODEOWNERS                                    |  6 +--
 .../design_docs/WorkerServiceAPISpec.yml      | 38 +++++++--------
 .../{worker/.gitignore => common/__init__.py} |  0
 mipengine/common/node_catalogue.py            | 45 ++++++++++++++++++
 .../api/DTOs/AlgorithmSpecificationsDTOs.py   |  2 +-
 .../api/services/validate_algorithm.py        |  8 ++--
 .../common/algorithms_specifications.py       |  2 +-
 mipengine/controller/{ => common}/utils.py    |  0
 .../controller/common/worker_catalogue.py     | 40 ----------------
 .../resources/worker_catalogue.json           | 36 ---------------
 .../{worker/udf_generator => node}/.gitignore |  0
 .../{worker => node}/tasks/merge_tables.py    |  0
 .../{worker => node}/tasks/remote_tables.py   |  0
 mipengine/{worker => node}/tasks/tables.py    |  0
 mipengine/{worker => node}/tasks/udfs.py      |  0
 mipengine/{worker => node}/tasks/views.py     |  0
 mipengine/node/udf_generator/.gitignore       |  0
 mipengine/resources/__init__.py               |  0
 mipengine/resources/node_catalogue.json       | 46 +++++++++++++++++++
 19 files changed, 119 insertions(+), 104 deletions(-)
 rename mipengine/{worker/.gitignore => common/__init__.py} (100%)
 create mode 100644 mipengine/common/node_catalogue.py
 rename mipengine/controller/{ => common}/utils.py (100%)
 delete mode 100644 mipengine/controller/common/worker_catalogue.py
 delete mode 100644 mipengine/controller/resources/worker_catalogue.json
 rename mipengine/{worker/udf_generator => node}/.gitignore (100%)
 rename mipengine/{worker => node}/tasks/merge_tables.py (100%)
 rename mipengine/{worker => node}/tasks/remote_tables.py (100%)
 rename mipengine/{worker => node}/tasks/tables.py (100%)
 rename mipengine/{worker => node}/tasks/udfs.py (100%)
 rename mipengine/{worker => node}/tasks/views.py (100%)
 create mode 100644 mipengine/node/udf_generator/.gitignore
 create mode 100644 mipengine/resources/__init__.py
 create mode 100644 mipengine/resources/node_catalogue.json

diff --git a/CODEOWNERS b/CODEOWNERS
index 39fd710f..f9c7731d 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -6,6 +6,6 @@
 # Controller service
 /mipengine/controller/ @apmariglis @ThanKarab
 
-# Worker service
-/mipengine/worker/ @KFilippopolitis @ThanKarab
-/mipengine/worker/udf_generator/ @jassak
+# Node service
+/mipengine/node/ @KFilippopolitis @ThanKarab
+/mipengine/node/udf_generator/ @jassak
diff --git a/documentation/design_docs/WorkerServiceAPISpec.yml b/documentation/design_docs/WorkerServiceAPISpec.yml
index f409b677..a80a0d0e 100644
--- a/documentation/design_docs/WorkerServiceAPISpec.yml
+++ b/documentation/design_docs/WorkerServiceAPISpec.yml
@@ -15,10 +15,10 @@ info:
 paths:
   /tables:
     get:
-      summary: Returns a list of all local non-private tables of the worker. Returns a list of tuples [name,shema]
+      summary: Returns a list of all local non-private tables of the node. Returns a list of tuples [name,shema]
       responses:
         '200':
-          description: A list of tuples [name,shema] for all non-private tables in the worker database
+          description: A list of tuples [name,shema] for all non-private tables in the node database
           content:
             application/json:
               schema:
@@ -29,9 +29,9 @@ paths:
                 example1:
                   $ref: '#/components/examples/TableInfoArray'
         '204':
-          description: The worker successfully processed the request, and is not returning any content. There aren't any non-private local tables on the worker's database
+          description: The node successfully processed the request, and is not returning any content. There aren't any non-private local tables on the node's database
     post:
-      summary: Creates a new table. The client only provides the schema, the worker will decide the name of the table and will return it in the response
+      summary: Creates a new table. The client only provides the schema, the node will decide the name of the table and will return it in the response
       requestBody:
         description: Create a table.
         content:
@@ -102,10 +102,10 @@ paths:
 
   /views:
     get:
-      summary: Returns a list of all view tables of the worker. Returns list of tuples [name,shema]
+      summary: Returns a list of all view tables of the node. Returns list of tuples [name,shema]
       responses:
         '200':
-          description: List of tuples [name,shema] for all views in the worker database
+          description: List of tuples [name,shema] for all views in the node database
           content:
             application/json:
               schema:
@@ -116,10 +116,10 @@ paths:
                 example1:
                   $ref: '#/components/examples/ViewInfoArray'
         '204':
-          description: The worker successfully processed the request, and is not returning any content. There aren't any view tables on the worker's database
+          description: The node successfully processed the request, and is not returning any content. There aren't any view tables on the node's database
     post:
       summary: Creates a new view
-      description: Creates a new view. The client only provides a TableView (datasets,columns,filters), the worker will decide the name of the table and return it on the response
+      description: Creates a new view. The client only provides a TableView (datasets,columns,filters), the node will decide the name of the table and return it on the response
       requestBody:
         description: Creates a new view
         content:
@@ -191,10 +191,10 @@ paths:
 
   /remoteTables:
     get:
-      summary: Returns a list of all the remote tables of the worker. Returns list of tuples [name,shema]
+      summary: Returns a list of all the remote tables of the node. Returns list of tuples [name,shema]
       responses:
         '200':
-          description: List of tuples [name,shema] for all remote tables in the worker database
+          description: List of tuples [name,shema] for all remote tables in the node database
           content:
             application/json:
               schema:
@@ -205,9 +205,9 @@ paths:
                 example1:
                   $ref: '#/components/examples/TableInfoArray'
         '204':
-          description: The worker successfully processed the request, and is not returning any content. There aren't any remote tables in the worker's database
+          description: The node successfully processed the request, and is not returning any content. There aren't any remote tables in the node's database
     post:
-      summary: Creates a remote table. (instead of providing the url of the worker's db,workers can be aliased and resolved by a dns type of service.for now the url will provided for simplicity)
+      summary: Creates a remote table. (instead of providing the url of the node's db,workers can be aliased and resolved by a dns type of service.for now the url will provided for simplicity)
       requestBody:
         required: true
         description: Creates a remote table
@@ -277,10 +277,10 @@ paths:
 
   /mergeTables:
     get:
-      summary: Returns a list of all the merge tables of the worker. Returns list of tuples [name,shema]
+      summary: Returns a list of all the merge tables of the node. Returns list of tuples [name,shema]
       responses:
         '200':
-          description: List of tuples [name,shema] for all remote tables in the worker database
+          description: List of tuples [name,shema] for all remote tables in the node database
           content:
             application/json:
               schema:
@@ -291,12 +291,12 @@ paths:
                 example1:
                   $ref: '#/components/examples/TableInfoArray'
         '204':
-          description: The worker successfully processed the request, and is not returning any content. There aren't any merge tables in the worker's database
+          description: The node successfully processed the request, and is not returning any content. There aren't any merge tables in the node's database
     post:
       summary: Creates a marge table.
       requestBody:
         required: true
-        description: Creates a merge table. The name of the table will be decided by the worker and returned in the response
+        description: Creates a merge table. The name of the table will be decided by the node and returned in the response
         content:
           application/json:
             schema:
@@ -389,10 +389,10 @@ paths:
 
   /udfs:
     get:
-      summary: Returns a list of all the User Defined Functions availiable to the worker. Returns list of tuples [name,udfHeader]
+      summary: Returns a list of all the User Defined Functions availiable to the node. Returns list of tuples [name,udfHeader]
       responses:
         '200':
-          description: List of tuples [name,shema] for all non-private tables in the worker database
+          description: List of tuples [name,shema] for all non-private tables in the node database
           content:
             application/json:
               schema:
@@ -403,7 +403,7 @@ paths:
                 example1:
                   $ref: '#/components/examples/UDFInfoArray'
         '204':
-          description: The worker successfully processed the request, and is not returning any content. There aren't any UDFs defined on the worker's database
+          description: The node successfully processed the request, and is not returning any content. There aren't any UDFs defined on the node's database
     post:
       summary: executes the udf, returns the name of the table containing the result
       requestBody:
diff --git a/mipengine/worker/.gitignore b/mipengine/common/__init__.py
similarity index 100%
rename from mipengine/worker/.gitignore
rename to mipengine/common/__init__.py
diff --git a/mipengine/common/node_catalogue.py b/mipengine/common/node_catalogue.py
new file mode 100644
index 00000000..81c178d9
--- /dev/null
+++ b/mipengine/common/node_catalogue.py
@@ -0,0 +1,45 @@
+import importlib.resources as pkg_resources
+import json
+from dataclasses import dataclass
+from typing import Dict, List, Any
+
+from dataclasses_json import dataclass_json
+
+from mipengine import resources
+from mipengine.controller.common.utils import Singleton
+
+
+@dataclass_json
+@dataclass
+class Node:
+    nodeId: str
+    rabbitmqURL: str
+    monetdbURL: str
+    data: Dict[str, List[str]]
+
+
+@dataclass_json
+@dataclass
+class NodeCatalogue(metaclass=Singleton):
+    global_node: Node
+    local_nodes: Dict[str, Node]
+    data: Dict[str, List[str]]
+
+    def __init__(self):
+        node_catalogue_str = pkg_resources.read_text(resources, 'node_catalogue.json')
+        node_catalogue: Dict[str, Any] = json.loads(node_catalogue_str)
+        print(node_catalogue)
+        self.global_node = node_catalogue["globalNode"]
+        self.local_nodes = {(Node.from_dict(local_node)).nodeId: Node.from_dict(local_node)
+                            for local_node in node_catalogue["localNodes"]}
+
+        self.data = {}
+        for local_node in self.local_nodes.values():
+            for pathology_name, datasets in local_node.data.items():
+                if pathology_name not in self.data.keys():
+                    self.data[pathology_name] = datasets
+                else:
+                    self.data[pathology_name].extend(datasets)
+
+
+NodeCatalogue()
diff --git a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index 450ff72e..c6031543 100644
--- a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -5,7 +5,7 @@ from dataclasses_json import dataclass_json
 
 from mipengine.controller.common.algorithms_specifications import CROSSVALIDATION_ALGORITHM_NAME, \
     GenericParameterSpecification, AlgorithmSpecifications, AlgorithmsSpecifications
-from mipengine.controller.utils import Singleton
+from mipengine.controller.common.utils import Singleton
 
 INPUTDATA_PATHOLOGY_PARAMETER_NAME = "pathology"
 INPUTDATA_DATASET_PARAMETER_NAME = "dataset"
diff --git a/mipengine/controller/api/services/validate_algorithm.py b/mipengine/controller/api/services/validate_algorithm.py
index 25c0da9c..b30e730d 100644
--- a/mipengine/controller/api/services/validate_algorithm.py
+++ b/mipengine/controller/api/services/validate_algorithm.py
@@ -11,7 +11,7 @@ from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmS
     AlgorithmSpecificationsDTOs
 from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
 from mipengine.controller.common.common_data_elements import CommonDataElements, CommonDataElement
-from mipengine.controller.common.worker_catalogue import WorkerCatalogue
+from mipengine.common.node_catalogue import NodeCatalogue
 
 
 def validate_algorithm(algorithm_name: str, request_body: str):
@@ -82,14 +82,14 @@ def validate_inputdata_pathology_and_dataset_values(pathology: str,
     that the datasets belong in the pathology.
     """
 
-    worker_catalogue = WorkerCatalogue()
-    if pathology not in worker_catalogue.pathologies.keys():
+    node_catalogue = NodeCatalogue()
+    if pathology not in node_catalogue.data.keys():
         raise BadUserInput(f"Pathology '{pathology}' does not exist.")
 
     if type(datasets) is not list:
         raise BadRequest(f"Datasets parameter should be a list.")
 
-    if not all(dataset in worker_catalogue.pathologies[pathology] for dataset in datasets):
+    if not all(dataset in node_catalogue.data[pathology] for dataset in datasets):
         raise BadUserInput(f"Datasets '{datasets}' do not belong in pathology '{pathology}'.")
 
 
diff --git a/mipengine/controller/common/algorithms_specifications.py b/mipengine/controller/common/algorithms_specifications.py
index 12b1bd39..1864f5e3 100644
--- a/mipengine/controller/common/algorithms_specifications.py
+++ b/mipengine/controller/common/algorithms_specifications.py
@@ -6,7 +6,7 @@ from typing import List, Dict, Optional, Any
 
 from dataclasses_json import dataclass_json
 
-from mipengine.controller.utils import Singleton
+from mipengine.controller.common.utils import Singleton
 
 # TODO How can we read all algorithm.json files without relative paths?
 RELATIVE_ALGORITHMS_PATH = "../../algorithms"
diff --git a/mipengine/controller/utils.py b/mipengine/controller/common/utils.py
similarity index 100%
rename from mipengine/controller/utils.py
rename to mipengine/controller/common/utils.py
diff --git a/mipengine/controller/common/worker_catalogue.py b/mipengine/controller/common/worker_catalogue.py
deleted file mode 100644
index 51eb58da..00000000
--- a/mipengine/controller/common/worker_catalogue.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import importlib.resources as pkg_resources
-import json
-from dataclasses import dataclass
-from typing import Dict, List
-
-from dataclasses_json import dataclass_json
-
-from mipengine.controller import resources
-from mipengine.controller.utils import Singleton
-
-
-@dataclass_json
-@dataclass
-class Worker:
-    ip: str
-    port: int
-    data: Dict[str, List[str]]
-
-
-@dataclass_json
-@dataclass
-class WorkerCatalogue(metaclass=Singleton):
-    workers: Dict[str, Worker]
-    pathologies: Dict[str, List[str]]
-
-    def __init__(self):
-        worker_catalogue_str = pkg_resources.read_text(resources, 'worker_catalogue.json')
-        workers_dict: Dict[str, Worker] = json.loads(worker_catalogue_str)
-        self.workers = {worker_name: Worker.from_dict(worker_values)
-                        for worker_name, worker_values in workers_dict.items()}
-        self.pathologies = {}
-        for worker in self.workers.values():
-            for pathology_name, datasets in worker.data.items():
-                if pathology_name not in self.pathologies.keys():
-                    self.pathologies[pathology_name] = datasets
-                else:
-                    self.pathologies[pathology_name].extend(datasets)
-
-
-WorkerCatalogue()
diff --git a/mipengine/controller/resources/worker_catalogue.json b/mipengine/controller/resources/worker_catalogue.json
deleted file mode 100644
index 978f3341..00000000
--- a/mipengine/controller/resources/worker_catalogue.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-  "worker1": {
-    "ip": "127.0.0.1",
-    "port": 5672,
-    "data": {
-      "dementia": [
-        "adni"
-      ]
-    }
-  },
-  "worker2": {
-    "ip": "127.0.0.1",
-    "port": 5673,
-    "data": {
-      "mentalhealth": [
-        "mentalhealth_demo"
-      ],
-      "tbi": [
-        "tbi_demo2"
-      ]
-    }
-  },
-  "worker3": {
-    "ip": "127.0.0.1",
-    "port": 5674,
-    "data": {
-      "tbi": [
-        "demo1"
-      ],
-      "dementia_longitudinal": [
-        "fake_longitudinal",
-        "alzheimer_fake_cohort"
-      ]
-    }
-  }
-}
\ No newline at end of file
diff --git a/mipengine/worker/udf_generator/.gitignore b/mipengine/node/.gitignore
similarity index 100%
rename from mipengine/worker/udf_generator/.gitignore
rename to mipengine/node/.gitignore
diff --git a/mipengine/worker/tasks/merge_tables.py b/mipengine/node/tasks/merge_tables.py
similarity index 100%
rename from mipengine/worker/tasks/merge_tables.py
rename to mipengine/node/tasks/merge_tables.py
diff --git a/mipengine/worker/tasks/remote_tables.py b/mipengine/node/tasks/remote_tables.py
similarity index 100%
rename from mipengine/worker/tasks/remote_tables.py
rename to mipengine/node/tasks/remote_tables.py
diff --git a/mipengine/worker/tasks/tables.py b/mipengine/node/tasks/tables.py
similarity index 100%
rename from mipengine/worker/tasks/tables.py
rename to mipengine/node/tasks/tables.py
diff --git a/mipengine/worker/tasks/udfs.py b/mipengine/node/tasks/udfs.py
similarity index 100%
rename from mipengine/worker/tasks/udfs.py
rename to mipengine/node/tasks/udfs.py
diff --git a/mipengine/worker/tasks/views.py b/mipengine/node/tasks/views.py
similarity index 100%
rename from mipengine/worker/tasks/views.py
rename to mipengine/node/tasks/views.py
diff --git a/mipengine/node/udf_generator/.gitignore b/mipengine/node/udf_generator/.gitignore
new file mode 100644
index 00000000..e69de29b
diff --git a/mipengine/resources/__init__.py b/mipengine/resources/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/mipengine/resources/node_catalogue.json b/mipengine/resources/node_catalogue.json
new file mode 100644
index 00000000..a81af466
--- /dev/null
+++ b/mipengine/resources/node_catalogue.json
@@ -0,0 +1,46 @@
+{
+  "globalNode": {
+    "nodeId": "global",
+    "rabbitmqURL": "127.0.0.1:5672",
+    "monetdbURL": "127.0.0.1:50000"
+  },
+  "localNodes": [
+    {
+      "nodeId": "local_node_1",
+      "rabbitmqURL": "127.0.0.1:5672",
+      "monetdbURL": "127.0.0.1:50000",
+      "data": {
+        "dementia": [
+          "adni"
+        ]
+      }
+    },
+    {
+      "nodeId": "local_node_2",
+      "rabbitmqURL": "127.0.0.1:5672",
+      "monetdbURL": "127.0.0.1:50000",
+      "data": {
+        "mentalhealth": [
+          "mentalhealth_demo"
+        ],
+        "tbi": [
+          "tbi_demo2"
+        ]
+      }
+    },
+    {
+      "nodeId": "local_node_3",
+      "rabbitmqURL": "127.0.0.1:5672",
+      "monetdbURL": "127.0.0.1:50000",
+      "data": {
+        "tbi": [
+          "demo1"
+        ],
+        "dementia_longitudinal": [
+          "fake_longitudinal",
+          "alzheimer_fake_cohort"
+        ]
+      }
+    }
+  ]
+}
\ No newline at end of file
-- 
GitLab


From 769985051e284d2840463003722d19b2c6c56597 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Thu, 11 Feb 2021 13:48:10 +0200
Subject: [PATCH 24/30] Added README for the controller and minor path
 refactoring.

---
 README.md                                     | 35 ++++++++++++++++++-
 mipengine/common/node_catalogue.py            |  1 -
 .../common/algorithms_specifications.py       |  2 +-
 .../controller/common/common_data_elements.py |  3 +-
 tox.ini                                       |  2 +-
 5 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index ce480a5d..0fd3d935 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,34 @@
-# MIP-Engine
\ No newline at end of file
+# MIP-Engine
+
+## Installation
+1. Install python <br/>
+```
+sudo apt install python3.8
+
+sudo apt install python3-pip
+```
+
+### Controller API
+1. Install requirements. <br/>
+```
+python3.8 -m pip install -r ./requirements/controller.txt 
+```
+
+2. Run the controller API. <br/>
+```
+export QUART_APP=mipengine/controller/api/app:app; python3.8 -m quart run
+```
+
+
+## Tests
+
+1. Install requirements <br/>
+```
+sudo apt install python3.8
+sudo apt install tox
+```
+
+2. Run the tests <br/>
+```
+tox
+```
\ No newline at end of file
diff --git a/mipengine/common/node_catalogue.py b/mipengine/common/node_catalogue.py
index 81c178d9..967d996d 100644
--- a/mipengine/common/node_catalogue.py
+++ b/mipengine/common/node_catalogue.py
@@ -28,7 +28,6 @@ class NodeCatalogue(metaclass=Singleton):
     def __init__(self):
         node_catalogue_str = pkg_resources.read_text(resources, 'node_catalogue.json')
         node_catalogue: Dict[str, Any] = json.loads(node_catalogue_str)
-        print(node_catalogue)
         self.global_node = node_catalogue["globalNode"]
         self.local_nodes = {(Node.from_dict(local_node)).nodeId: Node.from_dict(local_node)
                             for local_node in node_catalogue["localNodes"]}
diff --git a/mipengine/controller/common/algorithms_specifications.py b/mipengine/controller/common/algorithms_specifications.py
index 1864f5e3..d7cb7458 100644
--- a/mipengine/controller/common/algorithms_specifications.py
+++ b/mipengine/controller/common/algorithms_specifications.py
@@ -9,7 +9,7 @@ from dataclasses_json import dataclass_json
 from mipengine.controller.common.utils import Singleton
 
 # TODO How can we read all algorithm.json files without relative paths?
-RELATIVE_ALGORITHMS_PATH = "../../algorithms"
+RELATIVE_ALGORITHMS_PATH = "./mipengine/algorithms"
 CROSSVALIDATION_ALGORITHM_NAME = "crossvalidation"
 
 
diff --git a/mipengine/controller/common/common_data_elements.py b/mipengine/controller/common/common_data_elements.py
index 49b3c965..fba77cf9 100644
--- a/mipengine/controller/common/common_data_elements.py
+++ b/mipengine/controller/common/common_data_elements.py
@@ -6,7 +6,7 @@ from typing import List, Optional, Set, Dict
 from dataclasses_json import dataclass_json
 
 # TODO How can we read the pathologies' metadata  files without relative paths?
-RELATIVE_METADATA_PATH = "../resources/pathologies_metadata"
+RELATIVE_METADATA_PATH = "./mipengine/controller/resources/pathologies_metadata"
 
 
 @dataclass_json
@@ -69,7 +69,6 @@ class CommonDataElements:
                 group_elements.update(iterate_metadata_groups(sub_group))
             return group_elements
 
-        print(os.getcwd())
         pathology_metadata_files = [os.path.join(RELATIVE_METADATA_PATH, json_file)
                                     for json_file in os.listdir(RELATIVE_METADATA_PATH)
                                     if json_file.endswith('.json')]
diff --git a/tox.ini b/tox.ini
index 611ae6be..d693e513 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@ skipsdist = True
 
 [testenv]
 basepython = python3.8
-deps = -r requirements/tests.txt
+deps = -rrequirements/tests.txt
 
 [testenv:api]
 changedir = mipengine/tests/controller/api
-- 
GitLab


From 28cf2274d6ef97d37638947e42d5cc1426cf546c Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 12 Feb 2021 13:39:51 +0200
Subject: [PATCH 25/30] Restructured the mip_engine_interface document.

---
 .../design_docs/MIP_Engine_Interface.yml      | 475 +++++++++---------
 1 file changed, 249 insertions(+), 226 deletions(-)

diff --git a/documentation/design_docs/MIP_Engine_Interface.yml b/documentation/design_docs/MIP_Engine_Interface.yml
index 0dfc8e67..1f001ed4 100644
--- a/documentation/design_docs/MIP_Engine_Interface.yml
+++ b/documentation/design_docs/MIP_Engine_Interface.yml
@@ -55,116 +55,8 @@ components:
   schemas:
     Algorithm:
       description: All the details and properties that specify an algorithm.
-      example: {
-        "name": "ALGORITHMNAME",
-        "desc": "This is an example algorithm.",
-        "label": "My Algorithm",
-        "inputdata": {
-          "pathology": {
-            "label": "Pathology of the data.",
-            "desc": "The pathology that the algorithm will run on.",
-            "types": [ "text" ],
-            "notblank": true,
-            "multiple": false
-          },
-          "dataset": {
-            "label": "Set of data to use.",
-            "desc": "The set of data to run the algorithm on.",
-            "types": [ "text" ],
-            "notblank": true,
-            "multiple": true
-          },
-          "filter": {
-            "label": "Filter on the data.",
-            "desc": "Features used in my algorithm.",
-            "types": [ "json" ],
-            "notblank": false,
-            "multiple": false
-          },
-          "x": {
-            "label": "features",
-            "desc": "Features used in my algorithm.",
-            "types": [ "int", "real", "text" ],
-            "stattypes": [ "numerical", "nomimal" ],
-            "notblank": true,
-            "multiple": true
-          },
-          "y": {
-            "label": "target",
-            "desc": "Target variable for my algorithm.",
-            "types": [ "text", "int" ],
-            "stattypes": [ "nominal" ],
-            "enumslen": 2,
-            "notblank": true,
-            "multiple": false
-          }
-        },
-        "parameters": {
-          "my_enum_param": {
-            "label": "Some param",
-            "desc": "Example of parameter with enumerations.",
-            "type": "text",
-            "enums": [ "a", "b", "c" ],
-            "default": "a",
-            "notblank": true,
-            "multiple": false
-          },
-          "my_int_param": {
-            "label": "Some param",
-            "desc": "Example of integer param.",
-            "type": "int",
-            "default": 4,
-            "min": 2,
-            "max": 4,
-            "notblank": true,
-            "multiple": false
-          },
-          "list_param": {
-            "label": "Some param",
-            "desc": "Example of list of floats param.",
-            "type": "real",
-            "default": [ 0.8, 0.95 ],
-            "min": 0.0,
-            "max": 1.0,
-            "notblank": false,
-            "multiple": true
-          }
-        },
-        "crossvalidation": {
-          "desc": "Module for performing cross validation on supervised learning models.",
-          "label": "Cross Validation",
-          "parameters": {
-            "type": {
-              "label": "Type of cross-validation",
-              "desc": "Type of cross-validation",
-              "type": "text",
-              "enums": [ "k_fold", "leave_dataset_out" ],
-              "default": "k_fold",
-              "notblank": true,
-              "multiple": false
-            },
-            "nsplits": {
-              "label": "Number of splits",
-              "desc": "Number of splits",
-              "type": "int",
-              "min": 2,
-              "max": 20,
-              "default": 5,
-              "notblank": true,
-              "multiple": false
-            },
-            "metrics": {
-              "label": "Metrics",
-              "desc": "Cross-validation metrics.",
-              "type": "text",
-              "enums": [ "precision", "recall", "auc", "roc", "confusion_matrix", "f1_score" ],
-              "default": null,
-              "notblank": true,
-              "multiple": true
-            }
-          }
-        }
-      }
+      example:
+        $ref: '#/components/examples/Algorithm'
       type: object
       required:
         - name
@@ -197,46 +89,8 @@ components:
 
     AlgorithmInputData:
       description: Input parameters describing the data used to fit a statistical/ML model.
-      example: {
-        "pathology": {
-          "label": "Pathology of the data.",
-          "desc": "The pathology that the algorithm will run on.",
-          "types": [ "text" ],
-          "notblank": true,
-          "multiple": false
-        },
-        "dataset": {
-          "label": "Set of data to use.",
-          "desc": "The set of data to run the algorithm on.",
-          "types": [ "text" ],
-          "notblank": true,
-          "multiple": true
-        },
-        "filter": {
-          "label": "Filter on the data.",
-          "desc": "Features used in my algorithm.",
-          "types": [ "jsonObject" ],
-          "notblank": false,
-          "multiple": false
-        },
-        "x": {
-          "label": "features",
-          "desc": "Features used in my algorithm.",
-          "types": [ "int", "real", "text" ],
-          "stattypes": [ "numerical", "nomimal" ],
-          "notblank": true,
-          "multiple": true
-        },
-        "y": {
-          "label": "target",
-          "desc": "Target variable for my algorithm.",
-          "types": [ "text", "int" ],
-          "stattypes": [ "nominal" ],
-          "enumslen": 2,
-          "notblank": true,
-          "multiple": false
-        }
-      }
+      example:
+        $ref: '#/components/examples/AlgorithmInputData'
       type: object
       additionalProperties:
         type: object
@@ -276,38 +130,8 @@ components:
 
     AlgorithmParameters:
       description: Algorithm parameters controlling the fitting process.
-      example: {
-        "my_enum_param": {
-          "label": "Some param",
-          "desc": "Example of parameter with enumerations.",
-          "type": "text",
-          "inputtype": "dropdown",
-          "enums": [ "a", "b", "c" ],
-          "default": "a",
-          "notblank": true,
-          "multiple": false
-        },
-        "my_int_param": {
-          "label": "Some param",
-          "desc": "Example of integer param.",
-          "type": "int",
-          "default": 4,
-          "min": 2,
-          "max": 4,
-          "notblank": true,
-          "multiple": false
-        },
-        "list_param": {
-          "label": "Some param",
-          "desc": "Example of list of floats param.",
-          "type": "real",
-          "default": [ 0.8, 0.95 ],
-          "min": 0.0,
-          "max": 1.0,
-          "notblank": true,
-          "multiple": true
-        }
-      }
+      example: 
+        $ref: '#/components/examples/AlgorithmParameters'
       type: object
       additionalProperties:
         type: object
@@ -348,25 +172,8 @@ components:
 
     AlgorithmRequestBody:
       description: The request body of the call to run an algorithm.
-      example: {
-        "inputdata": {
-          "pathology": "dementia",
-          "dataset": [ "adni", "ppmi" ],
-          "filter": { },
-          "x": [ "lefthippocampus", "righthippocampus" ],
-          "y": [ "alzheimerbroadcategory" ]
-        },
-        "parameters": {
-          "my_enum_param": "a",
-          "my_int_param": 3,
-          "list_param": [ 0.8, 0.95 ]
-        },
-        "crossvalidation": {
-          "type": "k_fold",
-          "nsplits": 10,
-          "metrics": [ "precision","confusion_matrix" ]
-        }
-      }
+      example: 
+        $ref: '#/components/examples/AlgorithmRequestBody'
       type: object
       required:
         - inputdata
@@ -424,34 +231,250 @@ components:
 
     AlgorithmResult:
       description: The result of an algorithm execution. A dictionairy of the available visualization types, containing a list of the different visualizations. Possible MIMETypes here https://redmine.hbpmip.link/issues/186
-      example: {
-        "application/json": [
-          {
-            "single":
-              {
-                "num_datapoints": 45
+      example: 
+        $ref: '#/components/examples/AlgorithmResult'
+      type: object
+      additionalProperties:
+        type: array
+        items:
+          type: object
 
+  examples:
+    Algorithm:
+      value:
+        {
+            "name": "ALGORITHMNAME",
+            "desc": "This is an example algorithm.",
+            "label": "My Algorithm",
+            "inputdata": {
+              "pathology": {
+                "label": "Pathology of the data.",
+                "desc": "The pathology that the algorithm will run on.",
+                "types": [ "text" ],
+                "notblank": true,
+                "multiple": false
+              },
+              "dataset": {
+                "label": "Set of data to use.",
+                "desc": "The set of data to run the algorithm on.",
+                "types": [ "text" ],
+                "notblank": true,
+                "multiple": true
+              },
+              "filter": {
+                "label": "Filter on the data.",
+                "desc": "Features used in my algorithm.",
+                "types": [ "json" ],
+                "notblank": false,
+                "multiple": false
+              },
+              "x": {
+                "label": "features",
+                "desc": "Features used in my algorithm.",
+                "types": [ "int", "real", "text" ],
+                "stattypes": [ "numerical", "nomimal" ],
+                "notblank": true,
+                "multiple": true
+              },
+              "y": {
+                "label": "target",
+                "desc": "Target variable for my algorithm.",
+                "types": [ "text", "int" ],
+                "stattypes": [ "nominal" ],
+                "enumslen": 2,
+                "notblank": true,
+                "multiple": false
               }
-          },
-          {
-            "double":
-              {
-                "num_datapoints": 437
-
+            },
+            "parameters": {
+              "my_enum_param": {
+                "label": "Some param",
+                "desc": "Example of parameter with enumerations.",
+                "type": "text",
+                "enums": [ "a", "b", "c" ],
+                "default": "a",
+                "notblank": true,
+                "multiple": false
+              },
+              "my_int_param": {
+                "label": "Some param",
+                "desc": "Example of integer param.",
+                "type": "int",
+                "default": 4,
+                "min": 2,
+                "max": 4,
+                "notblank": true,
+                "multiple": false
+              },
+              "list_param": {
+                "label": "Some param",
+                "desc": "Example of list of floats param.",
+                "type": "real",
+                "default": [ 0.8, 0.95 ],
+                "min": 0.0,
+                "max": 1.0,
+                "notblank": false,
+                "multiple": true
+              }
+            },
+            "crossvalidation": {
+              "desc": "Module for performing cross validation on supervised learning models.",
+              "label": "Cross Validation",
+              "parameters": {
+                "type": {
+                  "label": "Type of cross-validation",
+                  "desc": "Type of cross-validation",
+                  "type": "text",
+                  "enums": [ "k_fold", "leave_dataset_out" ],
+                  "default": "k_fold",
+                  "notblank": true,
+                  "multiple": false
+                },
+                "nsplits": {
+                  "label": "Number of splits",
+                  "desc": "Number of splits",
+                  "type": "int",
+                  "min": 2,
+                  "max": 20,
+                  "default": 5,
+                  "notblank": true,
+                  "multiple": false
+                },
+                "metrics": {
+                  "label": "Metrics",
+                  "desc": "Cross-validation metrics.",
+                  "type": "text",
+                  "enums": [ "precision", "recall", "auc", "roc", "confusion_matrix", "f1_score" ],
+                  "default": null,
+                  "notblank": true,
+                  "multiple": true
+                }
               }
+            }
           }
-        ],
-        "application/vnd.highcharts+json": [
-          {
-            "visualization": "amazing visulizaiton"
+    AlgorithmInputData:
+      value:
+        {
+          "pathology": {
+            "label": "Pathology of the data.",
+            "desc": "The pathology that the algorithm will run on.",
+            "types": [ "text" ],
+            "notblank": true,
+            "multiple": false
+          },
+          "dataset": {
+            "label": "Set of data to use.",
+            "desc": "The set of data to run the algorithm on.",
+            "types": [ "text" ],
+            "notblank": true,
+            "multiple": true
           },
-          {
-            "visualization2": "amazing visulizaiton2"
+          "filter": {
+            "label": "Filter on the data.",
+            "desc": "Features used in my algorithm.",
+            "types": [ "jsonObject" ],
+            "notblank": false,
+            "multiple": false
+          },
+          "x": {
+            "label": "features",
+            "desc": "Features used in my algorithm.",
+            "types": [ "int", "real", "text" ],
+            "stattypes": [ "numerical", "nomimal" ],
+            "notblank": true,
+            "multiple": true
+          },
+          "y": {
+            "label": "target",
+            "desc": "Target variable for my algorithm.",
+            "types": [ "text", "int" ],
+            "stattypes": [ "nominal" ],
+            "enumslen": 2,
+            "notblank": true,
+            "multiple": false
           }
-        ]
-      }
-      type: object
-      additionalProperties:
-        type: array
-        items:
-          type: object
\ No newline at end of file
+        }
+    AlgorithmParameters:
+      value:
+        {
+          "my_enum_param": {
+            "label": "Some param",
+            "desc": "Example of parameter with enumerations.",
+            "type": "text",
+            "inputtype": "dropdown",
+            "enums": [ "a", "b", "c" ],
+            "default": "a",
+            "notblank": true,
+            "multiple": false
+          },
+          "my_int_param": {
+            "label": "Some param",
+            "desc": "Example of integer param.",
+            "type": "int",
+            "default": 4,
+            "min": 2,
+            "max": 4,
+            "notblank": true,
+            "multiple": false
+          },
+          "list_param": {
+            "label": "Some param",
+            "desc": "Example of list of floats param.",
+            "type": "real",
+            "default": [ 0.8, 0.95 ],
+            "min": 0.0,
+            "max": 1.0,
+            "notblank": true,
+            "multiple": true
+          }
+        }
+    AlgorithmRequestBody:
+      value:
+        {
+          "inputdata": {
+            "pathology": "dementia",
+            "dataset": [ "adni", "ppmi" ],
+            "filter": { },
+            "x": [ "lefthippocampus", "righthippocampus" ],
+            "y": [ "alzheimerbroadcategory" ]
+          },
+          "parameters": {
+            "my_enum_param": "a",
+            "my_int_param": 3,
+            "list_param": [ 0.8, 0.95 ]
+          },
+          "crossvalidation": {
+            "type": "k_fold",
+            "nsplits": 10,
+            "metrics": [ "precision","confusion_matrix" ]
+          }
+        }
+    AlgorithmResult:
+      value:
+        {
+          "application/json": [
+            {
+              "single":
+                {
+                  "num_datapoints": 45
+  
+                }
+            },
+            {
+              "double":
+                {
+                  "num_datapoints": 437
+  
+                }
+            }
+          ],
+          "application/vnd.highcharts+json": [
+            {
+              "visualization": "amazing visulizaiton"
+            },
+            {
+              "visualization2": "amazing visulizaiton2"
+            }
+          ]
+        }
+        
\ No newline at end of file
-- 
GitLab


From cc250d60403d882659cb1d6aa3963cdcbcbdae5c Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 12 Feb 2021 14:03:18 +0200
Subject: [PATCH 26/30] Imports restructured to one per line.

---
 mipengine/common/node_catalogue.py            |  8 +++--
 .../api/DTOs/AlgorithmRequestDTO.py           |  4 ++-
 .../api/DTOs/AlgorithmSpecificationsDTOs.py   | 10 +++++--
 .../controller/api/errors/error_handlers.py   |  3 +-
 .../api/services/validate_algorithm.py        | 29 ++++++++++++-------
 mipengine/controller/api/views/algorithms.py  | 10 ++++---
 .../common/algorithms_specifications.py       |  5 +++-
 .../controller/common/common_data_elements.py |  8 +++--
 mipengine/node/tasks/merge_tables.py          |  6 ++--
 mipengine/node/tasks/remote_tables.py         |  7 +++--
 mipengine/node/tasks/tables.py                |  4 +--
 mipengine/node/tasks/udfs.py                  |  3 +-
 mipengine/node/tasks/views.py                 |  7 +++--
 13 files changed, 66 insertions(+), 38 deletions(-)

diff --git a/mipengine/common/node_catalogue.py b/mipengine/common/node_catalogue.py
index 967d996d..5a1d84ca 100644
--- a/mipengine/common/node_catalogue.py
+++ b/mipengine/common/node_catalogue.py
@@ -1,7 +1,9 @@
 import importlib.resources as pkg_resources
 import json
 from dataclasses import dataclass
-from typing import Dict, List, Any
+from typing import Any
+from typing import Dict
+from typing import List
 
 from dataclasses_json import dataclass_json
 
@@ -26,8 +28,8 @@ class NodeCatalogue(metaclass=Singleton):
     data: Dict[str, List[str]]
 
     def __init__(self):
-        node_catalogue_str = pkg_resources.read_text(resources, 'node_catalogue.json')
-        node_catalogue: Dict[str, Any] = json.loads(node_catalogue_str)
+        node_catalogue_content = pkg_resources.read_text(resources, 'node_catalogue.json')
+        node_catalogue: Dict[str, Any] = json.loads(node_catalogue_content)
         self.global_node = node_catalogue["globalNode"]
         self.local_nodes = {(Node.from_dict(local_node)).nodeId: Node.from_dict(local_node)
                             for local_node in node_catalogue["localNodes"]}
diff --git a/mipengine/controller/api/DTOs/AlgorithmRequestDTO.py b/mipengine/controller/api/DTOs/AlgorithmRequestDTO.py
index d31b11c6..5d35ee8b 100644
--- a/mipengine/controller/api/DTOs/AlgorithmRequestDTO.py
+++ b/mipengine/controller/api/DTOs/AlgorithmRequestDTO.py
@@ -1,5 +1,7 @@
 from dataclasses import dataclass
-from typing import Dict, Any, Optional
+from typing import Any
+from typing import Dict
+from typing import Optional
 
 from dataclasses_json import dataclass_json
 
diff --git a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index c6031543..2833a70c 100644
--- a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -1,10 +1,14 @@
 from dataclasses import dataclass
-from typing import List, Optional, Dict
+from typing import Dict
+from typing import List
+from typing import Optional
 
 from dataclasses_json import dataclass_json
 
-from mipengine.controller.common.algorithms_specifications import CROSSVALIDATION_ALGORITHM_NAME, \
-    GenericParameterSpecification, AlgorithmSpecifications, AlgorithmsSpecifications
+from mipengine.controller.common.algorithms_specifications import AlgorithmSpecifications
+from mipengine.controller.common.algorithms_specifications import AlgorithmsSpecifications
+from mipengine.controller.common.algorithms_specifications import CROSSVALIDATION_ALGORITHM_NAME
+from mipengine.controller.common.algorithms_specifications import GenericParameterSpecification
 from mipengine.controller.common.utils import Singleton
 
 INPUTDATA_PATHOLOGY_PARAMETER_NAME = "pathology"
diff --git a/mipengine/controller/api/errors/error_handlers.py b/mipengine/controller/api/errors/error_handlers.py
index 00e8da17..efa70efa 100644
--- a/mipengine/controller/api/errors/error_handlers.py
+++ b/mipengine/controller/api/errors/error_handlers.py
@@ -1,6 +1,7 @@
 from quart import Blueprint
 
-from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
+from mipengine.controller.api.errors.exceptions import BadRequest
+from mipengine.controller.api.errors.exceptions import BadUserInput
 
 error_handlers = Blueprint('error_handlers', __name__)
 
diff --git a/mipengine/controller/api/services/validate_algorithm.py b/mipengine/controller/api/services/validate_algorithm.py
index b30e730d..9b0d9f46 100644
--- a/mipengine/controller/api/services/validate_algorithm.py
+++ b/mipengine/controller/api/services/validate_algorithm.py
@@ -1,17 +1,26 @@
 import logging
 import traceback
-from typing import Optional, Dict, Any, List
+from typing import Any
+from typing import Dict
+from typing import List
+from typing import Optional
 
-from mipengine.controller.common.algorithms_specifications import GenericParameterSpecification
-from mipengine.controller.api.DTOs.AlgorithmRequestDTO import AlgorithmRequestDTO
-from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
-    InputDataSpecificationDTO, CrossValidationSpecificationsDTO, INPUTDATA_PATHOLOGY_PARAMETER_NAME, \
-    INPUTDATA_DATASET_PARAMETER_NAME, \
-    INPUTDATA_FILTERS_PARAMETER_NAME, INPUTDATA_X_PARAMETER_NAME, INPUTDATA_Y_PARAMETER_NAME, \
-    AlgorithmSpecificationsDTOs
-from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
-from mipengine.controller.common.common_data_elements import CommonDataElements, CommonDataElement
 from mipengine.common.node_catalogue import NodeCatalogue
+from mipengine.controller.api.DTOs.AlgorithmRequestDTO import AlgorithmRequestDTO
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationsDTOs
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import CrossValidationSpecificationsDTO
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import INPUTDATA_DATASET_PARAMETER_NAME
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import INPUTDATA_FILTERS_PARAMETER_NAME
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import INPUTDATA_PATHOLOGY_PARAMETER_NAME
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import INPUTDATA_X_PARAMETER_NAME
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import INPUTDATA_Y_PARAMETER_NAME
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import InputDataSpecificationDTO
+from mipengine.controller.api.errors.exceptions import BadRequest
+from mipengine.controller.api.errors.exceptions import BadUserInput
+from mipengine.controller.common.algorithms_specifications import GenericParameterSpecification
+from mipengine.controller.common.common_data_elements import CommonDataElement
+from mipengine.controller.common.common_data_elements import CommonDataElements
 
 
 def validate_algorithm(algorithm_name: str, request_body: str):
diff --git a/mipengine/controller/api/views/algorithms.py b/mipengine/controller/api/views/algorithms.py
index 31d1c242..edd98792 100644
--- a/mipengine/controller/api/views/algorithms.py
+++ b/mipengine/controller/api/views/algorithms.py
@@ -1,11 +1,13 @@
 import logging
 import traceback
 
-from quart import request, Blueprint
+from quart import Blueprint
+from quart import request
 
-from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO, \
-    AlgorithmSpecificationsDTOs
-from mipengine.controller.api.errors.exceptions import BadRequest, BadUserInput
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationDTO
+from mipengine.controller.api.DTOs.AlgorithmSpecificationsDTOs import AlgorithmSpecificationsDTOs
+from mipengine.controller.api.errors.exceptions import BadRequest
+from mipengine.controller.api.errors.exceptions import BadUserInput
 from mipengine.controller.api.services.validate_algorithm import validate_algorithm
 
 algorithms = Blueprint('algorithms_endpoint', __name__)
diff --git a/mipengine/controller/common/algorithms_specifications.py b/mipengine/controller/common/algorithms_specifications.py
index d7cb7458..f28c7395 100644
--- a/mipengine/controller/common/algorithms_specifications.py
+++ b/mipengine/controller/common/algorithms_specifications.py
@@ -2,7 +2,10 @@ import logging
 import os
 import typing
 from dataclasses import dataclass
-from typing import List, Dict, Optional, Any
+from typing import Any
+from typing import Dict
+from typing import List
+from typing import Optional
 
 from dataclasses_json import dataclass_json
 
diff --git a/mipengine/controller/common/common_data_elements.py b/mipengine/controller/common/common_data_elements.py
index fba77cf9..6ee91fec 100644
--- a/mipengine/controller/common/common_data_elements.py
+++ b/mipengine/controller/common/common_data_elements.py
@@ -1,7 +1,11 @@
 import logging
 import os
-from dataclasses import dataclass, field
-from typing import List, Optional, Set, Dict
+from dataclasses import dataclass
+from dataclasses import field
+from typing import Dict
+from typing import List
+from typing import Optional
+from typing import Set
 
 from dataclasses_json import dataclass_json
 
diff --git a/mipengine/node/tasks/merge_tables.py b/mipengine/node/tasks/merge_tables.py
index d1379a65..dc298c9c 100644
--- a/mipengine/node/tasks/merge_tables.py
+++ b/mipengine/node/tasks/merge_tables.py
@@ -1,8 +1,8 @@
-from typing import Tuple, List
+from typing import List
 
 from celery import shared_task
-
-from tasks.tables import TableInfo, TableData
+from tasks.tables import TableData
+from tasks.tables import TableInfo
 
 
 @shared_task
diff --git a/mipengine/node/tasks/remote_tables.py b/mipengine/node/tasks/remote_tables.py
index 5c116088..1fc9292b 100644
--- a/mipengine/node/tasks/remote_tables.py
+++ b/mipengine/node/tasks/remote_tables.py
@@ -1,7 +1,8 @@
-from typing import Tuple, List
-from celery import shared_task
+from typing import List
 
-from tasks.tables import TableInfo, TableData
+from celery import shared_task
+from tasks.tables import TableData
+from tasks.tables import TableInfo
 
 
 @shared_task
diff --git a/mipengine/node/tasks/tables.py b/mipengine/node/tasks/tables.py
index b0d2299b..47a1f0e7 100644
--- a/mipengine/node/tasks/tables.py
+++ b/mipengine/node/tasks/tables.py
@@ -1,6 +1,6 @@
 from enum import Enum
-
-from typing import List, Union
+from typing import List
+from typing import Union
 
 from celery import shared_task
 
diff --git a/mipengine/node/tasks/udfs.py b/mipengine/node/tasks/udfs.py
index 6de11c6f..a4f0839c 100644
--- a/mipengine/node/tasks/udfs.py
+++ b/mipengine/node/tasks/udfs.py
@@ -1,7 +1,6 @@
-from typing import Tuple, List
+from typing import List
 
 from celery import shared_task
-
 from tasks.tables import TableInfo
 
 
diff --git a/mipengine/node/tasks/views.py b/mipengine/node/tasks/views.py
index 2cea642b..01f52ba6 100644
--- a/mipengine/node/tasks/views.py
+++ b/mipengine/node/tasks/views.py
@@ -1,8 +1,9 @@
-from typing import Tuple, List
+from typing import List
 
 from celery import shared_task
-
-from tasks.tables import TableView, TableData, TableInfo
+from tasks.tables import TableData
+from tasks.tables import TableInfo
+from tasks.tables import TableView
 
 
 @shared_task
-- 
GitLab


From 83652e12a54c9bb789effc58ba2029861225081e Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 12 Feb 2021 14:30:59 +0200
Subject: [PATCH 27/30] Fixed relative paths in algorithms and metadata.

---
 mipengine/algorithms/__init__.py                      |  0
 .../controller/common/algorithms_specifications.py    | 10 ++++------
 mipengine/controller/common/common_data_elements.py   | 11 ++++-------
 .../resources/pathologies_metadata/__init__.py        |  0
 4 files changed, 8 insertions(+), 13 deletions(-)
 create mode 100644 mipengine/algorithms/__init__.py
 create mode 100644 mipengine/controller/resources/pathologies_metadata/__init__.py

diff --git a/mipengine/algorithms/__init__.py b/mipengine/algorithms/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/mipengine/controller/common/algorithms_specifications.py b/mipengine/controller/common/algorithms_specifications.py
index f28c7395..4f930dae 100644
--- a/mipengine/controller/common/algorithms_specifications.py
+++ b/mipengine/controller/common/algorithms_specifications.py
@@ -2,6 +2,7 @@ import logging
 import os
 import typing
 from dataclasses import dataclass
+from pathlib import Path
 from typing import Any
 from typing import Dict
 from typing import List
@@ -9,10 +10,9 @@ from typing import Optional
 
 from dataclasses_json import dataclass_json
 
+from mipengine import algorithms
 from mipengine.controller.common.utils import Singleton
 
-# TODO How can we read all algorithm.json files without relative paths?
-RELATIVE_ALGORITHMS_PATH = "./mipengine/algorithms"
 CROSSVALIDATION_ALGORITHM_NAME = "crossvalidation"
 
 
@@ -73,12 +73,10 @@ class AlgorithmsSpecifications(metaclass=Singleton):
     enabled_algorithms: Dict[str, AlgorithmSpecifications]
 
     def __init__(self):
-        algorithm_property_paths = [os.path.join(RELATIVE_ALGORITHMS_PATH, json_file)
-                                    for json_file in os.listdir(RELATIVE_ALGORITHMS_PATH)
-                                    if json_file.endswith('.json')]
+        algorithms_path = Path(algorithms.__file__).parent
 
         all_algorithms = {}
-        for algorithm_property_path in algorithm_property_paths:
+        for algorithm_property_path in algorithms_path.glob('*.json'):
             try:
                 algorithm = AlgorithmSpecifications.from_json(open(algorithm_property_path).read())
             except Exception as e:
diff --git a/mipengine/controller/common/common_data_elements.py b/mipengine/controller/common/common_data_elements.py
index 6ee91fec..83e34e41 100644
--- a/mipengine/controller/common/common_data_elements.py
+++ b/mipengine/controller/common/common_data_elements.py
@@ -2,15 +2,14 @@ import logging
 import os
 from dataclasses import dataclass
 from dataclasses import field
+from pathlib import Path
 from typing import Dict
 from typing import List
 from typing import Optional
 from typing import Set
 
 from dataclasses_json import dataclass_json
-
-# TODO How can we read the pathologies' metadata  files without relative paths?
-RELATIVE_METADATA_PATH = "./mipengine/controller/resources/pathologies_metadata"
+from mipengine.controller.resources import pathologies_metadata
 
 
 @dataclass_json
@@ -73,12 +72,10 @@ class CommonDataElements:
                 group_elements.update(iterate_metadata_groups(sub_group))
             return group_elements
 
-        pathology_metadata_files = [os.path.join(RELATIVE_METADATA_PATH, json_file)
-                                    for json_file in os.listdir(RELATIVE_METADATA_PATH)
-                                    if json_file.endswith('.json')]
+        metadata_path = Path(pathologies_metadata.__file__).parent
 
         self.pathologies = {}
-        for pathology_metadata_file in pathology_metadata_files:
+        for pathology_metadata_file in metadata_path.glob('*.json'):
             try:
                 pathology_metadata = MetadataGroup.from_json(open(pathology_metadata_file).read())
                 self.pathologies[pathology_metadata.code] = iterate_metadata_groups(pathology_metadata)
diff --git a/mipengine/controller/resources/pathologies_metadata/__init__.py b/mipengine/controller/resources/pathologies_metadata/__init__.py
new file mode 100644
index 00000000..e69de29b
-- 
GitLab


From c9211a0e3fe5eec101d62f3d6c790fc2c7b63b43 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 12 Feb 2021 14:32:39 +0200
Subject: [PATCH 28/30] Removed unittest lib from the tests.

---
 .../tests/controller/api/test_algorithm_validation.py      | 2 --
 mipengine/tests/controller/api/test_get_algorithms.py      | 7 -------
 2 files changed, 9 deletions(-)

diff --git a/mipengine/tests/controller/api/test_algorithm_validation.py b/mipengine/tests/controller/api/test_algorithm_validation.py
index d38fca2c..f486971b 100644
--- a/mipengine/tests/controller/api/test_algorithm_validation.py
+++ b/mipengine/tests/controller/api/test_algorithm_validation.py
@@ -5,8 +5,6 @@ import requests
 
 from mipengine.tests.controller.api import algorithms_url
 
-demo_algorithm_path = "../../../algorithms/demo.json"
-
 
 def test_wrong_algorithm_name():
     logging.info("---------- TEST : POST non existing algorithm")
diff --git a/mipengine/tests/controller/api/test_get_algorithms.py b/mipengine/tests/controller/api/test_get_algorithms.py
index 1104fa03..7c71bfaf 100644
--- a/mipengine/tests/controller/api/test_get_algorithms.py
+++ b/mipengine/tests/controller/api/test_get_algorithms.py
@@ -1,13 +1,10 @@
 import json
 import logging
-import unittest
 
 import requests
 
 from mipengine.tests.controller.api import algorithms_url
 
-demo_algorithm_path = "../../../algorithms/demo.json"
-
 
 def test_get_algorithms():
     logging.info("---------- TEST : Get algorithms")
@@ -172,7 +169,3 @@ def get_demo_algorithm() -> str:
         "desc": "This is a demo algorithm."
     }
     '''
-
-
-if __name__ == "__main__":
-    unittest.main()
-- 
GitLab


From 1f3ac1360d695d6887555cfbe0221f931e009906 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 12 Feb 2021 15:12:25 +0200
Subject: [PATCH 29/30] Refactored the Metadata Group iterator to be part of
 the class.

---
 .../controller/common/common_data_elements.py | 29 ++++++++++---------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/mipengine/controller/common/common_data_elements.py b/mipengine/controller/common/common_data_elements.py
index 83e34e41..6913c761 100644
--- a/mipengine/controller/common/common_data_elements.py
+++ b/mipengine/controller/common/common_data_elements.py
@@ -1,5 +1,4 @@
 import logging
-import os
 from dataclasses import dataclass
 from dataclasses import field
 from pathlib import Path
@@ -9,6 +8,7 @@ from typing import Optional
 from typing import Set
 
 from dataclasses_json import dataclass_json
+
 from mipengine.controller.resources import pathologies_metadata
 
 
@@ -44,6 +44,12 @@ class MetadataGroup:
     variables: Optional[List[MetadataVariable]] = field(default_factory=list)
     groups: Optional[List["MetadataGroup"]] = field(default_factory=list)
 
+    def __iter__(self):
+        yield self
+        for group in self.groups:
+            for subgroup in group:
+                yield subgroup
+
 
 @dataclass
 class CommonDataElement:
@@ -63,25 +69,20 @@ class CommonDataElements:
     pathologies: Dict[str, Dict[str, CommonDataElement]]
 
     def __init__(self):
-
-        def iterate_metadata_groups(metadata_group: MetadataGroup) -> Dict[str, CommonDataElement]:
-            group_elements: Dict[str, CommonDataElement] = {}
-            for variable in metadata_group.variables:
-                group_elements[variable.code] = CommonDataElement(variable)
-            for sub_group in metadata_group.groups:
-                group_elements.update(iterate_metadata_groups(sub_group))
-            return group_elements
-
         metadata_path = Path(pathologies_metadata.__file__).parent
 
         self.pathologies = {}
-        for pathology_metadata_file in metadata_path.glob('*.json'):
+        for pathology_metadata_filepath in metadata_path.glob('*.json'):
             try:
-                pathology_metadata = MetadataGroup.from_json(open(pathology_metadata_file).read())
-                self.pathologies[pathology_metadata.code] = iterate_metadata_groups(pathology_metadata)
+                pathology_metadata: MetadataGroup = MetadataGroup.from_json(open(pathology_metadata_filepath).read())
+                self.pathologies[pathology_metadata.code] = {
+                    variable.code: CommonDataElement(variable)
+                    for group in pathology_metadata
+                    for variable in group.variables
+                }
 
             except Exception as e:
-                logging.error(f"Parsing metadata file: {pathology_metadata_file}")
+                logging.error(f"Parsing metadata file: {pathology_metadata_filepath}")
                 raise e
 
 
-- 
GitLab


From 0104c0ecda4b59b89762d8648a7fe229bdc3f925 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Fri, 12 Feb 2021 15:36:58 +0200
Subject: [PATCH 30/30] Added keyword arguments on long method calls.

---
 .../api/DTOs/AlgorithmSpecificationsDTOs.py   | 42 +++++++++----------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
index 2833a70c..b72c05f3 100644
--- a/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
+++ b/mipengine/controller/api/DTOs/AlgorithmSpecificationsDTOs.py
@@ -37,37 +37,37 @@ class InputDataSpecificationDTO:
 
 def get_pathology_parameter():
     return InputDataSpecificationDTO(
-        "Pathology of the data.",
-        "The pathology that the algorithm will run on.",
-        ["text"],
-        True,
-        False,
-        None,
-        None,
+        label="Pathology of the data.",
+        desc="The pathology that the algorithm will run on.",
+        types=["text"],
+        notblank=True,
+        multiple=False,
+        stattypes=None,
+        enumslen=None,
     )
 
 
 def get_dataset_parameter():
     return InputDataSpecificationDTO(
-        "Set of data to use.",
-        "The set of data to run the algorithm on.",
-        ["text"],
-        True,
-        True,
-        None,
-        None,
+        label="Set of data to use.",
+        desc="The set of data to run the algorithm on.",
+        types=["text"],
+        notblank=True,
+        multiple=True,
+        stattypes=None,
+        enumslen=None,
     )
 
 
 def get_filter_parameter():
     return InputDataSpecificationDTO(
-        "Filter on the data.",
-        "Features used in my algorithm.",
-        ["jsonObject"],
-        False,
-        False,
-        None,
-        None,
+        label="Filter on the data.",
+        desc="Features used in my algorithm.",
+        types=["jsonObject"],
+        notblank=False,
+        multiple=False,
+        stattypes=None,
+        enumslen=None,
     )
 
 
-- 
GitLab