Skip to content
Snippets Groups Projects
Commit fca79819 authored by Steve Reis's avatar Steve Reis
Browse files

Merge branch 'develop' into 'main'

Merge Request for the MIP 6.5 release

See merge request sibmip/gateway!24
parents b54b8207 995ab67e
No related branches found
No related tags found
No related merge requests found
Showing
with 447 additions and 8 deletions
import { Field, ObjectType } from '@nestjs/graphql';
import { Entity } from './entity.model';
@ObjectType()
export class Group extends Entity {
@Field({ nullable: true })
description?: string;
@Field(() => [String], { defaultValue: [], nullable: true })
groups?: string[];
@Field(() => [String], {
description: "List of variable's ids",
defaultValue: [],
nullable: true,
})
variables?: string[];
}
import { ObjectType, Field } from '@nestjs/graphql';
@ObjectType()
export class ChartAxis {
@Field({ nullable: true, defaultValue: '' })
label?: string;
@Field(() => [String], { nullable: true, defaultValue: [] })
categories?: string[];
}
import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType()
export class Header {
@Field()
name: string;
@Field()
type: string;
}
import { createUnionType } from '@nestjs/graphql';
import { GroupsResult } from '../groups-result.model';
import { HeatMapResult } from '../heat-map-result.model';
import { LineChartResult } from '../line-chart-result.model';
import { RawResult } from '../raw-result.model';
import { TableResult } from '../table-result.model';
export const ResultUnion = createUnionType({
name: 'ResultUnion',
types: () => [
TableResult,
RawResult,
GroupsResult,
HeatMapResult,
LineChartResult,
],
resolveType(value) {
if (value.headers) {
return TableResult;
}
if (value.rawdata) {
return RawResult;
}
if (value.groups) {
return GroupsResult;
}
if (value.matrix) {
return HeatMapResult;
}
if (value.x) {
return LineChartResult;
}
return null;
},
});
import { ObjectType } from '@nestjs/graphql';
@ObjectType()
export abstract class Result {}
import { Field, ObjectType } from '@nestjs/graphql';
import { ResultUnion } from './common/result-union.model';
import { Result } from './common/result.model';
@ObjectType()
export class GroupResult {
public constructor(init?: Partial<GroupResult>) {
Object.assign(this, init);
}
@Field()
name: string;
@Field({ nullable: true })
description?: string;
@Field(() => [ResultUnion])
results: Array<typeof ResultUnion>;
}
@ObjectType()
export class GroupsResult extends Result {
@Field(() => [GroupResult])
groups: GroupResult[];
}
import { Field, ObjectType } from '@nestjs/graphql';
import { ChartAxis } from './common/chart-axis.model';
import { Result } from './common/result.model';
@ObjectType()
export class HeatMapResult extends Result {
@Field()
name: string;
@Field(() => [[Number]])
matrix: number[][];
@Field(() => ChartAxis)
xAxis: ChartAxis;
@Field(() => ChartAxis)
yAxis: ChartAxis;
}
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
import { ChartAxis } from './common/chart-axis.model';
import { Result } from './common/result.model';
export enum LineType {
NORMAL,
DASHED,
}
registerEnumType(LineType, {
name: 'LineType',
});
@ObjectType()
export class ExtraLineInfo {
@Field()
label: string;
@Field(() => [String])
values: string[];
}
@ObjectType()
export class LineResult {
@Field()
label: string;
@Field(() => [Number])
x: number[];
@Field(() => [Number])
y: number[];
@Field(() => [ExtraLineInfo], { nullable: true, defaultValue: [] })
extraLineInfos?: ExtraLineInfo[];
@Field(() => LineType, { nullable: true, defaultValue: LineType.NORMAL })
type?: LineType;
}
@ObjectType()
export class LineChartResult extends Result {
@Field()
name: string;
@Field(() => ChartAxis, { nullable: true })
xAxis?: ChartAxis;
@Field(() => ChartAxis, { nullable: true })
yAxis?: ChartAxis;
@Field(() => [LineResult])
lines: LineResult[];
}
import { Field, ObjectType } from '@nestjs/graphql';
import GraphQLJSON from 'graphql-type-json';
import { Result } from './common/result.model';
// field name 'rawdata' was used instead of 'data' because of typing problem on union with same field name
// see :https://stackoverflow.com/questions/44170603/graphql-using-same-field-names-in-different-types-within-union
@ObjectType()
export class RawResult extends Result {
@Field(() => GraphQLJSON)
rawdata: unknown;
}
import { Field, ObjectType } from '@nestjs/graphql';
import { Header } from './common/header.model';
import { Result } from './common/result.model';
@ObjectType()
export class TableResult extends Result {
@Field()
name: string;
@Field(() => [[String]])
data: string[][];
@Field(() => [Header])
headers: Header[];
}
import { Field, ObjectType } from '@nestjs/graphql';
import { Category } from './category.model';
import { Entity } from './entity.model';
import { Group } from './group.model';
@ObjectType()
export class Variable extends Entity {
@Field({ nullable: true })
type?: string;
@Field({ nullable: true })
description?: string;
@Field(() => [Category], { nullable: true, defaultValue: [] })
enumerations?: Category[];
@Field(() => [Group], { nullable: true, defaultValue: [] })
groups?: Group[];
}
......@@ -2,7 +2,7 @@ import { NestFactory } from '@nestjs/core';
import { AppModule } from './main/app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
const app = await NestFactory.create(AppModule, { cors: true });
await app.listen(process.env.GATEWAY_PORT);
}
bootstrap();
import { HttpService } from '@nestjs/axios';
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) { }
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
......
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { EngineModule } from 'src/engine/engine.module';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: ['.env', '.env.defaults'],
}),
EngineModule.forRootAsync({
type: process.env.ENGINE_TYPE || "exareme"
})],
type: process.env.ENGINE_TYPE,
baseurl: process.env.ENGINE_BASE_URL,
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule { }
export class AppModule {}
......@@ -2,6 +2,214 @@
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
type Category {
id: String!
label: String
}
type Group {
id: String!
label: String
description: String
groups: [String!]
"""List of variable's ids"""
variables: [String!]
}
type Variable {
id: String!
label: String
type: String
description: String
enumerations: [Category!]
groups: [Group!]
}
type Domain {
id: String!
label: String
description: String
groups: [Group!]!
variables: [Variable!]!
datasets: [Category!]!
rootGroup: Group!
}
type AlgorithmParameter {
name: String!
value: [String!]
label: String
description: String
defaultValue: String
isMultiple: Boolean
isRequired: Boolean
min: String
max: String
type: String
}
type Algorithm {
name: String!
parameters: [AlgorithmParameter!]
label: String
type: String
description: String
}
type GroupResult {
name: String!
description: String
results: [ResultUnion!]!
}
union ResultUnion = TableResult | RawResult | GroupsResult | HeatMapResult | LineChartResult
type TableResult {
name: String!
data: [[String!]!]!
headers: [Header!]!
}
type RawResult {
rawdata: JSON!
}
"""
The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
"""
scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
type GroupsResult {
groups: [GroupResult!]!
}
type HeatMapResult {
name: String!
matrix: [[Float!]!]!
xAxis: ChartAxis!
yAxis: ChartAxis!
}
type LineChartResult {
name: String!
xAxis: ChartAxis
yAxis: ChartAxis
lines: [LineResult!]!
}
type ChartAxis {
label: String
categories: [String!]
}
type ExtraLineInfo {
label: String!
values: [String!]!
}
type LineResult {
label: String!
x: [Float!]!
y: [Float!]!
extraLineInfos: [ExtraLineInfo!]
type: LineType
}
enum LineType {
NORMAL
DASHED
}
type Header {
name: String!
type: String!
}
type Experiment {
uuid: String
author: String
createdAt: Float
updateAt: Float
finishedAt: Float
viewed: Boolean
status: String
shared: Boolean!
results: [ResultUnion!]
datasets: [String!]!
filter: String
domain: String!
variables: [String!]!
algorithm: Algorithm!
name: String!
}
type PartialExperiment {
uuid: String
author: String
createdAt: Float
updateAt: Float
finishedAt: Float
viewed: Boolean
status: String
shared: Boolean
results: [ResultUnion!]
datasets: [String!]
filter: String
domain: String
variables: [String!]
algorithm: Algorithm
name: String
}
type ListExperiments {
currentPage: Float
totalPages: Float
totalExperiments: Float
experiments: [Experiment!]!
}
type Query {
hello: String!
domains(ids: [String!] = []): [Domain!]!
experiments(name: String = "", page: Float = 0): ListExperiments!
expriment(uuid: String!): Experiment!
algorithms: [Algorithm!]!
}
type Mutation {
createExperiment(isTransient: Boolean = false, data: ExperimentCreateInput!): Experiment!
editExperiment(data: ExperimentEditInput!, uuid: String!): Experiment!
removeExperiment(uuid: String!): PartialExperiment!
}
input ExperimentCreateInput {
datasets: [String!]!
filter: String
domain: String!
variables: [String!]!
algorithm: AlgorithmInput!
name: String!
transformations: [FormulaTransformation!]
interactions: [[String!]!]
}
input AlgorithmInput {
name: String!
parameters: [AlgorithmParamInput!] = []
type: String!
}
input AlgorithmParamInput {
name: String!
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