r4pm 0.3.1__cp312-cp312-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. r4pm/__init__.py +92 -0
  2. r4pm/__init__.pyi +239 -0
  3. r4pm/bindings/__init__.py +40 -0
  4. r4pm/bindings/__init__.pyi +128 -0
  5. r4pm/bindings/bindings.py +90 -0
  6. r4pm/bindings/bindings.pyi +61 -0
  7. r4pm/bindings/core/__init__.py +6 -0
  8. r4pm/bindings/core/__init__.pyi +7 -0
  9. r4pm/bindings/core/event_data/__init__.py +5 -0
  10. r4pm/bindings/core/event_data/__init__.pyi +6 -0
  11. r4pm/bindings/core/event_data/case_centric/__init__.py +5 -0
  12. r4pm/bindings/core/event_data/case_centric/__init__.pyi +6 -0
  13. r4pm/bindings/core/event_data/case_centric/utils/__init__.py +5 -0
  14. r4pm/bindings/core/event_data/case_centric/utils/__init__.pyi +6 -0
  15. r4pm/bindings/core/event_data/case_centric/utils/activity_projection.py +28 -0
  16. r4pm/bindings/core/event_data/case_centric/utils/activity_projection.pyi +21 -0
  17. r4pm/bindings/core/process_models/__init__.py +5 -0
  18. r4pm/bindings/core/process_models/__init__.pyi +6 -0
  19. r4pm/bindings/core/process_models/object_centric/__init__.py +5 -0
  20. r4pm/bindings/core/process_models/object_centric/__init__.pyi +6 -0
  21. r4pm/bindings/core/process_models/object_centric/ocdfg/__init__.py +5 -0
  22. r4pm/bindings/core/process_models/object_centric/ocdfg/__init__.pyi +6 -0
  23. r4pm/bindings/core/process_models/object_centric/ocdfg/object_centric_dfg_struct.py +27 -0
  24. r4pm/bindings/core/process_models/object_centric/ocdfg/object_centric_dfg_struct.pyi +20 -0
  25. r4pm/bindings/discovery/__init__.py +6 -0
  26. r4pm/bindings/discovery/__init__.pyi +7 -0
  27. r4pm/bindings/discovery/case_centric/__init__.py +6 -0
  28. r4pm/bindings/discovery/case_centric/__init__.pyi +7 -0
  29. r4pm/bindings/discovery/case_centric/alphappp/__init__.py +5 -0
  30. r4pm/bindings/discovery/case_centric/alphappp/__init__.pyi +6 -0
  31. r4pm/bindings/discovery/case_centric/alphappp/full.py +30 -0
  32. r4pm/bindings/discovery/case_centric/alphappp/full.pyi +21 -0
  33. r4pm/bindings/discovery/case_centric/dfg.py +27 -0
  34. r4pm/bindings/discovery/case_centric/dfg.pyi +20 -0
  35. r4pm/bindings/discovery/object_centric/__init__.py +5 -0
  36. r4pm/bindings/discovery/object_centric/__init__.pyi +6 -0
  37. r4pm/bindings/discovery/object_centric/oc_declare.py +30 -0
  38. r4pm/bindings/discovery/object_centric/oc_declare.pyi +21 -0
  39. r4pm/ocel_export.py +33 -0
  40. r4pm/ocel_import.py +72 -0
  41. r4pm/py.typed +0 -0
  42. r4pm/r4pm.cp312-win32.pyd +0 -0
  43. r4pm/xes_export.py +13 -0
  44. r4pm/xes_import.py +18 -0
  45. r4pm-0.3.1.dist-info/METADATA +183 -0
  46. r4pm-0.3.1.dist-info/RECORD +49 -0
  47. r4pm-0.3.1.dist-info/WHEEL +4 -0
  48. r4pm-0.3.1.dist-info/licenses/LICENSE-APACHE +201 -0
  49. r4pm-0.3.1.dist-info/licenses/LICENSE-MIT +21 -0
@@ -0,0 +1,6 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from .activity_projection import *
5
+
6
+ __all__: List[str]
@@ -0,0 +1,28 @@
1
+ """
2
+ Auto-generated bindings for core.event_data.case_centric.utils.activity_projection
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def log_to_activity_projection(log: str) -> str:
9
+ """
10
+ Convert an [`EventLog`] into an [`EventLogActivityProjection`]
11
+ All traces with the same activity sequence are aggregated into one trace with a frequency count
12
+
13
+ Args:
14
+ log: Registry ID for EventLog
15
+
16
+ Returns:
17
+ Registry ID for EventLogActivityProjection
18
+ """
19
+ import json
20
+ from ......r4pm import call_binding
21
+ args_dict = {}
22
+ args_dict["log"] = log
23
+ result = call_binding("process_mining::core::event_data::case_centric::utils::activity_projection::log_to_activity_projection", json.dumps(args_dict))
24
+ return json.loads(result)
25
+
26
+ __all__ = [
27
+ "log_to_activity_projection",
28
+ ]
@@ -0,0 +1,21 @@
1
+ """
2
+ Type stubs for core.event_data.case_centric.utils.activity_projection
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def log_to_activity_projection(log: str) -> str:
9
+ """
10
+ Convert an [`EventLog`] into an [`EventLogActivityProjection`]
11
+ All traces with the same activity sequence are aggregated into one trace with a frequency count
12
+
13
+ Args:
14
+ log: Registry ID for EventLog
15
+
16
+ Returns:
17
+ str
18
+ """
19
+ ...
20
+
21
+ __all__: List[str]
@@ -0,0 +1,5 @@
1
+ """Auto-generated module."""
2
+
3
+ from . import object_centric
4
+
5
+ __all__ = ["object_centric"]
@@ -0,0 +1,6 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from . import object_centric as object_centric
5
+
6
+ __all__: List[str]
@@ -0,0 +1,5 @@
1
+ """Auto-generated module."""
2
+
3
+ from . import ocdfg
4
+
5
+ __all__ = ["ocdfg"]
@@ -0,0 +1,6 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from . import ocdfg as ocdfg
5
+
6
+ __all__: List[str]
@@ -0,0 +1,5 @@
1
+ """Auto-generated module."""
2
+
3
+ from .object_centric_dfg_struct import *
4
+
5
+ __all__ = []
@@ -0,0 +1,6 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from .object_centric_dfg_struct import *
5
+
6
+ __all__: List[str]
@@ -0,0 +1,27 @@
1
+ """
2
+ Auto-generated bindings for core.process_models.object_centric.ocdfg.object_centric_dfg_struct
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_dfg_from_locel(locel: str) -> Dict[str, Any]:
9
+ """
10
+ Construct a [`OCDirectlyFollowsGraph`] from an [`IndexLinkedOCEL`]
11
+
12
+ Args:
13
+ locel: Registry ID for IndexLinkedOCEL
14
+
15
+ Returns:
16
+ Dict[str, Any]
17
+ """
18
+ import json
19
+ from ......r4pm import call_binding
20
+ args_dict = {}
21
+ args_dict["locel"] = locel
22
+ result = call_binding("process_mining::core::process_models::object_centric::ocdfg::object_centric_dfg_struct::discover_dfg_from_locel", json.dumps(args_dict))
23
+ return json.loads(result)
24
+
25
+ __all__ = [
26
+ "discover_dfg_from_locel",
27
+ ]
@@ -0,0 +1,20 @@
1
+ """
2
+ Type stubs for core.process_models.object_centric.ocdfg.object_centric_dfg_struct
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_dfg_from_locel(locel: str) -> Dict[str, Any]:
9
+ """
10
+ Construct a [`OCDirectlyFollowsGraph`] from an [`IndexLinkedOCEL`]
11
+
12
+ Args:
13
+ locel: Registry ID for IndexLinkedOCEL
14
+
15
+ Returns:
16
+ Dict[str, Any]
17
+ """
18
+ ...
19
+
20
+ __all__: List[str]
@@ -0,0 +1,6 @@
1
+ """Auto-generated module."""
2
+
3
+ from . import case_centric
4
+ from . import object_centric
5
+
6
+ __all__ = ["case_centric", "object_centric"]
@@ -0,0 +1,7 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from . import case_centric as case_centric
5
+ from . import object_centric as object_centric
6
+
7
+ __all__: List[str]
@@ -0,0 +1,6 @@
1
+ """Auto-generated module."""
2
+
3
+ from . import alphappp
4
+ from .dfg import *
5
+
6
+ __all__ = ["alphappp"]
@@ -0,0 +1,7 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from . import alphappp as alphappp
5
+ from .dfg import *
6
+
7
+ __all__: List[str]
@@ -0,0 +1,5 @@
1
+ """Auto-generated module."""
2
+
3
+ from .full import *
4
+
5
+ __all__ = []
@@ -0,0 +1,6 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from .full import *
5
+
6
+ __all__: List[str]
@@ -0,0 +1,30 @@
1
+ """
2
+ Auto-generated bindings for discovery.case_centric.alphappp.full
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_alphaplusplusplus(log_proj: str, config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
9
+ """
10
+ Discover a [`PetriNet`] using the Alpha+++ Process Discovery algorithm
11
+
12
+ Args:
13
+ log_proj: Registry ID for EventLogActivityProjection
14
+ config: Algorithm parameters for Alpha+++
15
+
16
+ Returns:
17
+ Dict[str, Any]
18
+ """
19
+ import json
20
+ from .....r4pm import call_binding
21
+ args_dict = {}
22
+ args_dict["log_proj"] = log_proj
23
+ if config is not None:
24
+ args_dict["config"] = config
25
+ result = call_binding("process_mining::discovery::case_centric::alphappp::full::alphappp_discover_petri_net", json.dumps(args_dict))
26
+ return json.loads(result)
27
+
28
+ __all__ = [
29
+ "discover_alphaplusplusplus",
30
+ ]
@@ -0,0 +1,21 @@
1
+ """
2
+ Type stubs for discovery.case_centric.alphappp.full
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_alphaplusplusplus(log_proj: str, config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
9
+ """
10
+ Discover a [`PetriNet`] using the Alpha+++ Process Discovery algorithm
11
+
12
+ Args:
13
+ log_proj: Registry ID for EventLogActivityProjection
14
+ config: Algorithm parameters for Alpha+++
15
+
16
+ Returns:
17
+ Dict[str, Any]
18
+ """
19
+ ...
20
+
21
+ __all__: List[str]
@@ -0,0 +1,27 @@
1
+ """
2
+ Auto-generated bindings for discovery.case_centric.dfg
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_dfg(event_log: str) -> Dict[str, Any]:
9
+ """
10
+ Discover [`DirectlyFollowsGraph`] with default classifier
11
+
12
+ Args:
13
+ event_log: Registry ID for EventLog
14
+
15
+ Returns:
16
+ Dict[str, Any]
17
+ """
18
+ import json
19
+ from ....r4pm import call_binding
20
+ args_dict = {}
21
+ args_dict["event_log"] = event_log
22
+ result = call_binding("process_mining::discovery::case_centric::dfg::discover_dfg", json.dumps(args_dict))
23
+ return json.loads(result)
24
+
25
+ __all__ = [
26
+ "discover_dfg",
27
+ ]
@@ -0,0 +1,20 @@
1
+ """
2
+ Type stubs for discovery.case_centric.dfg
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_dfg(event_log: str) -> Dict[str, Any]:
9
+ """
10
+ Discover [`DirectlyFollowsGraph`] with default classifier
11
+
12
+ Args:
13
+ event_log: Registry ID for EventLog
14
+
15
+ Returns:
16
+ Dict[str, Any]
17
+ """
18
+ ...
19
+
20
+ __all__: List[str]
@@ -0,0 +1,5 @@
1
+ """Auto-generated module."""
2
+
3
+ from .oc_declare import *
4
+
5
+ __all__ = []
@@ -0,0 +1,6 @@
1
+ """Type stubs."""
2
+ from typing import List
3
+
4
+ from .oc_declare import *
5
+
6
+ __all__: List[str]
@@ -0,0 +1,30 @@
1
+ """
2
+ Auto-generated bindings for discovery.object_centric.oc_declare
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_oc_declare(locel: str, options: Optional[Dict[str, Any]] = None) -> List[Any]:
9
+ """
10
+ Discover behavioral OC-DECLARE constraints
11
+
12
+ Args:
13
+ locel: Registry ID for SlimLinkedOCEL
14
+ options: Options for the automatic discovery of OC-DECLARE constraints
15
+
16
+ Returns:
17
+ List[Any]
18
+ """
19
+ import json
20
+ from ....r4pm import call_binding
21
+ args_dict = {}
22
+ args_dict["locel"] = locel
23
+ if options is not None:
24
+ args_dict["options"] = options
25
+ result = call_binding("process_mining::discovery::object_centric::oc_declare::discover_behavior_constraints", json.dumps(args_dict))
26
+ return json.loads(result)
27
+
28
+ __all__ = [
29
+ "discover_oc_declare",
30
+ ]
@@ -0,0 +1,21 @@
1
+ """
2
+ Type stubs for discovery.object_centric.oc_declare
3
+
4
+ DO NOT EDIT - Generated by build.rs
5
+ """
6
+ from typing import Any, Dict, List, Optional
7
+
8
+ def discover_oc_declare(locel: str, options: Optional[Dict[str, Any]] = None) -> List[Any]:
9
+ """
10
+ Discover behavioral OC-DECLARE constraints
11
+
12
+ Args:
13
+ locel: Registry ID for SlimLinkedOCEL
14
+ options: Options for the automatic discovery of OC-DECLARE constraints
15
+
16
+ Returns:
17
+ List[Any]
18
+ """
19
+ ...
20
+
21
+ __all__: List[str]
r4pm/ocel_export.py ADDED
@@ -0,0 +1,33 @@
1
+ import polars
2
+
3
+ from .r4pm import export_ocel_rs
4
+
5
+ def export_ocel(ocel: dict[str, polars.DataFrame], path: str):
6
+ """
7
+ Export Polars OCEL DataFrames to File
8
+
9
+ Args:
10
+ ocel: Dict of DataFrames from import_ocel_xml/json
11
+ path: Output path (e.g., .ocel.xml or .ocel.json)
12
+
13
+ """
14
+ export_ocel_rs(ocel, path)
15
+
16
+
17
+ def export_ocel_pm4py(ocel, path: str):
18
+ """
19
+ Export PM4Py OCEL to File
20
+
21
+ Args:
22
+ ocel: PM4Py OCEL object
23
+ path: Output path (e.g., .ocel.xml or .ocel.json)
24
+
25
+ """
26
+ ocel = {
27
+ "events": polars.from_pandas(ocel.events),
28
+ "objects": polars.from_pandas(ocel.objects),
29
+ "relations": polars.from_pandas(ocel.relations),
30
+ "object_changes": polars.from_pandas(ocel.object_changes),
31
+ "o2o": polars.from_pandas(ocel.o2o),
32
+ }
33
+ export_ocel_rs(ocel, path)
r4pm/ocel_import.py ADDED
@@ -0,0 +1,72 @@
1
+ import polars as pl
2
+
3
+ from .r4pm import import_ocel_xml_rs, import_ocel_json_rs, import_ocel_rs
4
+
5
+ def rs_ocel_to_pm4py(ocel_rs: dict[str, pl.DataFrame]):
6
+ """
7
+ Convert Polars OCEL DataFrames to PM4PY OCEL object.
8
+
9
+ Args:
10
+ ocel_rs: Dict of DataFrames from import_ocel_xml/json
11
+
12
+ Returns:
13
+ PM4PY OCEL object
14
+ """
15
+ import pm4py
16
+ ocel_pm4py = pm4py.ocel.OCEL(
17
+ events=ocel_rs["events"].to_pandas().convert_dtypes(),
18
+ objects=ocel_rs["objects"].to_pandas().convert_dtypes(),
19
+ relations=ocel_rs["relations"].to_pandas().convert_dtypes(),
20
+ object_changes=ocel_rs["object_changes"].to_pandas().convert_dtypes(),
21
+ globals={},
22
+ o2o=ocel_rs["o2o"].to_pandas().convert_dtypes(),
23
+ parameters={
24
+ pm4py.objects.ocel.obj.Parameters.EVENT_ID: "ocel:eid",
25
+ pm4py.objects.ocel.obj.Parameters.EVENT_ACTIVITY: "ocel:activity",
26
+ pm4py.objects.ocel.obj.Parameters.EVENT_TIMESTAMP: "ocel:timestamp",
27
+ pm4py.objects.ocel.obj.Parameters.OBJECT_ID: "ocel:oid",
28
+ pm4py.objects.ocel.obj.Parameters.OBJECT_TYPE: "ocel:type",
29
+ pm4py.objects.ocel.obj.Parameters.QUALIFIER: "ocel:qualifier",
30
+ pm4py.objects.ocel.obj.Parameters.CHANGED_FIELD: "ocel:field",
31
+ },
32
+ )
33
+ return ocel_pm4py
34
+
35
+ def import_ocel_xml(path: str) -> dict[str, pl.DataFrame]:
36
+ """
37
+ Import OCEL2 from XML.
38
+
39
+ Returns:
40
+ Dict with DataFrames: 'events', 'objects', 'relations', 'o2o', 'object_changes'
41
+ """
42
+ return import_ocel_xml_rs(path)
43
+
44
+ def import_ocel_xml_pm4py(path: str):
45
+ """Import OCEL2 XML and convert to PM4PY format."""
46
+ return rs_ocel_to_pm4py(import_ocel_xml(path))
47
+
48
+ def import_ocel_json(path: str) -> dict[str, pl.DataFrame]:
49
+ """
50
+ Import OCEL2 from JSON.
51
+
52
+ Returns:
53
+ Dict with DataFrames: 'events', 'objects', 'relations', 'o2o', 'object_changes'
54
+ """
55
+ return import_ocel_json_rs(path)
56
+
57
+ def import_ocel_json_pm4py(path: str):
58
+ """Import OCEL2 JSON and convert to PM4PY format."""
59
+ return rs_ocel_to_pm4py(import_ocel_json(path))
60
+
61
+ def import_ocel(path: str) -> dict[str, pl.DataFrame]:
62
+ """
63
+ Import OCEL2 from File.
64
+
65
+ Returns:
66
+ Dict with DataFrames: 'events', 'objects', 'relations', 'o2o', 'object_changes'
67
+ """
68
+ return import_ocel_rs(path)
69
+
70
+ def import_ocel_pm4py(path: str):
71
+ """Import OCEL2 JSON and convert to PM4PY format."""
72
+ return rs_ocel_to_pm4py(import_ocel(path))
r4pm/py.typed ADDED
File without changes
Binary file
r4pm/xes_export.py ADDED
@@ -0,0 +1,13 @@
1
+ import polars
2
+
3
+ from .r4pm import export_xes_rs
4
+
5
+ def export_xes(df: polars.DataFrame, path: str):
6
+ """
7
+ Export DataFrame as XES file.
8
+
9
+ Args:
10
+ df: Polars DataFrame with event data
11
+ path: Output path (.xes or .xes.gz)
12
+ """
13
+ return export_xes_rs(df, path)
r4pm/xes_import.py ADDED
@@ -0,0 +1,18 @@
1
+ from typing import Optional
2
+ import polars
3
+
4
+ from .r4pm import import_xes_rs
5
+
6
+ def import_xes(path: str, date_format: Optional[str] = None, print_debug: Optional[bool] = None) -> tuple[polars.DataFrame, str]:
7
+ """
8
+ Import XES event log.
9
+
10
+ Args:
11
+ path: Path to .xes or .xes.gz file
12
+ date_format: Optional date format for parsing (see chrono strftime)
13
+ print_debug: Enable debug output
14
+
15
+ Returns:
16
+ Tuple of (DataFrame with events, JSON string with log metadata)
17
+ """
18
+ return import_xes_rs(path, date_format, print_debug)