Skip to content
Snippets Groups Projects
Commit d9c564c8 authored by stevereis's avatar stevereis
Browse files

Add coVariables in expriment

parent 6bd8c8b0
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,14 @@ export const experimentInputToData = (data: ExperimentCreateInput) => {
name: data.name,
};
if (data.coVariables && data.coVariables.length) {
params.algorithm.parameters.push({
name: 'x',
label: 'x',
value: data.coVariables.join(','),
});
}
return params;
};
......
......@@ -5,7 +5,7 @@ import * as jsonata from 'jsonata'; // old import style needed due to 'export =
export const transformToAlgorithms = jsonata(`
(
$params := ["y", "pathology", "dataset", "filter"];
$params := ["y", "pathology", "dataset", "filter", "x"];
$toArray := function($x) { $type($x) = 'array' ? $x : [$x]};
......@@ -30,7 +30,7 @@ export const transformToAlgorithms = jsonata(`
export const transformToExperiment = jsonata(`
(
$params := ["y", "pathology", "dataset", "filter"];
$params := ["y", "pathology", "dataset", "filter", "x"];
$toArray := function($x) { $type($x) = 'array' ? $x : [$x]};
......@@ -46,6 +46,7 @@ export const transformToExperiment = jsonata(`
"updateAt": updated,
"domain": algorithm.parameters[name = "pathology"].value,
"variables": $split(algorithm.parameters[name = "y"].value, ','),
"coVariables": $toArray($split(algorithm.parameters[name = "x"].value, ',')),
"filter": algorithm.parameters[name = "filter"].value,
"datasets": $split(algorithm.parameters[name = "dataset"].value, ','),
"algorithm": {
......
......@@ -43,6 +43,9 @@ export class Experiment {
@Field(() => [String])
variables: string[];
@Field(() => [String], { nullable: true, defaultValue: [] })
coVariables?: string[];
@Field()
algorithm: Algorithm;
......
......@@ -15,6 +15,9 @@ export class ExperimentCreateInput {
@Field(() => [String])
variables: string[];
@Field(() => [String], { nullable: true, defaultValue: [] })
coVariables?: string[];
@Field()
algorithm: AlgorithmInput;
......
......@@ -37,7 +37,7 @@ type Domain {
}
type AlgorithmParameter {
name: String!
id: String!
value: [String!]
label: String
description: String
......@@ -50,7 +50,7 @@ type AlgorithmParameter {
}
type Algorithm {
name: String!
id: String!
parameters: [AlgorithmParameter!]
label: String
type: String
......@@ -140,6 +140,7 @@ type Experiment {
filter: String
domain: String!
variables: [String!]!
coVariables: [String!]
algorithm: Algorithm!
name: String!
}
......@@ -158,6 +159,7 @@ type PartialExperiment {
filter: String
domain: String
variables: [String!]
coVariables: [String!]
algorithm: Algorithm
name: String
}
......@@ -187,22 +189,24 @@ input ExperimentCreateInput {
filter: String
domain: String!
variables: [String!]!
coVariables: [String!] = []
algorithm: AlgorithmInput!
name: String!
}
input AlgorithmInput {
name: String!
id: String!
parameters: [AlgorithmParamInput!] = []
type: String!
}
input AlgorithmParamInput {
name: String!
id: String!
value: [String!]!
}
input ExperimentEditInput {
name: String
shared: Boolean
viewed: Boolean
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment