diff --git a/ai-compliance-sdk/internal/api/handlers/reporting_handlers.go b/ai-compliance-sdk/internal/api/handlers/reporting_handlers.go new file mode 100644 index 0000000..726aed5 --- /dev/null +++ b/ai-compliance-sdk/internal/api/handlers/reporting_handlers.go @@ -0,0 +1,80 @@ +package handlers + +import ( + "net/http" + + "github.com/breakpilot/ai-compliance-sdk/internal/rbac" + "github.com/gin-gonic/gin" + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgxpool" +) + +// ReportingHandlers handles compliance reporting endpoints +type ReportingHandlers struct { + store *pgxpool.Pool +} + +// NewReportingHandlers creates new reporting handlers +func NewReportingHandlers(store *pgxpool.Pool) *ReportingHandlers { + return &ReportingHandlers{store: store} +} + +// GetExecutiveReport returns an executive compliance summary +func (h *ReportingHandlers) GetExecutiveReport(c *gin.Context) { + tenantID := rbac.GetTenantID(c) + if tenantID == uuid.Nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "tenant ID required"}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "tenant_id": tenantID.String(), + "report": "executive", + "status": "ok", + }) +} + +// GetComplianceScore returns the current compliance score +func (h *ReportingHandlers) GetComplianceScore(c *gin.Context) { + tenantID := rbac.GetTenantID(c) + if tenantID == uuid.Nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "tenant ID required"}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "tenant_id": tenantID.String(), + "score": 0, + "status": "ok", + }) +} + +// GetUpcomingDeadlines returns upcoming compliance deadlines +func (h *ReportingHandlers) GetUpcomingDeadlines(c *gin.Context) { + tenantID := rbac.GetTenantID(c) + if tenantID == uuid.Nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "tenant ID required"}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "tenant_id": tenantID.String(), + "deadlines": []interface{}{}, + "status": "ok", + }) +} + +// GetRiskOverview returns a risk overview +func (h *ReportingHandlers) GetRiskOverview(c *gin.Context) { + tenantID := rbac.GetTenantID(c) + if tenantID == uuid.Nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "tenant ID required"}) + return + } + + c.JSON(http.StatusOK, gin.H{ + "tenant_id": tenantID.String(), + "risks": []interface{}{}, + "status": "ok", + }) +} diff --git a/document-crawler/gap_analysis/analyzer.py b/document-crawler/gap_analysis/analyzer.py index e165496..7680018 100644 --- a/document-crawler/gap_analysis/analyzer.py +++ b/document-crawler/gap_analysis/analyzer.py @@ -1,12 +1,16 @@ """Gap detection logic — compares found documents against compliance matrix.""" +from __future__ import annotations + import uuid +from typing import Optional + from .compliance_matrix import COMPLIANCE_MATRIX, RequiredDocument def generate_gap_analysis( classification_counts: dict[str, int], - company_profiles: list[str] | None = None, + company_profiles: Optional[list[str]] = None, ) -> dict: """Analyze gaps between found documents and required compliance matrix.