Skip to main content

Crate wasm4pm

Crate wasm4pm 

Source
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)

ProfileSizeReductionUse Case
cloud~2.78MBCloud servers (default)
browser~500KB82%Web browsers, mobile
edge~1.5MB46%Edge servers, CDN
fog~2.0MB28%Fog computing, IoT
iot~1.0MB64%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

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 bcinr functions 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 >= 0 where A is the incidence matrix, c the cost vector, and b = 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§

Data
RlState
Multi-dimensional RL state with quantized dimensions

Enums§

RlAction

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 Median trait 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.