feat: évaluation force probante dossier + seuils qualité relaxés pour dossiers faibles

Score 0-10 basé sur les preuves objectives (bio/img/trt/actes).
Dossier faible (score < 3) : prompt LLM adapté + seuil adversarial
abaissé (score 2-3 → Tier B au lieu de C). Les éléments contextuels
(âge, IMC, urgence) restent dans le prompt mais hors du scoring car
ils ne constituent pas des preuves opposables à un contrôleur CPAM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dom
2026-02-23 09:19:43 +01:00
parent 1844d1be7e
commit d192af74ec
4 changed files with 266 additions and 3 deletions

View File

@@ -439,17 +439,24 @@ def _assess_quality_tier(
grounding_warnings: list[str],
code_warnings: list[str],
adversarial_result: dict | None,
is_weak_dossier: bool = False,
) -> tuple[str, bool, list[str]]:
"""Évalue le tier qualité (A/B/C) et le flag requires_review.
Classification :
- Tier C (requires_review=True) :
score adversarial < 4 OU code_warnings > 0 OU grounding_warnings > 2
(si dossier faible : seuil adversarial abaissé à < 2)
- Tier B :
score adversarial 4-6 OU ref_warnings > 0 OU grounding_warnings 1-2
(si dossier faible : score 2-3 accepté en B)
- Tier A :
score adversarial >= 7, 0 warning critique, <= 1 warning mineur
Args:
is_weak_dossier: Si True, relaxe les seuils adversariaux car un score bas
est attendu quand le dossier manque d'éléments probants.
Returns:
(tier, requires_review, categorized_warnings)
"""
@@ -458,14 +465,24 @@ def _assess_quality_tier(
has_critical = False
minor_count = 0
# Seuil adversarial adapté à la force du dossier
score_critical_threshold = 2 if is_weak_dossier else 4
# --- Warnings critiques ---
for w in code_warnings:
categorized.append(f"[CRITIQUE] {w}")
has_critical = True
if score != -1 and score <= 3:
if score != -1 and score < score_critical_threshold:
categorized.append(f"[CRITIQUE] Score adversarial très bas : {score}/10")
has_critical = True
elif score != -1 and score <= 3 and is_weak_dossier:
# Score 2-3 sur dossier faible → warning mineur (pas critique)
categorized.append(
f"[MINEUR] Score adversarial bas ({score}/10) — "
f"attendu pour un dossier à preuves limitées"
)
minor_count += 1
if len(grounding_warnings) > 2:
for w in grounding_warnings:
@@ -492,7 +509,7 @@ def _assess_quality_tier(
minor_count += 1
# --- Classification ---
if has_critical or (score != -1 and score < 4):
if has_critical or (score != -1 and score < score_critical_threshold):
tier = "C"
requires_review = True
elif minor_count > 0 or (score != -1 and 4 <= score <= 6):