Skip to main content

PM4Py loaders for Scope OCPT and OCPN JSON exports

Project description

scope-pm4py

Small Python adapter package for loading Scope OCPT and OCPN JSON exports into PM4Py runtime objects.

Install locally

From this directory:

python -m pip install -e .

Usage

from scope_pm4py import load_ocpt, load_ocpn
import pm4py

tree = load_ocpt(r"C:\Users\Postb\Downloads\scope_ocpt_example_pm4py.json")
pm4py.view_process_tree(tree)

ocpn = load_ocpn(r"C:\Users\Postb\Downloads\scope_ocpn_example_pm4py.json")
pm4py.view_ocpn(ocpn, format="svg")

Expected JSON

The loader accepts files with a top-level payload object or files where the payload is the top-level object.

OCPT exports should contain:

{
  "schema": "scope.pm4py.ocpt",
  "schema_version": "1.0.0",
  "payload": {
    "tree": {
      "type": "operator",
      "operator": "sequence",
      "children": [
        { "type": "activity", "label": "Create Order" },
        { "type": "tau" }
      ]
    }
  }
}

OCPN exports should contain:

{
  "schema": "scope.pm4py.ocpn",
  "schema_version": "1.0.0",
  "payload": {
    "object_types": ["order"],
    "activities": ["Create Order"],
    "petri_nets": {
      "order": {
        "places": [
          { "id": "p1", "name": "source", "initial": true },
          { "id": "p2", "name": "sink", "final": true }
        ],
        "transitions": [
          { "id": "t1", "name": "Create Order", "label": "Create Order" }
        ],
        "arcs": [
          { "source": "p1", "target": "t1" },
          { "source": "t1", "target": "p2" }
        ]
      }
    }
  }
}

The OCPN loader reconstructs PM4Py PetriNet and Marking objects. A plain json.load() result is not enough for PM4Py visualization and analysis.

Build

From this directory:

python -m pip install build
python -m build

This creates:

dist/
  scope_pm4py-0.1.0-py3-none-any.whl
  scope_pm4py-0.1.0.tar.gz

Publish to PyPI

Create accounts on:

Create an API token in the account settings. Then install Twine:

python -m pip install twine

Validate the build artifacts:

python -m twine check dist/*

Upload to TestPyPI first:

python -m twine upload --repository testpypi dist/*

Install from TestPyPI in a clean environment:

python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ scope-pm4py

If that works, upload to the real PyPI:

python -m twine upload dist/*

After publishing, users install it with:

python -m pip install scope-pm4py

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

scope_pm4py-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scope_pm4py-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file scope_pm4py-0.1.0.tar.gz.

File metadata

  • Download URL: scope_pm4py-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for scope_pm4py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2f8f63a2c98fdcacf62508fdd070b16e452f1d51d306cf067044697321dea5d
MD5 f525fd939ebd3a36dab1ff638e69ba84
BLAKE2b-256 200a4a326975de6b251ee9ca7a783f2f0fdba286e070307d74b56d7161e0f0d9

See more details on using hashes here.

File details

Details for the file scope_pm4py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scope_pm4py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for scope_pm4py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2386649cc02cc2bb0a89d89ed1c8cb187c5b4001252d9473e35ae7b52d9869a3
MD5 9e212452f942b2be8f8f30efb7ec4ffb
BLAKE2b-256 452e7b790109bbc4cc60c13adf5a0ac1a5a9ce0d2d77a05a880d1321c03b7f08

See more details on using hashes here.

Supported by

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