Fix FP résiduels (Glyc, VIDER, FORTE) + rétrécissement rectangles masquage
- Ajout glyc, glycosurie, vider, forte aux stop words médicaux - Shrink horizontal de 1.5px sur les rectangles raster pour éviter le débordement sur le texte adjacent (issue rectangles trop larges) - Batch 10 OGC : 21 OK, 0 PII résiduel, 0 FP Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -339,6 +339,8 @@ _MEDICAL_STOP_WORDS_SET = {
|
|||||||
"evolution", "évolution", "explorations", "fermeture", "allergie", "allergies",
|
"evolution", "évolution", "explorations", "fermeture", "allergie", "allergies",
|
||||||
"lotissement", "cholangiographie", "cholecystectomie", "cholécystectomie",
|
"lotissement", "cholangiographie", "cholecystectomie", "cholécystectomie",
|
||||||
"paracetamol", "paracétamol", "unité", "unite",
|
"paracetamol", "paracétamol", "unité", "unite",
|
||||||
|
# FP résiduels batch 10 OGC (termes médicaux/instructions soins)
|
||||||
|
"glyc", "glycosurie", "vider", "forte",
|
||||||
}
|
}
|
||||||
# Enrichissement automatique avec les ~4000 noms de médicaments d'edsnlp
|
# Enrichissement automatique avec les ~4000 noms de médicaments d'edsnlp
|
||||||
_MEDICAL_STOP_WORDS_SET.update(_load_edsnlp_drug_names())
|
_MEDICAL_STOP_WORDS_SET.update(_load_edsnlp_drug_names())
|
||||||
@@ -1484,7 +1486,14 @@ def redact_pdf_raster(original_pdf: Path, audit: List[PiiHit], out_pdf: Path, dp
|
|||||||
img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
|
img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
for r in all_rects.get(pno, []):
|
for r in all_rects.get(pno, []):
|
||||||
draw.rectangle([r.x0 * zoom, r.y0 * zoom, r.x1 * zoom, r.y1 * zoom], fill=(0, 0, 0))
|
# Rétrécir légèrement les rectangles pour éviter le débordement sur le texte adjacent
|
||||||
|
shrink = 1.5 # pixels à retirer de chaque côté
|
||||||
|
x0 = r.x0 * zoom + shrink
|
||||||
|
y0 = r.y0 * zoom
|
||||||
|
x1 = r.x1 * zoom - shrink
|
||||||
|
y1 = r.y1 * zoom
|
||||||
|
if x1 > x0:
|
||||||
|
draw.rectangle([x0, y0, x1, y1], fill=(0, 0, 0))
|
||||||
# Incrustation OGC en haut à droite
|
# Incrustation OGC en haut à droite
|
||||||
if ogc_label:
|
if ogc_label:
|
||||||
from PIL import ImageFont
|
from PIL import ImageFont
|
||||||
|
|||||||
Reference in New Issue
Block a user