File

apps/recallassess/recallassess-api/src/api/integration/dto/integration-post-bat-analysis.dto.ts

Description

Metadata for POST BAT analysis

Index

Properties

Properties

course_code
Type : string
Decorators :
@Expose()
@ApiProperty({description: 'Course code', example: 'PIP'})
@IsString()
@IsNotEmpty()
Optional course_title
Type : string
Decorators :
@Expose()
@ApiProperty({description: 'Course title', example: 'How to Persuade & Influence People'})
@IsString()
@IsOptional()
Optional date
Type : string
Decorators :
@Expose()
@ApiProperty({description: 'Date', example: '2025-11-26 05:48:03'})
@IsString()
@IsOptional()
learning_group_id
Type : number
Decorators :
@Expose()
@ApiProperty({description: 'Learning group ID', example: 5})
@IsInt()
@IsNotEmpty()
Optional model_name
Type : string
Decorators :
@Expose()
@ApiProperty({description: 'Model name', example: 'gemini-2.5-pro'})
@IsString()
@IsOptional()
Optional plj_position
Type : string
Decorators :
@Expose()
@ApiProperty({description: 'PLJ position', example: 'POST_BAT'})
@IsString()
@IsOptional()
import { ApiProperty } from "@nestjs/swagger";
import { IsArray, IsInt, IsNotEmpty, IsObject, IsOptional, IsString, ValidateNested } from "class-validator";
import { Exclude, Expose, Type } from "class-transformer";

/**
 * Module-level analysis data structure
 */
@Exclude()
export class PostBatModuleAnalysisDto {
  @Expose()
  @ApiProperty({ description: "Learning path recommendation", example: "Congratulations, you are applying this skill..." })
  @IsString()
  @IsNotEmpty()
  learning_path!: string;

  @Expose()
  @ApiProperty({ description: "Additional learning path suggestions", example: " " })
  @IsString()
  @IsOptional()
  additional_learning_path?: string;

  @Expose()
  @ApiProperty({ description: "Array of reference URLs", example: [], type: [String] })
  @IsArray()
  @IsString({ each: true })
  references!: string[];

  @Expose()
  @ApiProperty({ description: "Module name", example: "The Contrast Principle - Pain Points" })
  @IsString()
  @IsOptional()
  module_name?: string;

  @Expose()
  @ApiProperty({ description: "Pre-assessment score", example: 1 })
  @IsInt()
  @IsOptional()
  pre_score?: number;

  @Expose()
  @ApiProperty({ description: "Post-assessment score", example: 2 })
  @IsInt()
  @IsOptional()
  post_score?: number;

  @Expose()
  @ApiProperty({ description: "Group identifier", example: "A" })
  @IsString()
  @IsOptional()
  group_identifier?: string;

  @Expose()
  @ApiProperty({ description: "Pre-assessment level", example: "Advanced" })
  @IsString()
  @IsOptional()
  pre_level?: string;

  @Expose()
  @ApiProperty({ description: "Post-assessment level", example: "Expert" })
  @IsString()
  @IsOptional()
  post_level?: string;
}

/**
 * Trainee data with optional modules (legacy) or overall_summary (new - one summary like pre)
 */
@Exclude()
export class PostBatTraineeDto {
  @Expose()
  @ApiProperty({ description: "Participant ID", example: 33 })
  @IsInt()
  @IsNotEmpty()
  participant_id!: number;

  @Expose()
  @ApiProperty({ description: "Participant name", example: "Abdul" })
  @IsString()
  @IsOptional()
  participant_name?: string;

  /**
   * Overall summary feedback (new format - one summary per participant, stored in ai_analysis only).
   * When present, no per-topic data is written to AssessmentResult.
   */
  @Expose()
  @ApiProperty({
    description: "Overall summary feedback text",
    example: "Your post-training score is 'average' (0.15)...",
  })
  @IsString()
  @IsOptional()
  overall_summary?: string;

  /**
   * @deprecated Prefer overall_summary. When overall_summary is provided, modules are ignored for storage.
   * Modules object with module codes as keys (legacy - writes to each AssessmentResult topic).
   */
  @Expose()
  @ApiProperty({ description: "Modules object with module codes as keys", example: { "PIP11": {} } })
  @IsObject()
  @IsOptional()
  modules?: Record<string, PostBatModuleAnalysisDto>;
}

/**
 * Metadata for POST BAT analysis
 */
@Exclude()
export class PostBatMetadataDto {
  @Expose()
  @ApiProperty({ description: "Learning group ID", example: 5 })
  @IsInt()
  @IsNotEmpty()
  learning_group_id!: number;

  @Expose()
  @ApiProperty({ description: "Course code", example: "PIP" })
  @IsString()
  @IsNotEmpty()
  course_code!: string;

  @Expose()
  @ApiProperty({ description: "Course title", example: "How to Persuade & Influence People" })
  @IsString()
  @IsOptional()
  course_title?: string;

  @Expose()
  @ApiProperty({ description: "PLJ position", example: "POST_BAT" })
  @IsString()
  @IsOptional()
  plj_position?: string;

  @Expose()
  @ApiProperty({ description: "Model name", example: "gemini-2.5-pro" })
  @IsString()
  @IsOptional()
  model_name?: string;

  @Expose()
  @ApiProperty({ description: "Date", example: "2025-11-26 05:48:03" })
  @IsString()
  @IsOptional()
  date?: string;
}

/**
 * Result wrapper for POST BAT analysis
 */
@Exclude()
export class PostBatResultDto {
  @Expose()
  @ApiProperty({ description: "Metadata", type: PostBatMetadataDto })
  @ValidateNested()
  @Type(() => PostBatMetadataDto)
  @IsNotEmpty()
  metadata!: PostBatMetadataDto;

  @Expose()
  @ApiProperty({ description: "Array of trainees", type: [PostBatTraineeDto] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => PostBatTraineeDto)
  @IsNotEmpty()
  trainees!: PostBatTraineeDto[];
}

/**
 * DTO for post-bat-analysis endpoint
 * POST /api/integration/cr/post-bat-analysis
 */
@Exclude()
export class IntegrationPostBatAnalysisDto {
  @Expose()
  @ApiProperty({ description: "Result wrapper containing metadata and trainees", type: PostBatResultDto })
  @ValidateNested()
  @Type(() => PostBatResultDto)
  @IsNotEmpty()
  result!: PostBatResultDto;

  @Expose()
  @ApiProperty({ description: "Success flag", example: true })
  @IsOptional()
  success?: boolean;
}

results matching ""

    No results matching ""