Skip to main content

Package for Multi-Dimension Directly Rooted Trees visualization

Project description

Multi-Dimensional DRT Visualizer

This Python package allows users to visualize Directed Rooted Trees (DRTs) that represent various dimensions of data derived from event logs. It provides tools to create graphical representations of these multi-dimensional trees, enabling deeper insights into process behaviors and relationships. The diagrams are generated via Graphviz.

Installation

This package runs under Python 3.9+, use pip to install.

pip install mddrt

To render and save generated diagrams, you will also need to install Graphviz

Quickstart

Format event log

Using mddrt.log_formatter you can format your own initial event log with the corresponding column names based on pm4py standard way of naming logs columns.

The format dictionary to pass as argument to this function needs to have the following structure:

{
    "case:concept:name": <Case Id>, # required
    "concept:name": <Activity Id>, # required
    "time:timestamp": <Timestamp>, # required
    "start_timestamp": <Start Timestamp>, # optional
    "org:resource": <Resource>, # optional
    "cost:total": <Cost>, # optional
}

Each value of the dictionary needs to match the corresponding column name of the initial event log. If start_timestamp, org:resource and cost:total are not present in your event log, you can leave its values as blank strings.

import mddrt
import pandas as pd

raw_event_log = pd.read_csv("raw_event_log.csv")

format_dictionary = {
    "case:concept:name": "Case ID",
    "concept:name": "Activity",
    "time:timestamp": "Complete",
    "start_timestamp": "Start",
    "org:resource": "Resource",
    "cost:total": "Cost",
}

event_log = mddrt.log_formatter(raw_event_log, format_dictionary)

Discover Multi-Dimensional DRT

drt = mddrt.discover_multi_dimensional_drt(
    event_log,
    calculate_cost=True,
    calculate_time=True,
    calculate_flexibility=True,
    calculate_quality=True,
    group_activities=False,
)

Automatic group of activities

grouped_drt = mddrt.group_drt_activities(drt)

Get the DRT diagram string representation

mddrt_string = mpdfg.get_multi_dimension_drt_string(
    multi_dimensional_drt,
    visualize_time=True,
    visualize_cost=True,
    visualize_quality=True,
    visualize_flexibility=True
)

View the generated DRT diagram

Allows the user to view the diagram in interactive Python environments like Jupyter and Google Colab.

mpdfg.view_multi_dimensional_drt(
    multi_dimensional_drt
    visualize_time=True,
    visualize_cost=True,
    visualize_quality=True,
    visualize_flexibility=True,
    node_measures=["total"], # accepts also "consumed" and "remaining"
    arc_measures=[], # accepts "avg", "min" and "max", or you can keep this argument empty
    format="svg" # Format value should be a valid image extension like 'jpg', 'png', 'jpeq' or 'webp
)

WARNING Not all output file formats of Graphviz are available to display in environments like Jupyter Notebook or Google Colab.

Save the generated DRT diagram

mpdfg.save_vis_multi_dimensional_drt(
    multi_dimensional_drt
    file_path="diagram",
    visualize_time=True,
    visualize_cost=True,
    visualize_quality=True,
    visualize_flexibility=True,
    node_measures=["total"], # accepts also "consumed" and "remaining"
    arc_measures=[], # accepts "avg", "min" and "max", or you can keep this argument empty
    format="svg", # or pdf, webp, svg, etc.
)

Examples

Checkout Examples to see the package being used to visualize an event log of a mining process.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mddrt-0.0.7.tar.gz (11.0 MB view hashes)

Uploaded Source

Built Distribution

mddrt-0.0.7-py3-none-any.whl (22.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page