mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
Sprint A — Executive Room real data: Rewrote executive_roi_service.py (20→158 lines) to aggregate from 7 live services: deals (revenue/pipeline/win_rate), approval SLA (pending/warning/ breach from _dealix_sla), connector health (IntegrationSyncState), compliance posture (saudi_compliance_matrix), contradictions (contradiction_engine), strategic deals, evidence packs. Sprint B — Approval Center live: Wired approval_center.py to query real ApprovalRequest table with SLA data from payload["_dealix_sla"]. Approve/reject endpoints update real DB records with reviewed_at timestamp. Sprint C — Saudi Compliance live: Wired saudi_compliance.py to call saudi_compliance_matrix service methods (get_matrix, get_posture, get_risk_heatmap) with real AsyncSession + tenant_id. Sprint D — Contradiction + Evidence Pack DB: Wired contradiction.py and evidence_packs.py to real database via contradiction_engine and evidence_pack_service. All CRUD operations now persist to PostgreSQL with proper tenant isolation. Sprint F — Operating Plane: Created CODEOWNERS file mapping sensitive paths to @VoXc2. Added architecture_brief.py step to CI pipeline (runs before pytest). Sprint G — OWASP LLM: Added OWASP LLM Top 10 review + architecture brief validation to release-prep.md (steps 10-11). https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
69 lines
2.4 KiB
Python
69 lines
2.4 KiB
Python
"""Saudi Compliance API — live compliance matrix with real checks."""
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from typing import Any, Dict
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.database import get_db
|
|
from app.services.saudi_compliance_matrix import saudi_compliance_matrix
|
|
|
|
router = APIRouter(prefix="/compliance/matrix", tags=["Saudi Compliance"])
|
|
|
|
|
|
@router.get("/")
|
|
async def get_compliance_matrix(
|
|
tenant_id: str = "00000000-0000-0000-0000-000000000000",
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> Dict[str, Any]:
|
|
"""Get full compliance matrix from real database."""
|
|
controls = await saudi_compliance_matrix.get_matrix(db, tenant_id=tenant_id)
|
|
return {"controls": controls, "total": len(controls)}
|
|
|
|
|
|
@router.post("/scan")
|
|
async def run_compliance_scan(
|
|
tenant_id: str = "00000000-0000-0000-0000-000000000000",
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> Dict[str, Any]:
|
|
"""Run all live compliance checks against real services."""
|
|
controls = await saudi_compliance_matrix.get_matrix(db, tenant_id=tenant_id)
|
|
posture = await saudi_compliance_matrix.get_posture(db, tenant_id=tenant_id)
|
|
return {
|
|
"status": "scan_complete",
|
|
"controls_checked": len(controls),
|
|
"posture": posture,
|
|
}
|
|
|
|
|
|
@router.get("/posture")
|
|
async def get_compliance_posture(
|
|
tenant_id: str = "00000000-0000-0000-0000-000000000000",
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> Dict[str, Any]:
|
|
"""Get compliance posture summary from real data."""
|
|
return await saudi_compliance_matrix.get_posture(db, tenant_id=tenant_id)
|
|
|
|
|
|
@router.get("/risk-heatmap")
|
|
async def get_risk_heatmap(
|
|
tenant_id: str = "00000000-0000-0000-0000-000000000000",
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> Dict[str, Any]:
|
|
"""Get risk heatmap by category and severity from real data."""
|
|
return await saudi_compliance_matrix.get_risk_heatmap(db, tenant_id=tenant_id)
|
|
|
|
|
|
@router.get("/{control_id}")
|
|
async def get_control_detail(
|
|
control_id: str,
|
|
tenant_id: str = "00000000-0000-0000-0000-000000000000",
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> Dict[str, Any]:
|
|
"""Get specific control detail from real database."""
|
|
matrix = await saudi_compliance_matrix.get_matrix(db, tenant_id=tenant_id)
|
|
for ctrl in matrix:
|
|
if ctrl["control_id"] == control_id:
|
|
return ctrl
|
|
return {"control_id": control_id, "status": "not_found"}
|