feat: enrichissement contre-argumentation CPAM — libellés CIM-10, RAG ciblé, reprocess complet

- Résolution des libellés CIM-10 pour les codes contestés (dp_ucr, da_ucr, dr_ucr)
- Fallback DP depuis dp_ucr quand le pipeline n'extrait pas de diagnostic principal
- Troncature arg_ucr augmentée de 200 à 500 chars pour conserver les citations de règles
- Requête RAG 4 : définitions CIM-10 (inclusion/exclusion) des codes contestés
- Requête RAG 5 : extraction et recherche des règles nommées (RègleT7, Annexe, etc.)
- Cap résultats RAG de 10 à 12 pour absorber les nouvelles requêtes
- Reprocess viewer : pipeline complet (fusion + GHM + CPAM) pour dossiers multi-PDF
- Affichage structuré response_data dans le viewer (analyse, preuves, références)
- 7 nouveaux tests CPAM, 6 nouveaux tests viewer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dom
2026-02-17 23:24:10 +01:00
parent 94fa4e5f3b
commit bc0ccbef7c
7 changed files with 464 additions and 51 deletions

View File

@@ -165,8 +165,86 @@
</div>
{% endif %}
{# Contre-argumentation #}
{% if ctrl.contre_argumentation %}
{# Contre-argumentation structurée ou fallback texte brut #}
{% if ctrl.response_data %}
<div style="margin-bottom:0.75rem;">
<div style="font-size:0.7rem;color:#1d4ed8;text-transform:uppercase;font-weight:600;margin-bottom:0.5rem;">Contre-argumentation</div>
{% if ctrl.response_data.analyse_contestation %}
<div style="border-left:3px solid #94a3b8;padding:0.5rem 0.75rem;background:#f8fafc;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#64748b;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Analyse de la contestation</div>
{{ ctrl.response_data.analyse_contestation | format_cpam_text }}
</div>
{% endif %}
{% if ctrl.response_data.points_accord and ctrl.response_data.points_accord|lower not in ['aucun', 'non applicable', 'n/a', ''] %}
<div style="border-left:3px solid #22c55e;padding:0.5rem 0.75rem;background:#f0fdf4;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#16a34a;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Points d'accord</div>
{{ ctrl.response_data.points_accord | format_cpam_text }}
</div>
{% endif %}
{% if ctrl.response_data.contre_arguments_medicaux %}
<div style="border-left:3px solid #3b82f6;padding:0.5rem 0.75rem;background:#eff6ff;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#1d4ed8;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Contre-arguments médicaux</div>
{{ ctrl.response_data.contre_arguments_medicaux | format_cpam_text }}
</div>
{% endif %}
{% if ctrl.response_data.preuves_dossier %}
<div style="border-left:3px solid #0ea5e9;padding:0.5rem 0.75rem;background:#f0f9ff;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#0369a1;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Preuves du dossier</div>
<ul style="margin:0.3rem 0;padding-left:1.2rem;">
{% for p in ctrl.response_data.preuves_dossier %}
{% if p is mapping %}
<li style="margin-bottom:0.3rem;">
<span style="display:inline-block;padding:1px 6px;border-radius:9999px;font-size:0.7rem;font-weight:600;background:#e0f2fe;color:#0369a1;">{{ p.element or p.get('type', '') }}</span>
{{ p.valeur or '' }} <span style="color:#64748b;">&rarr; {{ p.signification or '' }}</span>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
{% if ctrl.response_data.contre_arguments_asymetrie %}
<div style="border-left:3px solid #8b5cf6;padding:0.5rem 0.75rem;background:#f5f3ff;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#7c3aed;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Asymétrie d'information</div>
{{ ctrl.response_data.contre_arguments_asymetrie | format_cpam_text }}
</div>
{% endif %}
{% if ctrl.response_data.contre_arguments_reglementaires %}
<div style="border-left:3px solid #6366f1;padding:0.5rem 0.75rem;background:#eef2ff;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#4f46e5;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Contre-arguments réglementaires</div>
{{ ctrl.response_data.contre_arguments_reglementaires | format_cpam_text }}
</div>
{% endif %}
{% if ctrl.response_data.references %}
<div style="border-left:3px solid #64748b;padding:0.5rem 0.75rem;background:#f8fafc;margin-bottom:0.5rem;font-size:0.85rem;">
<div style="font-size:0.7rem;color:#475569;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Références</div>
{% for ref in ctrl.response_data.references %}
{% if ref is mapping %}
<blockquote style="margin:0.3rem 0;padding:0.3rem 0.5rem;border-left:2px solid #cbd5e1;background:#f1f5f9;font-size:0.8rem;color:#334155;">
<strong>[{{ ref.document or '' }}{% if ref.page %}, p.{{ ref.page }}{% endif %}]</strong>
{{ ref.citation or '' }}
</blockquote>
{% elif ref is string %}
<p style="margin:0.2rem 0;font-size:0.8rem;color:#334155;">{{ ref }}</p>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if ctrl.response_data.conclusion %}
<div style="border-left:3px solid #f59e0b;padding:0.5rem 0.75rem;background:#fffbeb;margin-bottom:0.5rem;font-size:0.85rem;border:1px solid #fde68a;border-left:3px solid #f59e0b;border-radius:0.25rem;">
<div style="font-size:0.7rem;color:#b45309;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Conclusion</div>
{{ ctrl.response_data.conclusion | format_cpam_text }}
</div>
{% endif %}
</div>
{% elif ctrl.contre_argumentation %}
<div style="border-left:3px solid #3b82f6;padding:0.5rem 0.75rem;background:#eff6ff;margin-bottom:0.75rem;font-size:0.85rem;color:#1e3a5f;">
<div style="font-size:0.7rem;color:#1d4ed8;text-transform:uppercase;font-weight:600;margin-bottom:0.25rem;">Contre-argumentation</div>
<pre style="white-space:pre-wrap;font-family:inherit;margin:0;">{{ ctrl.contre_argumentation }}</pre>