ocpm_engine.standalone¶
Source-neutral Python facade over the standalone Rust engine. Public request and result values are ordinary mappings following the versioned 1.0 JSON contracts; this module only handles Python-to-JSON conversion, and algorithms execute in Rust with the GIL released.
StandaloneEngine¶
Run OCPM operations from files or canonical in-memory data.
Constructors¶
StandaloneEngine(canonical_log: Mapping[str, Any])
StandaloneEngine.from_ocel2_json(value: str | bytes | Path)
StandaloneEngine.from_xes(value: str | bytes | Path)
StandaloneEngine.from_sqlite(path: str | Path)
StandaloneEngine.from_duckdb_parquet(source: Mapping[str, Any])
canonical_log— a canonical log as a JSON object.from_ocel2_json/from_xes— accept aPathto read, or the document itself asstr/bytes.from_sqlite— path to an OCEL 2.0 SQLite file.from_duckdb_parquet— opens local or S3 Parquet through a deployment-supplied DuckDB installation; thesourceobject selects the existing catalog, location, snapshot, layout, cache mode, and options. The engine never creates the catalog implicitly.
from ocpm_engine import StandaloneEngine
engine = StandaloneEngine.from_ocel2_json("events.json")
engine = StandaloneEngine.from_duckdb_parquet(
{
"database": {
"kind": "existing",
"path": "/catalog/analytics.duckdb",
"read_only": True,
},
"location": {"kind": "local", "root": "/data/ocel-parquet"},
"snapshot": {"kind": "current", "pointer": "CURRENT"},
"layout": {"kind": "canonical_v1"},
"cache": {"kind": "direct"},
"options": {
"memory_budget_bytes": 536_870_912,
"result_cache_bytes": 67_108_864,
"materialize_execution_relation": True,
},
}
)
Properties¶
| Property | Type | Purpose |
|---|---|---|
provider_name |
str |
Name of the active provider |
capabilities |
list[str] |
Capability surface of the active provider |
Methods¶
Every request-taking method accepts a versioned JSON object (a plain mapping) and returns a plain dictionary.
append(batch: Mapping) -> None
profile(view: Mapping | None = None) -> dict
query(request: Mapping) -> dict
discover(request: Mapping) -> dict
conformance(request: Mapping) -> dict
enhance(request: Mapping) -> dict
fit_prediction(request: Mapping) -> dict
predict(request: Mapping) -> dict
evaluate_prediction(view: Mapping, target: str, *,
holdout_fraction: float = 0.2,
parameters: Mapping | None = None) -> dict
target on the selected view.
execution_summary(request: Mapping) -> dict
canonical_json(view: Mapping | None = None) -> dict
ocel2_json(view: Mapping | None = None) -> dict
xes(object_type: str, view: Mapping | None = None) -> str
write_sqlite(path: str | Path, view: Mapping | None = None) -> None
write_parquet_snapshot(root: str | Path, version: str,
view: Mapping | None = None) -> dict
CURRENT pointer.
explain(view: Mapping, capability: str) -> dict
Example¶
from ocpm_engine import StandaloneEngine
engine = StandaloneEngine.from_ocel2_json("events.json")
profile = engine.profile({"object_types": ["Order"]})
model = engine.discover(
{
"view": {"object_types": ["Order"]},
"algorithm": "object_centric_dfg",
}
)
serialize_model¶
serialize_model(artifact: Mapping, format: str = "json") -> str
Serialize a 1.0 model artifact as JSON, DOT, PNML, or SVG.