fix(dashboard): diagrammes BPMN/DFG grande taille (DPI 150, layout vertical)
Some checks failed
security-audit / Bandit (scan statique) (push) Successful in 12s
security-audit / pip-audit (CVE dépendances) (push) Successful in 10s
security-audit / Scan secrets (grep) (push) Successful in 8s
tests / Lint (ruff + black) (push) Successful in 14s
tests / Tests unitaires (sans GPU) (push) Failing after 14s
tests / Tests sécurité (critique) (push) Has been skipped

Les images générées par PM4Py étaient trop petites et illisibles.
- DPI 150, taille 40x20 pouces, layout vertical (TB)
- La modale plein écran permet le défilement (scroll)
- Fallback sur pm4py.save_vis si le rendu Graphviz échoue

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-20 18:29:49 +02:00
parent 6a2248ddcd
commit bc21b27da7
2 changed files with 34 additions and 12 deletions

View File

@@ -391,25 +391,47 @@ def discover_bpmn(
bpmn_exporter.apply(bpmn_model, bpmn_xml_path) bpmn_exporter.apply(bpmn_model, bpmn_xml_path)
logger.info("BPMN XML exporte : %s", bpmn_xml_path) logger.info("BPMN XML exporte : %s", bpmn_xml_path)
# Export image BPMN (PNG) # Export image BPMN (PNG) — grande taille pour lisibilité
bpmn_image_path = str(out / f"{name}_bpmn.png") bpmn_image_path = str(out / f"{name}_bpmn.png")
try: try:
pm4py.save_vis_bpmn(bpmn_model, bpmn_image_path) from pm4py.visualization.bpmn import visualizer as bpmn_vis
gviz = bpmn_vis.apply(bpmn_model, parameters={
"rankdir": "TB",
"font_size": "12",
})
gviz.graph_attr["dpi"] = "150"
gviz.graph_attr["size"] = "40,20!"
gviz.graph_attr["rankdir"] = "TB"
gviz.render(filename=bpmn_image_path.replace(".png", ""), format="png", cleanup=True)
logger.info("BPMN PNG exporte : %s", bpmn_image_path) logger.info("BPMN PNG exporte : %s", bpmn_image_path)
except Exception as e: except Exception as e:
logger.warning("Impossible de generer l'image BPMN : %s", e) logger.warning("BPMN image fallback : %s", e)
try:
pm4py.save_vis_bpmn(bpmn_model, bpmn_image_path)
except Exception:
bpmn_image_path = None bpmn_image_path = None
# DFG (Directly-Follows Graph) avec performance # DFG (Directly-Follows Graph) — grande taille
dfg_image_path = str(out / f"{name}_dfg.png") dfg_image_path = str(out / f"{name}_dfg.png")
try: try:
pm4py.save_vis_dfg( from pm4py.visualization.dfg import visualizer as dfg_vis
*pm4py.discover_dfg(event_log_df), dfg, sa, ea = pm4py.discover_dfg(event_log_df)
file_path=dfg_image_path, gviz = dfg_vis.apply(dfg, activities_count=sa, parameters={
) "start_activities": sa,
"end_activities": ea,
"rankdir": "TB",
"font_size": "11",
})
gviz.graph_attr["dpi"] = "150"
gviz.graph_attr["size"] = "40,20!"
gviz.graph_attr["rankdir"] = "TB"
gviz.render(filename=dfg_image_path.replace(".png", ""), format="png", cleanup=True)
logger.info("DFG PNG exporte : %s", dfg_image_path) logger.info("DFG PNG exporte : %s", dfg_image_path)
except Exception as e: except Exception as e:
logger.warning("Impossible de generer le DFG : %s", e) logger.warning("DFG image fallback : %s", e)
try:
pm4py.save_vis_dfg(*pm4py.discover_dfg(event_log_df), file_path=dfg_image_path)
except Exception:
dfg_image_path = None dfg_image_path = None
# Petri net via Inductive Miner (pour visualisation alternative) # Petri net via Inductive Miner (pour visualisation alternative)

View File

@@ -230,7 +230,7 @@
<!-- Modale plein écran --> <!-- Modale plein écran -->
<div id="fullscreenModal" onclick="closeFullscreen()" style="display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.95); z-index:9999; cursor:zoom-out; overflow:auto;"> <div id="fullscreenModal" onclick="closeFullscreen()" style="display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.95); z-index:9999; cursor:zoom-out; overflow:auto;">
<div style="position:absolute; top:10px; right:20px; color:white; font-size:24px; cursor:pointer; z-index:10000;">✕ Fermer</div> <div style="position:absolute; top:10px; right:20px; color:white; font-size:24px; cursor:pointer; z-index:10000;">✕ Fermer</div>
<img id="fullscreenImg" src="" style="display:block; margin:20px auto; max-width:95vw; max-height:95vh; object-fit:contain;" /> <img id="fullscreenImg" src="" style="display:block; margin:20px auto; max-width:none; cursor:grab;" />
</div> </div>
</div> </div>