How process-intelligence-solutions/pm4py works
Project Type and Purpose
• PM4Py is an open-source, monolithic Python library for process mining. It offers a rich API (via pm4py/*.py entrypoints) exposing functionality for reading logs, discovering process models, conformance checking, filtering, transformation, simulation, and visualization.
High-Level File Structure
• Top-level:
• setup.py, Dockerfile, GitHub Actions (/.github/workflows/) – build & CI
• README.md, CHANGELOG.md, LICENSE – meta
• requirements*.txt, third_party/ – external dependencies and licenses
• docs/, examples/, notebooks/ – user guides & demos
• tests/ – automated tests
• Core package (pm4py/):
• pm4py/*.py – CLI and high-level entrypoints (read, convert, discovery, filtering, conformance, etc.)
• pm4py/algo/ – algorithm implementations, organized by category (discovery, conformance, evaluation, filtering, simulation, streaming, etc.)
• pm4py/objects/ – data models (Event Logs, DFGs, Petri Nets, Process Trees, OCEL, etc.)
• pm4py/visualization/ – visualizers for various models
• pm4py/streaming/ – streaming versions of discovery & conformance
• pm4py/connectors.py, pm4py/cli.py – connectors & command-line interface
• pm4py/util/ – shared utilities (parsers, LP solvers, ML helpers)
Key Architectural Layers & Components
a. API Layer (Entry Points)
• Modules: pm4py/read.py, convert.py, discovery.py, conformance.py, filtering.py, simulation.py, visualization.py, llm.py, cli.py
• Role: expose user-friendly functions to import logs, run algorithms, convert models, and render results
b. Algorithm Layer
• pm4py/algo/* subdivisions:
• discovery/…
• conformance/…
• filtering/…
• transformation/…
• simulation/…
• evaluation/…
• anonymization, clustering, decision_mining, etc.
• Role: implement core process-mining algorithms
c. Data Model Layer
• pm4py/objects/*: defines in-memory representations for logs, Petri nets, DFGs, process trees, OCEL, etc.
• Role: provide uniform object interfaces consumed by algorithms and visualizers
d. Visualization Layer
• pm4py/visualization/*: graph renderers for nets, DFGs, footprints, BPMN, OCEL, etc.
• Role: turn model objects into visual outputs (SVG, Graphviz, HTML)
e. Streaming & Connector Layer
• pm4py/streaming/* & pm4py/connectors.py: support live data streams and external systems (CSV, XES, databases, LLM backends)
f. Utilities & External Dependencies
• pm4py/util/* and third_party/: common utilities and external libraries (numpy, pandas, networkx, graphviz, scipy, etc.)
Relationships & Data Flow
• User code / CLI / notebooks → calls API Layer → delegates to Algorithm Layer → consumes Data Model Layer → returns model instances → passes to Visualization Layer or back to user
• Streaming Layer operates similarly but with continuous data input → Algorithm Layer (streaming) → incremental results
• Connectors translate external sources (files, DB, LLMs) into PM4Py Data Models