feat: split author/admin detect views and add case matching KPI basis
월례회의 자료(2026-09-18) p.7 파이프라인의 3단계 「저자 화면에는 케이스 코드를 노출하지 않는다」를 구현하고, 후속 합의에 필요한 문서를 함께 남긴다. - DetectOptions.audience(admin 기본 / author). author 직렬화에서 case_id, case_candidates, tags, legal_risk, is_infringement 을 제외하고 ccl_basis 를 코드 없는 문장으로 대체한다. 일치 위치와 점수는 유지한다. - is_infringement 는 필수 bool 로 둔다. run_precision_eval.py 등 소비자가 bool 로 읽으므로 선택 필드로 두면 None 이 조용히 흘러간다. 제외는 직렬화에서만 한다. - publication_verdict 필드 추가. 컴북스 코드표 미확보이므로 39건 전부 null 이며 null 을 출간 허용으로 해석하지 않는다. enum 과 대표값 선정은 코드표 수령 후. - request_id / taxonomy_version 을 응답에 싣는다. 관리자 확정 로그와 연결된다. - engine_version 기본값을 2.2.1-cases-v1.3 으로 맞춘다. 직전 값(2.0.1)이 King 운영값 2.2.0-persistent-cpu 보다 낮아 성적서 대조 시 뒤집혀 보였다. 케이스 정의는 39건(A 27건)을 유지한다. 회의 자료의 40건(A 28건)과 1건 차이가 있으나 아카이빙 DB v2.3 원본을 받기 전까지 추측해 채우지 않는다. 7,786편 운영 재검사는 모집단 불일치(현재 6,343건)로 중단했고 부분 실행은 집계하지 않는다. 별도 평가셋 재측정은 기존 testset_v2 수치(precision 98.4032%)를 그대로 재현했으며 새 독립 시험 결과가 아니다. 상세는 reports/CASE_MATCHING_EVAL_*.json. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
52a0fdcdf0
commit
b73d27a850
12 files changed
+574
-42
No files matched your search
+9
-1
@@ -81,6 +81,7 @@ async def taxonomy(request: Request) -> TaxonomyResponse:
|
||||
cases=[
|
||||
{"case_id": c.case_id, "old_no": c.old_no, "subgroup": c.subgroup,
|
||||
"handling": c.handling,
|
||||
"publication_verdict": c.publication_verdict,
|
||||
"representative_precedents": [
|
||||
{"case_id": p.case_id, "in_runtime_corpus": p.in_runtime_corpus}
|
||||
for p in c.representative_precedents
|
||||
@@ -145,6 +146,13 @@ async def copyright_review(
|
||||
if review.has_suspicion
|
||||
else "표절 의심 구간이 없습니다."
|
||||
)
|
||||
judgment_summary = legal.judgment_summary
|
||||
if req.options.audience == "author":
|
||||
legal_status, legal_label = "review_required", "확인이 필요한 부분"
|
||||
precedent_ids = []
|
||||
judgment_summary = ("일치 구간을 확인해 주세요." if review.has_suspicion
|
||||
else "등록된 비교 자료에서 일치 구간을 찾지 못했습니다.")
|
||||
suspicion_text = judgment_summary
|
||||
return CopyrightReviewResponse(
|
||||
doc_id=result.doc_id,
|
||||
copyright=CopyrightScoreCard(
|
||||
@@ -168,7 +176,7 @@ async def copyright_review(
|
||||
legal_judgment=CopyrightLegalJudgment(
|
||||
status=legal_status,
|
||||
label=legal_label,
|
||||
summary=legal.judgment_summary,
|
||||
summary=judgment_summary,
|
||||
precedent_ids=precedent_ids,
|
||||
),
|
||||
analyzed_at=result.analyzed_at,
|
||||
|
||||
+28
-1
@@ -2,8 +2,9 @@ from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
from uuid import uuid4
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, model_serializer
|
||||
|
||||
# 법령 기반 10종 메타 태그 (PDF IV장)
|
||||
LegalTag = Literal[
|
||||
@@ -47,6 +48,7 @@ class DocumentMetadata(BaseModel):
|
||||
|
||||
|
||||
class DetectOptions(BaseModel):
|
||||
audience: Literal["admin", "author"] = "admin"
|
||||
return_evidence: bool = True
|
||||
threshold: float | None = Field(default=None, ge=0.0, le=1.0,
|
||||
description="None이면 서버 설정 사용. PDF VII-4 권장 0.85")
|
||||
@@ -124,6 +126,7 @@ class PartialPlagiarismSignal(BaseModel):
|
||||
|
||||
class CaseCandidate(BaseModel):
|
||||
"""판정된 침해 케이스 후보 1건 + v1.3 총괄표의 대표판례."""
|
||||
publication_verdict: str | None = Field(default=None, description="컴북스 확정 코드. 원본 미확보 시 null; 출간 허용을 뜻하지 않음.")
|
||||
case_id: str
|
||||
title: str
|
||||
handling: Literal["technical_detection", "terms_or_report"]
|
||||
@@ -138,6 +141,8 @@ class CaseCandidate(BaseModel):
|
||||
|
||||
|
||||
class MatchResult(BaseModel):
|
||||
publication_verdict: str | None = None
|
||||
publication_verdict_status: Literal["source_pending", "review_required"] = "source_pending"
|
||||
source_doc: str
|
||||
source_title: str | None = None
|
||||
similarity: float = Field(..., ge=0.0, le=1.0)
|
||||
@@ -299,7 +304,29 @@ class ReviewSummary(BaseModel):
|
||||
|
||||
|
||||
class DetectResponse(BaseModel):
|
||||
request_id: str = Field(default_factory=lambda: str(uuid4()))
|
||||
taxonomy_version: str | None = None
|
||||
audience: Literal["admin", "author"] = "admin"
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_audience(self, handler):
|
||||
data = handler(self)
|
||||
if self.audience == "author":
|
||||
# Free-form legal/LLM prose may include both case and precedent IDs.
|
||||
data.pop("legal_risk", None)
|
||||
data.pop("is_infringement", None)
|
||||
data["ccl_basis"] = ("확인이 필요한 부분이 있습니다." if self.matches
|
||||
else "등록된 비교 자료에서 일치 구간을 찾지 못했습니다.")
|
||||
for match in data.get("matches", []):
|
||||
for key in ("case_id", "case_title", "case_candidates", "tags",
|
||||
"infringement_type", "publication_verdict",
|
||||
"publication_verdict_status"):
|
||||
match.pop(key, None)
|
||||
return data
|
||||
|
||||
doc_id: str
|
||||
#: 후방호환 검출값. 항상 설정되며, 저자용 직렬화에서만 출력에서 제외된다.
|
||||
#: 소비자(run_precision_eval.py, evaluate_pairs.py 등)가 bool 로 읽으므로 필수로 둔다.
|
||||
is_infringement: bool
|
||||
confidence: float = Field(..., ge=0.0, le=1.0)
|
||||
extracted_elements: ExtractedElements
|
||||
|
||||
Reference in new issue
Block a user