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
python -m pip install scope-pm4py
For local development 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")
OCPT Object-Type Projection
Scope OCPT activity nodes store object-type metadata in PM4Py process-tree node properties. You can project a loaded OCPT tree to the behavior of a single object type:
from scope_pm4py import load_ocpt, load_ocpt_for_object_type, project_ocpt_to_object_type
orders_tree = load_ocpt_for_object_type(
r"C:\Users\Postb\Downloads\scope_ocpt_example_pm4py.json",
"Orders",
)
full_tree = load_ocpt(r"C:\Users\Postb\Downloads\scope_ocpt_example_pm4py.json")
orders_tree = project_ocpt_to_object_type(full_tree, "Orders")
The projection returns a new PM4Py ProcessTree and does not mutate the input
tree. Activities are kept when the requested object type appears in
node._properties["related_object_types"]; unrelated activities are projected
to silent tau behavior and simplified where this is control-flow safe.
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 and Publish
Build the package:
python -m pip install build twine
python -m build
python -m twine check dist/*
Upload:
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scope_pm4py-0.1.1.tar.gz.
File metadata
- Download URL: scope_pm4py-0.1.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b29cb5f37347612ca2bef1587323f6956d58f9281e373d864ff352c2b703dd18
|
|
| MD5 |
01187a06fdb0f3258772e637fff93dc2
|
|
| BLAKE2b-256 |
83dda0f59d11955e16a80d077944f75d5ce57a9c6227a91a0da3aba6b935ff45
|
File details
Details for the file scope_pm4py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: scope_pm4py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9f19dfcf93c04f8e98d95ed861458b576234eec730197fe139b87f41b34cf58
|
|
| MD5 |
2fa3bf656927d3419da2e397ee8d94e3
|
|
| BLAKE2b-256 |
aedc11948c272489a6da751480092810ea7347413290f48b8f12ae2fd401be68
|