Expand description
§wasm4pm — High-Performance Process Mining in WebAssembly
wasm4pm provides production-ready process mining algorithms compiled to WebAssembly,
enabling efficient process discovery, conformance checking, and predictive analytics
in JavaScript/TypeScript environments.
§Features
- Process Discovery — DFG, Alpha++, Heuristic Miner, Inductive Miner, Genetic Algorithm, ILP, ACO, PSO
- Conformance Checking — Token-based replay, streaming conformance
- Machine Learning — Remaining-time prediction, outcome prediction, anomaly detection, drift detection
- Streaming — Real-time process mining for IoT and event streaming with SIMD acceleration
- OCEL Support — Object-Centric Event Logs with flattened analysis and DECLARE conformance
- POWL — Process-Oriented Workflow Language support
§Quick Start
import initWasm, {
load_eventlog_from_xes,
discover_dfg,
delete_object,
} from "wasm4pm";
// Initialize WASM module
await initWasm();
// Load event log from XES string
const logHandle = load_eventlog_from_xes(xesString);
// Discover Directly-Follows Graph
const dfg = discover_dfg(logHandle, "concept:name");
// Clean up
delete_object(logHandle);§Feature Flags
§Deployment Profiles (Binary Size Optimization)
| Profile | Size | Reduction | Use Case |
|---|---|---|---|
cloud | ~2.78MB | — | Cloud servers (default) |
browser | ~500KB | 82% | Web browsers, mobile |
edge | ~1.5MB | 46% | Edge servers, CDN |
fog | ~2.0MB | 28% | Fog computing, IoT |
iot | ~1.0MB | 64% | IoT devices, embedded |
§Algorithm Selection
basic— Fast discovery algorithms (DFG, skeleton)advanced— Full algorithm suite (ILP, genetic, ACO, PSO)ml— Machine learning features (prediction, anomaly, clustering)streaming— Streaming algorithms for real-time processing
§Architecture
The crate uses a handle-based state management system where all objects (event logs, process models, results) are stored internally and referenced by string handles. This design enables:
- Efficient serialization across the WASM boundary
- Automatic memory management via object pooling
- Simplified JavaScript interop (no manual lifetime management)
§Performance
- Throughput: 100K+ events/second for DFG discovery
- Memory: Columnar data layouts, object pooling, incremental computation
- Binary Size: Deployment profiles reduce WASM by up to 82%
- SIMD: Vectorized streaming DFG via WASM SIMD instructions
§Links
Re-exports§
pub use streaming::StreamStats;pub use streaming::StreamingAlgorithm;pub use streaming::StreamingDfgBuilder;pub use streaming::StreamingHeuristicBuilder;pub use streaming::StreamingSkeletonBuilder;pub use discovery::discover_dfg;pub use state::delete_object;pub use xes_format::load_eventlog_from_xes;pub use xes_format::load_eventlog_from_xes_cached;pub use wasm4pm_compat as data_types;pub use autonomic_audit_trail::*;
Modules§
- admission
- Accept(x) = C1..C7 admissibility framework.
- advanced
- advanced_
algorithms - algorithms
- align_
etconformance - Alignment-based ETConformance precision.
- alignment_
fitness - Alignment-based fitness computation.
- alignments
- analysis
- Statistical analysis functions for event logs stored in the handle cache.
- anomaly
- autonomic_
audit_ trail - Autonomic Audit Trail — Immutable, append-only event log for autonomic healing
- batches
- Batch processing pattern detection for event logs.
- bcinr_
compat - baseline for bcinr.
baseline for
bcinrfunctions missing in certain versions. - binary_
format - Binary process mining log format (
.pm4bin). - bpmn_
import - branchless
- Constant-latency branchless algorithms for SIMD and conformance checking.
- cache
- Three-layer cache for parsed logs, columnar representations, and interners.
- cache_
resident - Cache residency helpers for warm-starting the WASM module. Cache-efficient RL state and Q-table structures.
- capability_
registry - causal_
graph - compat_
api_ probe - Compile-checked API probe for wasm4pm-compat integration. Compile-checked wasm4pm-compat API probe.
- complexity_
metrics - Process model complexity metrics.
- conformance
- Token-replay conformance checking: fitness and precision measurement.
- conformance_
authority - Conformance Authority Module — A* alignment, fitness/precision metrics, admission gates (v30.1.2) Conformance Authority — wasm4pm Execution Engine
- conformance_
cache - Conformance result memoization.
- conformance_
guards - Conformance Checking Edge Case Guards
- conformance_
reporting - Enhanced conformance reporting with detailed fitness breakdowns and activity-level analytics.
- correlation_
miner - Correlation miner: discover a DFG from events without case identifiers.
- data_
quality - declare
- DECLARE declarative process model with an enum of LTL constraint templates. The Template enum replaces the stringly-typed template field in wasm4pm DeclareConstraint.
- declare_
conformance - dfg_io
- discovery
- Process discovery algorithms: DFG, OCEL, Declare, and related utilities.
- discovery_
determinism_ guards - Determinism Guards for Discovery Algorithms
- duration_
utils - ensemble
- error
- Structured error types and JS interop helpers. Structured error handling for WASM exports.
- etconformance_
precision - ETConformance precision metric.
- fast_
discovery - feature_
extraction - feature_
importance - filters
- final_
analytics - foundry
- Process-World Foundry: manufacture one Order-to-Cash field, emit every lawful projection. Process-World Foundry — manufacture ONE coherent Order-to-Cash process field, then emit every lawful projection of it.
- gall
- generalization
- Generalization quality metric for process models.
- genetic_
discovery - gpu
- graduation
- Graduation intake module bridging the baseline. Graduation intake path in wasm4pm.
- hierarchical
- Hierarchical chunking for divide-and-conquer discovery at 100B-event scale.
- hot_
kernels - ilp_
discovery - incremental_
dfg - Incremental Directly-Follows Graph (DFG) for O(1) per-event processing.
- io
- Event log I/O utilities (XES import/export, binary format).
- lifecycle
- Lifecycle State Machine module — WASM4PM autonomic control flow. Lifecycle State Machine module — synthesized by ggen manufacturing machinery
- log_
to_ trie - Prefix tree (trie) discovery from event logs.
- lsa
- marking_
equation - Marking equation LP solver for Petri net alignment heuristics.
Two-phase simplex LP solver for the marking equation used in Petri net
alignment heuristics. Solves
min c^T x s.t. A x = b, x >= 0whereAis the incidence matrix,cthe cost vector, andb = final - current marking. Pure f64 arithmetic – no external LP dependencies. - ml
- ML sub-module — contextual bandits and learning agents.
- ml_
algorithms - High-level ML algorithm dispatchers (remaining-time, outcome, anomaly). ML algorithms for process mining (Re-exports from Nanosecond Algorithm Families)
- model_
registry - Process-Model Registry module. Process-Model Registry core module.
- models
- Core data models:
EventLog,OCEL,DFG,PetriNet, etc. Core event log data model for process mining. - montecarlo
- Monte Carlo discrete-event simulation for process models.
- more_
discovery - network_
metrics - oc_
conformance - oc_
orchestrator - oc_
performance - oc_
petri_ net - ocel_
csv - OCEL CSV Parser
- ocel_
flatten - ocel_io
- OCEL I/O Module
- ocel_
tests - OCEL (Object-Centric Event Log) tests
- ocel_v2
- OCEL-v2 reachable surface (
#[wasm_bindgen]exports). - ocpq_
parser - ocpq_
runtime - parallel_
executor - Batch-sequential algorithm execution for process mining.
- pattern_
analysis - Pattern Analysis for YAWL Pattern Dispatch
- pattern_
dispatch - performance_
dfg - performance_
spectrum - Performance spectrum discovery.
- petri_
net_ playout - Basic Petri net playout via token replay.
- petri_
net_ reduction - Petri net structural reduction rules.
- playout
- Process tree and DFG playout (simulation) algorithms.
- pnml_io
- PNML (Petri Net Markup Language) import/export for wasm4pm.
- policy_
persistence - Policy Persistence — Checkpoint and restore RL agent state
- powl
- POWL algorithms: simplification, transitive utilities, label replacing, footprints.
- powl_
api - POWL WASM bindings — public API exported to JavaScript.
- powl_
arena - POWL (Partially Ordered Workflow Language) core data model.
- powl_
event_ log - Event log types for POWL conformance checking.
- powl_
models - POWL model types: PowlModel wrapper, PetriNet, ProcessTree.
- powl_
parser - Recursive-descent parser for POWL model strings.
- powl_
petri_ net - Petri net data model for POWL conversions.
- powl_
process_ tree - Process tree data model for POWL → ProcessTree conversion.
- powl_
to_ process_ tree - POWL to Process Tree conversion.
- prediction
- prediction_
additions - prediction_
drift - Concept-drift detection for process-mining event logs.
- prediction_
features - prediction_
next_ activity - prediction_
outcome - prediction_
remaining_ time - Remaining Time Prediction — answers “When will this case complete?”
- prediction_
resource - probabilistic
- Probabilistic data structures for memory-ephemeral process mining.
- process_
tree - Process tree with typed operator enum replacing the stringly-typed node_type field in wasm4pm ProcessTreeNode. Leaf nodes carry ActivityName. Tree structure is recursive via Box
. Paper grounding: Leemans, Fahland & van der Aalst 2013 ‘Discovering Block-Structured Process Models from Event Logs’ §2: process tree T with operators {→ (sequence), × (exclusive choice), ∧ (parallel/and), ↺ (loop)}. Tau (silent) leaf is the invisible activity. - proof_
gate_ registry - receipt
- Adversarial receipt doctor validation and truth verification.
- recommendations
- replay
- Process Replay Authority Module — token-based replay, simulation, and execution profiling. Process Replay Authority Module
- resource_
analysis - simd_
inner_ loops - SIMD Vectorization for Inner Loops (DFG, Conformance, Variant Dedup, Token Replay)
- simd_
streaming_ dfg - SIMD-accelerated Streaming Directly-Follows Graph (DFG) discovery.
- simd_
token_ replay - SIMD-accelerated token replay for Petri net conformance checking.
- smart_
engine - Smart Execution Engine — fused computation with caching and early termination.
- social_
network - soundness
- Formal WF-net soundness + structural predicates (Separable WF-net paper, Defs 3.1–3.13). Formal WF-net soundness and structural analysis.
- state
- Global stored-object state (handles, object pool, arena management). Global stored-object state (handles, object pool, arena management).
- streaming
- Streaming discovery algorithms for memory-efficient processing of infinite event streams.
- streaming_
conformance - streaming_
pipeline - Synchronous streaming pipeline for multi-algorithm event processing.
- streaming_
wasm - WASM bindings for streaming discovery algorithms.
- temporal_
profile - testing
- Route-Driven TDD substrate for
wasm4pm. - text_
encoding - trace_
correlation - Trace Correlation Proof — Prove CLI→WASM Causality via OTEL Trace IDs
- transition_
system - Transition system discovery from event logs.
- types
- Shared type aliases and newtype wrappers.
- utilities
- WASM boundary utilities: serialization helpers, handle validators, and event log filters.
- wasm_
testing_ utils - High-value WASM testing and introspection functions
- wasm_
utils - High-ROI WASM utility exports for caching, hashing, and drift analysis.
- wf_
to_ powl - WF-net → POWL 2.0 translation (Separable WF-net paper, Section 4: Partition_MG / Partition_SM). WF-net → POWL 2.0 translation (the inverse transformation).
- xes_
format - yawl_
export - POWL to YAWL v6 XML export.
Macros§
- internal_
error - invalid_
handle - Helper macros for common error patterns
- invalid_
input - parse_
error
Structs§
Enums§
Constants§
- FALLBACK_
BANDIT - UCB1 bandit for Fallback action — selects best discovery algorithm when the RL system triggers a Fallback action, replacing the hardcoded “dfg”. Gated on ml feature (prediction_resource is ml-gated).
Traits§
- Median
- The
Mediantrait returns the median of the distribution.
Functions§
- clear_
all_ caches - Clear all caches (parse, columnar, interner).
- create_
rl_ state - Create an RlState directly from 8 field values.
- evaluate_
ocpq - get_
cache_ stats - Get cache statistics as a JavaScript object.
- get_
capabilities - Get WASM module capabilities as a JavaScript object.
- get_
drift_ thresholds - Get current drift detection thresholds as JSON string.
- get_
version - Get the wasm4pm crate version string.
- init
- Initialize the WASM module
- main
- parse_
iso8601_ duration - Parse a subset of ISO-8601 timestamps and return the duration between them in milliseconds.
- reset_
drift_ thresholds - Reset drift detection thresholds to defaults (0.3, 0.7).
- rl_
state_ from_ features - Create an RlState from a feature slice and health level.
- rl_
state_ health_ level - Get the health_level field from an RlState.
- set_
drift_ thresholds - Set drift detection thresholds for RL state feature quantization.
- simd_
token_ replay - SIMD-accelerated token replay for conformance checking.