feat: add measured detection review loop
This commit is contained in:
@@ -6,7 +6,9 @@ from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.db.session import get_db
|
||||
from app.schemas.detection_review import DetectionReviewUpsert
|
||||
from app.schemas.qa import QualityCheckList
|
||||
from app.services.detection_review_service import DetectionReviewService
|
||||
from app.services.quality_evidence_service import QualityEvidenceService
|
||||
from app.services.quality_check_service import QualityCheckService
|
||||
from app.utils.response import envelope
|
||||
@@ -37,3 +39,45 @@ def get_quality_check_evidence_geojson(
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict:
|
||||
return envelope(QualityEvidenceService.evidence_geojson(db, project_id=project_id, quality_check_id=quality_check_id))
|
||||
|
||||
|
||||
@router.get("/quality-checks/{quality_check_id}/reviews", response_model=dict)
|
||||
def list_detection_reviews(
|
||||
project_id: UUID,
|
||||
quality_check_id: UUID,
|
||||
evidence_role: str | None = Query(default=None, pattern="^(false_positive|false_negative)$"),
|
||||
decision: str | None = Query(default=None, max_length=64),
|
||||
reviewed: bool | None = Query(default=None),
|
||||
limit: int = Query(default=50, ge=1, le=200),
|
||||
offset: int = Query(default=0, ge=0),
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict:
|
||||
return envelope(
|
||||
DetectionReviewService.list_reviews(
|
||||
db,
|
||||
project_id=project_id,
|
||||
quality_check_id=quality_check_id,
|
||||
evidence_role=evidence_role,
|
||||
decision=decision,
|
||||
reviewed=reviewed,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).model_dump()
|
||||
)
|
||||
|
||||
|
||||
@router.post("/quality-checks/{quality_check_id}/reviews", response_model=dict)
|
||||
def upsert_detection_review(
|
||||
project_id: UUID,
|
||||
quality_check_id: UUID,
|
||||
payload: DetectionReviewUpsert,
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict:
|
||||
return envelope(
|
||||
DetectionReviewService.upsert_review(
|
||||
db,
|
||||
project_id=project_id,
|
||||
quality_check_id=quality_check_id,
|
||||
payload=payload,
|
||||
).model_dump()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user