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

Simplify group data needed from engines

parent 66081a79
No related branches found
No related tags found
No related merge requests found
...@@ -14,38 +14,66 @@ export default class DataShieldService implements IEngineService { ...@@ -14,38 +14,66 @@ export default class DataShieldService implements IEngineService {
getAlgorithms(): Algorithm[] | Promise<Algorithm[]> { getAlgorithms(): Algorithm[] | Promise<Algorithm[]> {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
createExperiment( createExperiment(
data: ExperimentCreateInput, data: ExperimentCreateInput,
isTransient: boolean, isTransient: boolean,
): Experiment | Promise<Experiment> { ): Experiment | Promise<Experiment> {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
listExperiments( listExperiments(
page: number, page: number,
name: string, name: string,
): ListExperiments | Promise<ListExperiments> { ): ListExperiments | Promise<ListExperiments> {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
getExperiment(uuid: string): Experiment | Promise<Experiment> { getExperiment(uuid: string): Experiment | Promise<Experiment> {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
removeExperiment( removeExperiment(
uuid: string, uuid: string,
): PartialExperiment | Promise<PartialExperiment> { ): PartialExperiment | Promise<PartialExperiment> {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
editExperient( editExperient(
uuid: string, uuid: string,
expriment: ExperimentEditInput, expriment: ExperimentEditInput,
): Experiment | Promise<Experiment> { ): Experiment | Promise<Experiment> {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
getDomains(): Domain[] { getDomains(): Domain[] {
throw new Error('Method not implemented.'); return [
{
id: 'Dummy',
label: 'Dummy',
datasets: [{ id: 'DummyDataSet' }],
groups: [
{
id: 'DummyGroup',
variables: ['DummyVar'],
groups: [],
},
],
rootGroup: { id: 'DummyGroup', variables: [], groups: [] },
variables: [{ id: 'DummyVar', type: 'string' }],
},
];
} }
getActiveUser(): Observable<string> { getActiveUser(): string {
throw new Error('Method not implemented.'); const dummyUser = {
username: 'anonymous',
subjectId: 'anonymousId',
fullname: 'anonymous',
email: 'anonymous@anonymous.com',
agreeNDA: true,
};
return JSON.stringify(dummyUser);
} }
editActiveUser(): Observable<string> { editActiveUser(): Observable<string> {
...@@ -72,11 +100,11 @@ export default class DataShieldService implements IEngineService { ...@@ -72,11 +100,11 @@ export default class DataShieldService implements IEngineService {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
getExperiments(): Observable<string> { getExperiments(): string {
throw new Error('Method not implemented.'); return '[]';
} }
getAlgorithmsREST(): Observable<string> { getAlgorithmsREST(): string {
throw new Error('Method not implemented.'); return '[]';
} }
} }
...@@ -28,7 +28,9 @@ export const dataToGroup = (data: Hierarchy): Group => { ...@@ -28,7 +28,9 @@ export const dataToGroup = (data: Hierarchy): Group => {
id: data.code, id: data.code,
label: data.label, label: data.label,
groups: data.groups ? data.groups.map(dataToGroup) : [], groups: data.groups ? data.groups.map(dataToGroup) : [],
variables: data.variables ? data.variables.map(dataToVariable) : [], variables: data.variables
? data.variables.map((data: VariableEntity) => data.code)
: [],
}; };
}; };
......
import { Field, ObjectType } from '@nestjs/graphql'; import { Field, ObjectType } from '@nestjs/graphql';
import { Category } from './category.model'; import { Category } from './category.model';
import { Entity } from './entity.model';
import { Group } from './group.model'; import { Group } from './group.model';
import { Variable } from './variable.model';
@ObjectType() @ObjectType()
export class Domain extends Group { export class Domain extends Entity {
@Field({ nullable: true })
description?: string;
@Field(() => [Group])
groups: Group[];
@Field(() => [Variable])
variables: Variable[];
@Field(() => [Category]) @Field(() => [Category])
datasets: Category[]; datasets: Category[];
......
import { Field, ObjectType } from '@nestjs/graphql'; import { Field, ObjectType } from '@nestjs/graphql';
import { Entity } from './entity.model'; import { Entity } from './entity.model';
import { Variable } from './variable.model';
@ObjectType() @ObjectType()
export class Group extends Entity { export class Group extends Entity {
...@@ -10,6 +9,6 @@ export class Group extends Entity { ...@@ -10,6 +9,6 @@ export class Group extends Entity {
@Field(() => [Group]) @Field(() => [Group])
groups: Group[]; groups: Group[];
@Field(() => [Variable]) @Field(() => [String], { description: "List of variable's ids" })
variables: Variable[]; variables: string[];
} }
...@@ -11,9 +11,9 @@ export class Variable extends Entity { ...@@ -11,9 +11,9 @@ export class Variable extends Entity {
@Field({ nullable: true }) @Field({ nullable: true })
description?: string; description?: string;
@Field(() => [Category]) @Field(() => [Category], { nullable: true, defaultValue: [] })
enumerations: Category[]; enumerations?: Category[];
@Field(() => [Group]) @Field(() => [Group], { nullable: true, defaultValue: [] })
groups: Group[]; groups?: Group[];
} }
...@@ -7,21 +7,23 @@ type Category { ...@@ -7,21 +7,23 @@ type Category {
label: String label: String
} }
type Variable { type Group {
id: String! id: String!
label: String label: String
type: String!
description: String description: String
enumerations: [Category!]!
groups: [Group!]! groups: [Group!]!
"""List of variable's ids"""
variables: [String!]!
} }
type Group { type Variable {
id: String! id: String!
label: String label: String
type: String!
description: String description: String
groups: [Group!]! enumerations: [Category!]
variables: [Variable!]! groups: [Group!]
} }
type Domain { type Domain {
......
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