mddrt


Namemddrt JSON
Version 0.0.8 PyPI version JSON
download
home_pageNone
SummaryPackage for Multi-Dimension Directly Rooted Trees visualization
upload_time2024-08-30 13:53:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Nicolás Abarca Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://www.graphviz.org).


# Installation
This package runs under Python 3.9+, use [pip](https://pip.pypa.io/en/stable/) to install.
```sh
pip install mddrt
```
To render and save generated diagrams, you will also need to install [Graphviz](https://www.graphviz.org)

# Quickstart

### Format event log
Using `mddrt.log_formatter` you can format your own initial event log with the corresponding column names based on [pm4py](https://pm4py.fit.fraunhofer.de) standard way of naming logs columns.

The format dictionary to pass as argument to this function needs to have the following structure:
```py
{
    "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.

```py
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

```py
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 
```py
grouped_drt = mddrt.group_drt_activities(drt)
```

### Get the DRT diagram string representation
```py
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.

```py
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

```py
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](https://github.com/nicoabarca/mddrt/blob/main/examples) to see the package being used to visualize an event log of a mining process.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mddrt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ba/2a/0a2ed8c66dda629cd710fb9fb0a93509ca418a0cd8f7e8ee8f25528ffce2/mddrt-0.0.8.tar.gz",
    "platform": null,
    "description": "# Multi-Dimensional DRT Visualizer\nThis 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](https://www.graphviz.org).\n\n\n# Installation\nThis package runs under Python 3.9+, use [pip](https://pip.pypa.io/en/stable/) to install.\n```sh\npip install mddrt\n```\nTo render and save generated diagrams, you will also need to install [Graphviz](https://www.graphviz.org)\n\n# Quickstart\n\n### Format event log\nUsing `mddrt.log_formatter` you can format your own initial event log with the corresponding column names based on [pm4py](https://pm4py.fit.fraunhofer.de) standard way of naming logs columns.\n\nThe format dictionary to pass as argument to this function needs to have the following structure:\n```py\n{\n    \"case:concept:name\": <Case Id>, # required\n    \"concept:name\": <Activity Id>, # required\n    \"time:timestamp\": <Timestamp>, # required\n    \"start_timestamp\": <Start Timestamp>, # optional\n    \"org:resource\": <Resource>, # optional\n    \"cost:total\": <Cost>, # optional\n}\n```\n\nEach 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.\n\n```py\nimport mddrt\nimport pandas as pd\n\nraw_event_log = pd.read_csv(\"raw_event_log.csv\")\n\nformat_dictionary = {\n    \"case:concept:name\": \"Case ID\",\n    \"concept:name\": \"Activity\",\n    \"time:timestamp\": \"Complete\",\n    \"start_timestamp\": \"Start\",\n    \"org:resource\": \"Resource\",\n    \"cost:total\": \"Cost\",\n}\n\nevent_log = mddrt.log_formatter(raw_event_log, format_dictionary)\n\n```\n### Discover Multi-Dimensional DRT\n\n```py\ndrt = mddrt.discover_multi_dimensional_drt(\n    event_log,\n    calculate_cost=True,\n    calculate_time=True,\n    calculate_flexibility=True,\n    calculate_quality=True,\n    group_activities=False,\n)\n```\n\n### Automatic group of activities \n```py\ngrouped_drt = mddrt.group_drt_activities(drt)\n```\n\n### Get the DRT diagram string representation\n```py\nmddrt_string = mpdfg.get_multi_dimension_drt_string(\n    multi_dimensional_drt,\n    visualize_time=True,\n    visualize_cost=True,\n    visualize_quality=True,\n    visualize_flexibility=True\n)\n```\n\n### View the generated DRT diagram\nAllows the user to view the diagram in interactive Python environments like Jupyter and Google Colab.\n\n```py\nmpdfg.view_multi_dimensional_drt(\n    multi_dimensional_drt\n    visualize_time=True,\n    visualize_cost=True,\n    visualize_quality=True,\n    visualize_flexibility=True,\n    node_measures=[\"total\"], # accepts also \"consumed\" and \"remaining\"\n    arc_measures=[], # accepts \"avg\", \"min\" and \"max\", or you can keep this argument empty\n    format=\"svg\" # Format value should be a valid image extension like 'jpg', 'png', 'jpeq' or 'webp\n)\n```\n> **WARNING**\n> Not all output file formats of Graphviz are available to display in environments like Jupyter Notebook or Google Colab.\n\n### Save the generated DRT diagram\n\n```py\nmpdfg.save_vis_multi_dimensional_drt(\n    multi_dimensional_drt\n    file_path=\"diagram\",\n    visualize_time=True,\n    visualize_cost=True,\n    visualize_quality=True,\n    visualize_flexibility=True,\n    node_measures=[\"total\"], # accepts also \"consumed\" and \"remaining\"\n    arc_measures=[], # accepts \"avg\", \"min\" and \"max\", or you can keep this argument empty\n    format=\"svg\", # or pdf, webp, svg, etc.\n)\n```\n\n# Examples\n\nCheckout [Examples](https://github.com/nicoabarca/mddrt/blob/main/examples) to see the package being used to visualize an event log of a mining process.",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Nicol\u00e1s Abarca  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Package for Multi-Dimension Directly Rooted Trees visualization",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/nicoabarca/mddrt",
        "Issues": "https://github.com/nicoabarca/mddrt/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "99d179771693c5783a2a97174e7c2056112fa101a8678b5b59d0e6e584a83b1d",
                "md5": "07f5f936bdddbb26e2c5d1739dcff2a1",
                "sha256": "3da0ba02d3658a3880b3b0880ece734894a99469f1acb45fe2f00073f1317e6e"
            },
            "downloads": -1,
            "filename": "mddrt-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07f5f936bdddbb26e2c5d1739dcff2a1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 22035,
            "upload_time": "2024-08-30T13:53:34",
            "upload_time_iso_8601": "2024-08-30T13:53:34.379544Z",
            "url": "https://files.pythonhosted.org/packages/99/d1/79771693c5783a2a97174e7c2056112fa101a8678b5b59d0e6e584a83b1d/mddrt-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba2a0a2ed8c66dda629cd710fb9fb0a93509ca418a0cd8f7e8ee8f25528ffce2",
                "md5": "36245a34483209518b54c4f27301a896",
                "sha256": "6937e91651b90425fe3bcecd66c9e0cc9cd234f13b2465d5dd75481abe905e7f"
            },
            "downloads": -1,
            "filename": "mddrt-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "36245a34483209518b54c4f27301a896",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11146945,
            "upload_time": "2024-08-30T13:53:38",
            "upload_time_iso_8601": "2024-08-30T13:53:38.299402Z",
            "url": "https://files.pythonhosted.org/packages/ba/2a/0a2ed8c66dda629cd710fb9fb0a93509ca418a0cd8f7e8ee8f25528ffce2/mddrt-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-30 13:53:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nicoabarca",
    "github_project": "mddrt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "mddrt"
}
        
Elapsed time: 0.47804s