mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
CI Fix:
All 8 Tier-1 API routes now use fully lazy imports — no module-level
imports of app.database, app.services, or app.models. Every import
happens inside the function body. This prevents pytest collection
failure (exit code 4) caused by import chain side effects during
test discovery.
Pattern: _get_db() async generator wraps app.database.get_db lazily.
Service/model imports are inside each route handler function.
Revenue Activation System (3 phases):
revenue-activation/FIRST_3_CLIENTS_PLAN.md
— ICP definition, outreach scripts (WhatsApp/LinkedIn/Email),
demo strategy, pricing (15K-50K SAR pilot), closing playbook,
objection handling, referral scripts, pipeline KPIs
revenue-activation/deployment/LIVE_DEPLOYMENT_GUIDE.md
— Step-by-step client installation in 48h, data import,
training agenda, pilot monitoring, post-pilot conversion
revenue-activation/AUTOMATED_REVENUE_ENGINE.md
— Self-generating pipeline: outreach→demo→pilot→case study→referral,
auto-sequences, AI response classification, upsell triggers,
90-day revenue targets (100K+ SAR MRR)
revenue-activation/outreach/whatsapp-sequences.json
— 3 ready-to-use sequences: cold B2B, warm referral, post-pilot convert
revenue-activation/demo/seed_demo_tenant.py
— Seeds demo tenant with 15 leads, 8 deals, 3 approvals with SLA,
4 connectors, 1 evidence pack for executive simulation demos
https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
50 lines
2.2 KiB
Python
50 lines
2.2 KiB
Python
"""Saudi Compliance API — live compliance matrix with real checks."""
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from typing import Any, Dict
|
|
|
|
router = APIRouter(prefix="/compliance/matrix", tags=["Saudi Compliance"])
|
|
|
|
|
|
async def _get_db():
|
|
from app.database import get_db
|
|
async for session in get_db():
|
|
yield session
|
|
|
|
|
|
@router.get("/")
|
|
async def get_compliance_matrix(tenant_id: str = "00000000-0000-0000-0000-000000000000", db=Depends(_get_db)) -> Dict[str, Any]:
|
|
from app.services.saudi_compliance_matrix import saudi_compliance_matrix
|
|
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=Depends(_get_db)) -> Dict[str, Any]:
|
|
from app.services.saudi_compliance_matrix import saudi_compliance_matrix
|
|
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=Depends(_get_db)) -> Dict[str, Any]:
|
|
from app.services.saudi_compliance_matrix import saudi_compliance_matrix
|
|
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=Depends(_get_db)) -> Dict[str, Any]:
|
|
from app.services.saudi_compliance_matrix import saudi_compliance_matrix
|
|
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=Depends(_get_db)) -> Dict[str, Any]:
|
|
from app.services.saudi_compliance_matrix import saudi_compliance_matrix
|
|
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"}
|