Skip to content
Snippets Groups Projects
Commit 08c7d67f authored by Manuel Spuhler's avatar Manuel Spuhler
Browse files

Formula input types

parent 3c3e21df
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,18 @@ export const experimentInputToData = (data: ExperimentCreateInput) => {
label: 'y',
value: data.variables.join(','),
},
{
name: 'formula',
value: {
single: data.transformations.map((t) => ({
var_name: t.name,
unary_operation: t.operation,
})),
interactions: data.interactions.map((v) =>
v.reduce((a, v, i) => ({ ...a, [`var${i + 1}`]: v }), {}),
),
},
},
].concat(data.algorithm.parameters.map(algoParamInputToData)),
type: data.algorithm.type ?? 'string',
name: data.algorithm.name,
......
import { Field, InputType } from '@nestjs/graphql';
import { AlgorithmInput } from './algorithm.input';
@InputType()
export class FormulaTransformation {
@Field()
name: string;
@Field()
operation: string;
}
@InputType()
export class ExperimentCreateInput {
@Field(() => [String])
......@@ -20,4 +29,10 @@ export class ExperimentCreateInput {
@Field()
name: string;
@Field(() => [FormulaTransformation], { nullable: true })
transformations: FormulaTransformation[];
@Field(() => [[String]], { nullable: true })
interactions: string[][];
}
......@@ -189,6 +189,8 @@ input ExperimentCreateInput {
variables: [String!]!
algorithm: AlgorithmInput!
name: String!
transformations: [FormulaTransformation!]
interactions: [[String!]!]
}
input AlgorithmInput {
......@@ -202,6 +204,11 @@ input AlgorithmParamInput {
value: [String!]!
}
input FormulaTransformation {
name: String!
operation: String!
}
input ExperimentEditInput {
name: String
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