feat: output miroir de input, viewer lisible, mode 100% local
- CLI accepte plusieurs chemins en entrée (nargs="*") - Un dossier patient passé directement utilise son nom comme subdir - Filtres Jinja format_dossier_name (15_23096332 → Dossier 23096332) et format_doc_name (CRO_xxx_cim10 → CRO, Trackare, Fusionné) - Sidebar : noms lisibles, fusionné mis en avant (★) - NER CamemBERT en local_files_only (aucun appel réseau) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
@@ -185,6 +186,30 @@ def severity_badge(value: str | None) -> Markup:
|
||||
)
|
||||
|
||||
|
||||
def format_dossier_name(name: str) -> str:
|
||||
"""Transforme un nom de dossier en nom lisible (ex: 15_23096332 → Dossier 23096332)."""
|
||||
if name == "racine":
|
||||
return "Non classés"
|
||||
m = re.match(r"^\d+_(\d+)$", name)
|
||||
if m:
|
||||
return f"Dossier {m.group(1)}"
|
||||
return name
|
||||
|
||||
|
||||
def format_doc_name(name: str) -> str:
|
||||
"""Transforme un nom de fichier JSON en nom lisible."""
|
||||
n = name.lower()
|
||||
if "fusionne" in n:
|
||||
return "Fusionné"
|
||||
if n.startswith("cro") or n.startswith("crh"):
|
||||
return name.split("_")[0].upper()
|
||||
if "trackare" in n:
|
||||
return "Trackare"
|
||||
if "anapath" in n:
|
||||
return "Anapath"
|
||||
return name
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# App factory
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -196,6 +221,8 @@ def create_app() -> Flask:
|
||||
app.jinja_env.filters["confidence_label"] = confidence_label
|
||||
app.jinja_env.filters["severity_badge"] = severity_badge
|
||||
app.jinja_env.filters["format_duration"] = format_duration
|
||||
app.jinja_env.filters["format_dossier_name"] = format_dossier_name
|
||||
app.jinja_env.filters["format_doc_name"] = format_doc_name
|
||||
|
||||
ccam_dict = load_ccam_dict()
|
||||
|
||||
|
||||
@@ -72,6 +72,10 @@
|
||||
background: #1e293b;
|
||||
border-left-color: #3b82f6;
|
||||
}
|
||||
.sidebar-nav a.sidebar-fusionne {
|
||||
color: #60a5fa;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Admin section */
|
||||
.sidebar-admin {
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
{% block sidebar %}
|
||||
{% for group_name, items in groups.items() %}
|
||||
<div class="group-title">{{ group_name }}</div>
|
||||
<div class="group-title">{{ group_name | format_dossier_name }}</div>
|
||||
{% for item in items %}
|
||||
<a href="/dossier/{{ item.path_rel }}">{{ item.name }}</a>
|
||||
{% if 'fusionne' in item.name %}
|
||||
<a href="/dossier/{{ item.path_rel }}" class="sidebar-fusionne">★ Fusionné</a>
|
||||
{% else %}
|
||||
<a href="/dossier/{{ item.path_rel }}">{{ item.name | format_doc_name }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
@@ -33,7 +37,7 @@
|
||||
{% endfor %}
|
||||
{% set stats = group_stats.get(group_name, {}) %}
|
||||
<h3 style="display:flex;align-items:baseline;gap:0.75rem;flex-wrap:wrap;">
|
||||
{{ group_name }}
|
||||
{{ group_name | format_dossier_name }}
|
||||
<span style="font-size:0.75rem;font-weight:400;color:#64748b;">
|
||||
{{ items|length }} fichier(s){% if ns.count %} — total : {{ ns.total|format_duration }}{% endif %}
|
||||
</span>
|
||||
@@ -60,7 +64,7 @@
|
||||
<a href="/dossier/{{ item.path_rel }}" style="text-decoration:none;color:inherit;">
|
||||
<div class="card" style="cursor:pointer;transition:box-shadow 0.15s;">
|
||||
<div style="font-weight:600;font-size:0.9rem;margin-bottom:0.4rem;color:#0f172a;">
|
||||
{{ item.name }}
|
||||
{{ item.name | format_doc_name }}
|
||||
</div>
|
||||
<div style="display:flex;flex-wrap:wrap;gap:0.3rem;margin-bottom:0.4rem;">
|
||||
{% if item.dossier.document_type %}
|
||||
|
||||
Reference in New Issue
Block a user