Files
breakpilot-compliance/ai-compliance-sdk/internal/ucca/models.go
Benjamin Admin 1ac716261c
Some checks failed
Build + Deploy / build-admin-compliance (push) Successful in 1m45s
Build + Deploy / build-backend-compliance (push) Successful in 4m42s
Build + Deploy / build-ai-sdk (push) Successful in 46s
Build + Deploy / build-developer-portal (push) Successful in 1m6s
Build + Deploy / build-tts (push) Successful in 1m14s
Build + Deploy / build-document-crawler (push) Successful in 31s
Build + Deploy / build-dsms-gateway (push) Successful in 24s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 15s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m27s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Failing after 37s
CI / test-python-backend (push) Successful in 42s
CI / test-python-document-crawler (push) Successful in 25s
CI / test-python-dsms-gateway (push) Successful in 23s
CI / validate-canonical-controls (push) Successful in 18s
Build + Deploy / trigger-orca (push) Successful in 4m35s
feat: Compliance Maximizer — Regulatory Optimization Engine
Neues Modul das den regulatorischen Spielraum fuer KI-Use-Cases
deterministisch berechnet und optimale Konfigurationen vorschlaegt.

Kernfeatures:
- 13-Dimensionen Constraint-Space (DSGVO + AI Act)
- 3-Zonen-Analyse: Verboten / Eingeschraenkt / Erlaubt
- Deterministische Optimizer-Engine (kein LLM im Kern)
- 28 Constraint-Regeln aus DSGVO, AI Act, EDPB Guidelines
- 28 Tests (Golden Suite + Meta-Tests)
- REST API: /sdk/v1/maximizer/* (9 Endpoints)
- Frontend: 3-Zonen-Visualisierung, Dimension-Form, Score-Gauges

[migration-approved]

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 09:10:20 +02:00

263 lines
8.9 KiB
Go

package ucca
import (
"time"
"github.com/google/uuid"
)
// Keep imports used by DecisionTreeResult.
var (
_ uuid.UUID
_ time.Time
)
// ============================================================================
// Constants / Enums
// ============================================================================
// Feasibility represents the overall assessment result
type Feasibility string
const (
FeasibilityYES Feasibility = "YES"
FeasibilityCONDITIONAL Feasibility = "CONDITIONAL"
FeasibilityNO Feasibility = "NO"
)
// RiskLevel represents the overall risk classification
type RiskLevel string
const (
RiskLevelMINIMAL RiskLevel = "MINIMAL"
RiskLevelLOW RiskLevel = "LOW"
RiskLevelMEDIUM RiskLevel = "MEDIUM"
RiskLevelHIGH RiskLevel = "HIGH"
RiskLevelUNACCEPTABLE RiskLevel = "UNACCEPTABLE"
)
// Complexity represents implementation complexity
type Complexity string
const (
ComplexityLOW Complexity = "LOW"
ComplexityMEDIUM Complexity = "MEDIUM"
ComplexityHIGH Complexity = "HIGH"
)
// Severity represents rule severity
type Severity string
const (
SeverityINFO Severity = "INFO"
SeverityWARN Severity = "WARN"
SeverityBLOCK Severity = "BLOCK"
)
// Domain represents the business domain
type Domain string
const (
// Industrie & Produktion
DomainAutomotive Domain = "automotive"
DomainMechanicalEngineering Domain = "mechanical_engineering"
DomainPlantEngineering Domain = "plant_engineering"
DomainElectricalEngineering Domain = "electrical_engineering"
DomainAerospace Domain = "aerospace"
DomainChemicals Domain = "chemicals"
DomainFoodBeverage Domain = "food_beverage"
DomainTextiles Domain = "textiles"
DomainPackaging Domain = "packaging"
// Energie & Versorgung
DomainUtilities Domain = "utilities"
DomainEnergy Domain = "energy"
DomainOilGas Domain = "oil_gas"
// Land- & Forstwirtschaft
DomainAgriculture Domain = "agriculture"
DomainForestry Domain = "forestry"
DomainFishing Domain = "fishing"
// Bau & Immobilien
DomainConstruction Domain = "construction"
DomainRealEstate Domain = "real_estate"
DomainFacilityManagement Domain = "facility_management"
// Gesundheit & Soziales
DomainHealthcare Domain = "healthcare"
DomainMedicalDevices Domain = "medical_devices"
DomainPharma Domain = "pharma"
DomainElderlyCare Domain = "elderly_care"
DomainSocialServices Domain = "social_services"
// Bildung & Forschung
DomainEducation Domain = "education"
DomainHigherEducation Domain = "higher_education"
DomainVocationalTraining Domain = "vocational_training"
DomainResearch Domain = "research"
// Finanzen & Versicherung
DomainFinance Domain = "finance"
DomainBanking Domain = "banking"
DomainInsurance Domain = "insurance"
DomainInvestment Domain = "investment"
// Handel & Logistik
DomainRetail Domain = "retail"
DomainEcommerce Domain = "ecommerce"
DomainWholesale Domain = "wholesale"
DomainLogistics Domain = "logistics"
// IT & Telekommunikation
DomainITServices Domain = "it_services"
DomainTelecom Domain = "telecom"
DomainCybersecurity Domain = "cybersecurity"
// Recht & Beratung
DomainLegal Domain = "legal"
DomainConsulting Domain = "consulting"
DomainTaxAdvisory Domain = "tax_advisory"
// Oeffentlicher Sektor
DomainPublic Domain = "public_sector"
DomainDefense Domain = "defense"
DomainJustice Domain = "justice"
// Marketing & Medien
DomainMarketing Domain = "marketing"
DomainMedia Domain = "media"
DomainEntertainment Domain = "entertainment"
// HR & Personal
DomainHR Domain = "hr"
DomainRecruiting Domain = "recruiting"
// Tourismus & Gastronomie
DomainHospitality Domain = "hospitality"
DomainTourism Domain = "tourism"
// Sonstige
DomainNonprofit Domain = "nonprofit"
DomainSports Domain = "sports"
DomainGeneral Domain = "general"
)
// ValidDomains contains all valid domain values
var ValidDomains = map[Domain]bool{
DomainAutomotive: true, DomainMechanicalEngineering: true, DomainPlantEngineering: true,
DomainElectricalEngineering: true, DomainAerospace: true, DomainChemicals: true,
DomainFoodBeverage: true, DomainTextiles: true, DomainPackaging: true,
DomainUtilities: true, DomainEnergy: true, DomainOilGas: true,
DomainAgriculture: true, DomainForestry: true, DomainFishing: true,
DomainConstruction: true, DomainRealEstate: true, DomainFacilityManagement: true,
DomainHealthcare: true, DomainMedicalDevices: true, DomainPharma: true,
DomainElderlyCare: true, DomainSocialServices: true,
DomainEducation: true, DomainHigherEducation: true, DomainVocationalTraining: true, DomainResearch: true,
DomainFinance: true, DomainBanking: true, DomainInsurance: true, DomainInvestment: true,
DomainRetail: true, DomainEcommerce: true, DomainWholesale: true, DomainLogistics: true,
DomainITServices: true, DomainTelecom: true, DomainCybersecurity: true,
DomainLegal: true, DomainConsulting: true, DomainTaxAdvisory: true,
DomainPublic: true, DomainDefense: true, DomainJustice: true,
DomainMarketing: true, DomainMedia: true, DomainEntertainment: true,
DomainHR: true, DomainRecruiting: true,
DomainHospitality: true, DomainTourism: true,
DomainNonprofit: true, DomainSports: true, DomainGeneral: true,
}
// AutomationLevel represents the degree of automation
type AutomationLevel string
const (
AutomationAssistive AutomationLevel = "assistive"
AutomationSemiAutomated AutomationLevel = "semi_automated"
AutomationFullyAutomated AutomationLevel = "fully_automated"
)
// TrainingAllowed represents if training with data is permitted
type TrainingAllowed string
const (
TrainingYES TrainingAllowed = "YES"
TrainingCONDITIONAL TrainingAllowed = "CONDITIONAL"
TrainingNO TrainingAllowed = "NO"
)
// ExportFormat specifies the export format
type ExportFormat string
const (
ExportFormatJSON ExportFormat = "json"
ExportFormatMarkdown ExportFormat = "md"
)
// ============================================================================
// AI Act Decision Tree Types
// ============================================================================
// GPAICategory represents the GPAI classification result
type GPAICategory string
const (
GPAICategoryNone GPAICategory = "none"
GPAICategoryStandard GPAICategory = "standard"
GPAICategorySystemic GPAICategory = "systemic"
)
// GPAIClassification represents the result of the GPAI axis evaluation
type GPAIClassification struct {
IsGPAI bool `json:"is_gpai"`
IsSystemicRisk bool `json:"is_systemic_risk"`
Category GPAICategory `json:"gpai_category"`
ApplicableArticles []string `json:"applicable_articles"`
Obligations []string `json:"obligations"`
}
// DecisionTreeAnswer represents a user's answer to a decision tree question
type DecisionTreeAnswer struct {
QuestionID string `json:"question_id"`
Value bool `json:"value"`
Note string `json:"note,omitempty"`
}
// DecisionTreeQuestion represents a single question in the decision tree
type DecisionTreeQuestion struct {
ID string `json:"id"`
Axis string `json:"axis"` // "high_risk" or "gpai"
Question string `json:"question"`
Description string `json:"description"` // Additional context
ArticleRef string `json:"article_ref"` // e.g., "Art. 5", "Anhang III"
SkipIf string `json:"skip_if,omitempty"` // Question ID — skip if that was answered "no"
}
// DecisionTreeDefinition represents the full decision tree structure for the frontend
type DecisionTreeDefinition struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Questions []DecisionTreeQuestion `json:"questions"`
}
// DecisionTreeEvalRequest is the API request for evaluating the decision tree
type DecisionTreeEvalRequest struct {
SystemName string `json:"system_name"`
SystemDescription string `json:"system_description,omitempty"`
Answers map[string]DecisionTreeAnswer `json:"answers"`
}
// DecisionTreeResult represents the combined evaluation result
type DecisionTreeResult struct {
ID uuid.UUID `json:"id"`
TenantID uuid.UUID `json:"tenant_id"`
ProjectID *uuid.UUID `json:"project_id,omitempty"`
SystemName string `json:"system_name"`
SystemDescription string `json:"system_description,omitempty"`
Answers map[string]DecisionTreeAnswer `json:"answers"`
HighRiskResult AIActRiskLevel `json:"high_risk_result"`
GPAIResult GPAIClassification `json:"gpai_result"`
CombinedObligations []string `json:"combined_obligations"`
ApplicableArticles []string `json:"applicable_articles"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}