# process-intelligence-solutions/pm4py architecture

> Architecture diagram of the GitHub repository process-intelligence-solutions/pm4py, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/process-intelligence-solutions/pm4py
- Repository: https://github.com/process-intelligence-solutions/pm4py

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User Interface"
        UI1["Jupyter Notebooks & Examples"]:::blue
        UI2["CLI (pm4py/cli.py)"]:::blue
    end

    subgraph "API Layer"
        Read["read.py"]:::blue
        Convert["convert.py"]:::blue
        DiscoveryAPI["discovery.py"]:::blue
        ConformanceAPI["conformance.py"]:::blue
        FilteringAPI["filtering.py"]:::blue
        SimulationAPI["simulation.py"]:::blue
        VisualizationAPI["visualization.py"]:::blue
        CLIAPI["cli.py"]:::blue
        LLM["llm.py"]:::blue
    end

    subgraph "Algorithm Layer"
        Algo["pm4py/algo/*"]:::green
    end

    subgraph "Data Model Layer"
        DataModel["pm4py/objects/*"]:::orange
    end

    subgraph "Visualization Layer"
        Viz["pm4py/visualization/*"]:::purple
    end

    subgraph "Streaming & Connector Layer"
        Streaming["pm4py/streaming/*"]:::teal
        Connectors["connectors.py"]:::teal
    end

    subgraph "Utilities & External Deps"
        Util["pm4py/util/*"]:::gray
        ThirdParty["third_party/*"]:::gray
    end

    subgraph "CI & Testing"
        GH[".github/workflows/*"]:::red
        Docker["Dockerfile"]:::red
        Tests["tests/*"]:::red
    end

    UI1 -->|imports| Read
    UI1 -->|uses| Convert
    UI1 -->|runs| DiscoveryAPI
    UI2 -->|invokes| CLIAPI

    Read -->|produces| DataModel
    Convert -->|transforms| DataModel
    DiscoveryAPI -->|calls| Algo
    ConformanceAPI -->|calls| Algo
    FilteringAPI -->|calls| Algo
    SimulationAPI -->|calls| Algo
    LLM -->|streams to| Streaming
    CLIAPI -->|orchestrates| Streaming

    Streaming -->|streams| Algo
    Connectors -->|ingests| DataModel

    Algo -->|consumes| DataModel
    DataModel -->|provides| Algo
    Algo -->|produces| Viz

    Util -.->|shared utils| Read
    Util -.->|shared utils| Algo
    Util -.->|shared utils| DataModel
    Util -.->|shared utils| Viz
    Util -.->|shared utils| Streaming

    ThirdParty -.->|external libs| Util

    GH -.->|CI build/test| Read
    GH -.->|CI build/test| Algo
    GH -.->|CI build/test| DataModel
    Docker -.->|container| Read
    Docker -.->|container| Algo
    Tests -.->|tests all| Read
    Tests -.->|tests all| Algo

    classDef blue fill:#cce5ff,stroke:#0066cc,color:#000;
    classDef green fill:#d4edda,stroke:#228B22,color:#000;
    classDef orange fill:#fff3cd,stroke:#e0a800,color:#000;
    classDef purple fill:#e2d6f3,stroke:#800080,color:#000;
    classDef teal fill:#d1ecf1,stroke:#20c997,color:#000;
    classDef gray fill:#f2f2f2,stroke:#6c757d,color:#000;
    classDef red fill:#f8d7da,stroke:#dc3545,color:#000;

    click Read "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/read.py"
    click Convert "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/convert.py"
    click DiscoveryAPI "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/discovery.py"
    click ConformanceAPI "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/conformance.py"
    click FilteringAPI "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/filtering.py"
    click SimulationAPI "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/simulation.py"
    click VisualizationAPI "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/visualization.py"
    click CLIAPI "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/cli.py"
    click LLM "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/llm.py"
    click Algo "https://github.com/process-intelligence-solutions/pm4py/tree/release/pm4py/algo/"
    click DataModel "https://github.com/process-intelligence-solutions/pm4py/tree/release/pm4py/objects/"
    click Viz "https://github.com/process-intelligence-solutions/pm4py/tree/release/pm4py/visualization/"
    click Streaming "https://github.com/process-intelligence-solutions/pm4py/tree/release/pm4py/streaming/"
    click Connectors "https://github.com/process-intelligence-solutions/pm4py/blob/release/pm4py/connectors.py"
    click Util "https://github.com/process-intelligence-solutions/pm4py/tree/release/pm4py/util/"
    click ThirdParty "https://github.com/process-intelligence-solutions/pm4py/tree/release/third_party/"
    click GH "https://github.com/process-intelligence-solutions/pm4py/tree/release/.github/workflows/"
    click Docker "https://github.com/process-intelligence-solutions/pm4py/tree/release/Dockerfile"
    click Tests "https://github.com/process-intelligence-solutions/pm4py/tree/release/tests/"
```
