/** * A helper class that includes methods for data transformations, such as receiving all session data and organizing it by student */ import { Session, StudentSessionDataByStudent } from "../../types/session"; /** type Session = { id: string; title: string; createdAt: string; studentSessionData: StudentSessionData[]; } type StudentSessionData = { id: string; classId: string; sessionId: string; studentId: string; scoresOverTime: StudentAssessmentScoresOverTime; } export type StudentSessionDataByStudent = { [studentId: string]: Session[]; } */ export default class DataTransformations { static groupSessionsByStudents(sessions: Session[]): StudentSessionDataByStudent; static getGraphDataAndCompositeScoresForStudent(sessions: Session[], isSpecificSession: boolean): GraphDataAndCompositeScores; static calculateColorsForGraphAndTraces(data: GraphDataAndCompositeScoresByStudent): GraphDataAndCompositeScoresWithColorsByStudent; static calculateMinMax(data: GraphDataAndCompositeScoresByStudent): { minAvg: number; maxAvg: number; minGeneralisationAndAbstr: number; maxGeneralisationAndAbstr: number; minAnalysis: number; maxAnalysis: number; minDecomposition: number; maxDecomposition: number; minPatternRecAndDataRep: number; maxPatternRecAndDataRep: number; minAlgorithms: number; maxAlgorithms: number; }; static calculateColor(value: number, min: number, max: number): "rgb(255, 111, 97)" | "rgb(255, 193, 7)" | "rgb(80, 193, 36)" | "rgb(0, 150, 136)"; static getGraphDataWithColorsForStudents(sessions: Session[], isSpecificSession: boolean): GraphDataAndCompositeScoresWithColorsByStudent; static convertSessionsToSpiderGraphData(sessions: Session[], full?: boolean): any[]; static convertSessionsToSpiderGraphData_LeakyIntegrator(sessions: Session[], isSpecificSession: boolean, full?: boolean): any[]; static convertSessionsToLineGraphData(sessionsArr: Session[], isSpecificSession: boolean, full?: boolean): ({ x: string[]; y: number[]; name: string; type: string; legendgroup?: undefined; hoverinfo?: undefined; text?: undefined; mode?: undefined; fillcolor?: undefined; line?: undefined; fill?: undefined; } | { x: string[]; y: number[] | undefined; name: string; legendgroup: keyof import("@robotical/automatic-assessments").Scores | "Composite"; hoverinfo: string; text: string[] | undefined; type: string; mode: string; fillcolor?: undefined; line?: undefined; fill?: undefined; } | { x: string[]; y: number[] | undefined; name: string; type: string; mode: string; fillcolor: string; line: { color: string; }; legendgroup?: undefined; hoverinfo?: undefined; text?: undefined; fill?: undefined; } | { x: string[]; y: number[] | undefined; name: string; type: string; mode: string; fill: string; fillcolor: string; line: { color: string; }; legendgroup?: undefined; hoverinfo?: undefined; text?: undefined; })[]; } interface GraphDataAndCompositeScoresByStudent { [studentId: string]: GraphDataAndCompositeScores; } interface GraphDataAndCompositeScoresWithColorsByStudent { [studentId: string]: GraphDataAndCompositeScoresWithColors; } interface GraphDataAndCompositeScores { graphData: any; compositeScores: CompositeScores; } interface GraphDataAndCompositeScoresWithColors extends GraphDataAndCompositeScores { colors: { averageCompositeScore: string; generalisationAndAbstrCompoScore: string; analysisCompoScore: string; decompositionCompoScore: string; patternRecAndDataRepCompoScore: string; algorithmsCompoScore: string; }; } interface CompositeScores { generalisationAndAbstrCompoScore: number; analysisCompoScore: number; decompositionCompoScore: number; patternRecAndDataRepCompoScore: number; algorithmsCompoScore: number; averageCompositeScore: number; } export {};