Files
breakpilot-compliance/backend-compliance/compliance/api/__init__.py
Benjamin Admin 825e070ed9
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 47s
CI/CD / test-python-backend-compliance (push) Successful in 33s
CI/CD / test-python-document-crawler (push) Successful in 24s
CI/CD / test-python-dsms-gateway (push) Successful in 18s
CI/CD / validate-canonical-controls (push) Successful in 11s
CI/CD / Deploy (push) Has been skipped
feat(multi-layer): complete Multi-Layer Control Architecture (Phases 1-8 + Pass 0)
Implements the full Multi-Layer Control Architecture for migrating ~25,000
Rich Controls into atomic, deduplicated Master Controls with full traceability.

Architecture: Legal Source → Obligation → Control Pattern → Master Control → Customer Instance

New services:
- ObligationExtractor: 3-tier extraction (exact → embedding → LLM)
- PatternMatcher: 2-tier matching (keyword + embedding + domain-bonus)
- ControlComposer: Pattern + Obligation → Master Control
- PipelineAdapter: Pipeline integration + Migration Passes 1-5
- DecompositionPass: Pass 0a/0b — Rich Control → atomic Controls
- CrosswalkRoutes: 15 API endpoints under /v1/canonical/

New DB schema:
- Migration 060: obligation_extractions, control_patterns, crosswalk_matrix
- Migration 061: obligation_candidates, parent_control_uuid tracking

Pattern Library: 50 YAML patterns (30 core + 20 IT-security)
Go SDK: Pattern loader with YAML validation and indexing
Documentation: MkDocs updated with full architecture overview

500 Python tests passing across all components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 09:00:37 +01:00

71 lines
1.8 KiB
Python

"""API routes for Compliance module."""
import logging
from .routes import router
logger = logging.getLogger(__name__)
def _safe_import_router(module_name: str, attr: str = "router"):
"""Import a router module safely — log error but don't crash the whole app."""
try:
mod = __import__(f"compliance.api.{module_name}", fromlist=[attr])
return getattr(mod, attr)
except Exception as e:
logger.error("Failed to import %s: %s", module_name, e)
return None
# Import all sub-routers (safe — failure of one doesn't block others)
_ROUTER_MODULES = [
"audit_routes",
"ai_routes",
"evidence_routes",
"risk_routes",
"dashboard_routes",
"scraper_routes",
"module_routes",
"isms_routes",
"vvt_routes",
"legal_document_routes",
"einwilligungen_routes",
"escalation_routes",
"consent_template_routes",
"notfallplan_routes",
"obligation_routes",
"security_backlog_routes",
"quality_routes",
"loeschfristen_routes",
"legal_template_routes",
"compliance_scope_routes",
"dsfa_routes",
"dsr_routes",
"email_template_routes",
"banner_routes",
"extraction_routes",
"tom_routes",
"vendor_compliance_routes",
"incident_routes",
"change_request_routes",
"generation_routes",
"project_routes",
"wiki_routes",
"canonical_control_routes",
"control_generator_routes",
"crosswalk_routes",
"process_task_routes",
"evidence_check_routes",
]
_loaded_count = 0
for _mod_name in _ROUTER_MODULES:
_sub_router = _safe_import_router(_mod_name)
if _sub_router is not None:
router.include_router(_sub_router)
_loaded_count += 1
logger.info("Loaded %d/%d compliance sub-routers", _loaded_count, len(_ROUTER_MODULES))
__all__ = ["router"]