feat(controls): atom-grain path in get_controls_for_use_case
Reads compliance.atom_classification (Haiku pass: relevant + sub_topic + canonical_obligation) when present -> precise, sub-topic-organized controls per topic; master-grain seed stays as fallback for unprocessed topics. New optional sub_topic filter + subtopic_counts facet + granularity flag in the response. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ draw from ONE controls index instead of separate retrievals. Read-only.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -39,11 +39,13 @@ async def list_use_cases(
|
||||
@router.get("/use-cases/{use_case}/controls")
|
||||
async def controls_for_use_case(
|
||||
use_case: str,
|
||||
primary_only: bool = Query(False, description="Nur Primaerzweck-Mappings"),
|
||||
primary_only: bool = Query(False, description="master-grain Fallback: nur Primaerzweck"),
|
||||
sub_topic: Optional[str] = Query(None, description="atom-grain: nur dieses Sub-Thema"),
|
||||
limit: int = Query(50, ge=1, le=200),
|
||||
offset: int = Query(0, ge=0),
|
||||
svc: UseCaseControlsService = Depends(get_use_case_controls_service),
|
||||
) -> dict[str, Any]:
|
||||
"""Controls mapped to a topic, ranked by the deterministic precision proxy."""
|
||||
"""Controls for a topic. Atom-grain (Haiku: relevant + sub_topic) wenn vorhanden,
|
||||
sonst master-grain Seed."""
|
||||
with translate_domain_errors():
|
||||
return svc.controls_for_use_case(use_case, primary_only, limit, offset)
|
||||
return svc.controls_for_use_case(use_case, primary_only, limit, offset, sub_topic)
|
||||
|
||||
Reference in New Issue
Block a user