-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
matvey.samokhin
committed
Mar 21, 2024
1 parent
3565c2c
commit 73d6fb2
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {ModelInterface} from "../types/model.type"; | ||
import {ModelDTO} from "../types/dto/model.dto"; | ||
import {EncoderBaseType, ExperimentInterface, ParameterType} from "../types/experiment.type"; | ||
import {ExperimentDTO} from "../types/dto/experiment.dto"; | ||
|
||
export class ExperimentClass implements ExperimentInterface { | ||
uuid: string | ||
featureName: string | ||
encoder: EncoderBaseType | ||
serializedData: string[] | ||
|
||
constructor(dto: ExperimentDTO, id?: string) { | ||
this.uuid = dto.uuid || id | ||
this.featureName = dto.featureName || '' | ||
this.encoder = dto.encoder || { name: '', parameters: [] } | ||
this.serializedData = dto.serializedData || [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as t from 'io-ts'; | ||
import {Experiment, ExperimentType} from "../experiment.type"; | ||
import {ExperimentClass} from "../../models/experiment.model"; | ||
|
||
export type ExperimentDTO = t.TypeOf<typeof ExperimentType>; | ||
|
||
class ExperimentObject { | ||
experiments: Experiment; | ||
|
||
constructor(dto: ExperimentDTO) { | ||
this.experiments = new ExperimentClass(dto); | ||
} | ||
} | ||
|
||
export { ExperimentObject }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as t from 'io-ts'; | ||
|
||
export const ParamType = t.type({ | ||
name: t.union([t.string, t.undefined]), | ||
value: t.union([t.string, t.record(t.string, t.string)]), | ||
type: t.union([t.string, t.undefined]), | ||
}) | ||
|
||
export const EncoderType = t.type({ | ||
name: t.string, | ||
parameters: t.array(ParamType), | ||
}) | ||
|
||
export const ExperimentType = t.type({ | ||
uuid: t.string, | ||
featureName: t.string, | ||
encoder: EncoderType, | ||
serializedData: t.array(t.string) | ||
}) | ||
|
||
export type ParameterType = { | ||
name: string, | ||
value?: string | Record<string, string>, | ||
type?: string, | ||
} | ||
|
||
export type EncoderBaseType = { | ||
name: string, | ||
parameters: ParameterType[] | ||
} | ||
|
||
export type Experiment = { | ||
uuid: string, | ||
featureName: string, | ||
encoder: EncoderBaseType, | ||
serializedData: string[] | ||
} | ||
|
||
export interface ExperimentInterface { | ||
uuid: string, | ||
featureName: string, | ||
encoder: EncoderBaseType, | ||
serializedData: string[] | ||
} |