Files
breakpilot-compliance/ai-compliance-sdk/migrations/022_interactive_training.sql
Benjamin Admin 4f6bc8f6f6
Some checks failed
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Failing after 37s
CI/CD / test-python-backend-compliance (push) Successful in 39s
CI/CD / test-python-document-crawler (push) Successful in 26s
CI/CD / test-python-dsms-gateway (push) Successful in 23s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Has been skipped
feat(training+controls): interactive video pipeline, training blocks, control generator, CE libraries
Interactive Training Videos (CP-TRAIN):
- DB migration 022: training_checkpoints + checkpoint_progress tables
- NarratorScript generation via Anthropic (AI Teacher persona, German)
- TTS batch synthesis + interactive video pipeline (slides + checkpoint slides + FFmpeg)
- 4 new API endpoints: generate-interactive, interactive-manifest, checkpoint submit, checkpoint progress
- InteractiveVideoPlayer component (HTML5 Video, quiz overlay, seek protection, progress tracking)
- Learner portal integration with automatic completion on all checkpoints passed
- 30 new tests (handler validation + grading logic + manifest/progress + seek protection)

Training Blocks:
- Block generator, block store, block config CRUD + preview/generate endpoints
- Migration 021: training_blocks schema

Control Generator + Canonical Library:
- Control generator routes + service enhancements
- Canonical control library helpers, sidebar entry
- Citation backfill service + tests
- CE libraries data (hazard, protection, evidence, lifecycle, components)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 21:41:48 +01:00

38 lines
1.9 KiB
SQL

-- Migration 022: Interactive Training Video Pipeline
-- Adds checkpoints, checkpoint progress tracking, and links quiz questions to checkpoints
-- Checkpoints pro Modul-Video (pausiert Video bei bestimmtem Timestamp)
CREATE TABLE IF NOT EXISTS training_checkpoints (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
module_id UUID NOT NULL REFERENCES training_modules(id) ON DELETE CASCADE,
checkpoint_index INTEGER NOT NULL,
title TEXT NOT NULL,
timestamp_seconds DOUBLE PRECISION NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(module_id, checkpoint_index)
);
-- Checkpoint-Fortschritt pro User-Assignment
CREATE TABLE IF NOT EXISTS training_checkpoint_progress (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
assignment_id UUID NOT NULL REFERENCES training_assignments(id) ON DELETE CASCADE,
checkpoint_id UUID NOT NULL REFERENCES training_checkpoints(id) ON DELETE CASCADE,
passed BOOLEAN DEFAULT FALSE,
attempts INTEGER DEFAULT 0,
last_attempt_at TIMESTAMPTZ,
created_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(assignment_id, checkpoint_id)
);
-- Quiz-Fragen koennen jetzt optional einem Checkpoint zugeordnet sein
ALTER TABLE training_quiz_questions ADD COLUMN IF NOT EXISTS checkpoint_id UUID REFERENCES training_checkpoints(id);
-- Checkpoint-Index auf Media (fuer Manifest-Zuordnung)
ALTER TABLE training_media ADD COLUMN IF NOT EXISTS checkpoint_index INTEGER;
-- Indices for performance
CREATE INDEX IF NOT EXISTS idx_training_checkpoints_module ON training_checkpoints(module_id);
CREATE INDEX IF NOT EXISTS idx_training_checkpoint_progress_assignment ON training_checkpoint_progress(assignment_id);
CREATE INDEX IF NOT EXISTS idx_training_checkpoint_progress_checkpoint ON training_checkpoint_progress(checkpoint_id);
CREATE INDEX IF NOT EXISTS idx_training_quiz_questions_checkpoint ON training_quiz_questions(checkpoint_id);