Skip to main content

Module process_mining

Module process_mining 

Source
Expand description

Petri-net reconstruction from per-class callSequences blobs, with token-replay conformance scoring.

For every node whose blob holds ≥2 call sequences we run an alpha-miner-style pass:

  1. Collect activities (every distinct call), direct-succession pair counts, plus first/last-activity multisets.
  2. Classify each ordered pair (a, b) as causal (succession seen one way only) or parallel (seen both ways).
  3. Build the Petri net:
    • one transition t_<act> per activity
    • start place p_start → every first-activity transition
    • every last-activity transition → end place p_end
    • one intermediate place p_<i> per causal pair, wired t_a → p_i → t_b
  4. Re-classify each transition by local arc topology: choice (input place feeds >1 transition), loop (output leads back to an input), parallel (output feeds >1 transition), else mandatory.
  5. Score conformance: a sequence conforms iff every consecutive (a, b) has a valid t_a → place → t_b path in the net. Sequences shorter than two calls trivially conform (matches the Python reference).

Mirrors analysis/process_mining.py in the visiting tool.

See DESIGN.md (Phase 3) at the workspace root.

Structs§

Arc
A directed arc between a place and a transition (or vice versa).
NodeProcessMining
Per-node net produced by compute_process_mining.
PetriNet
A mined Petri net for a single set of call sequences.
Place
A Petri-net place. kind is one of "start", "end", "intermediate".
ProcessMiningAnalysis
Whole-graph process-mining readout.
Transition
A Petri-net transition. kind starts as "activity"; after classify_transitions runs it becomes one of "mandatory", "choice", "loop", or "parallel".

Functions§

build_petri_net
Build a Petri net from a list of call sequences. Returns an empty net when sequences is empty or no sequence contains any calls.
classify_transitions
Reclassify the kind field of every transition in net from "activity" to one of mandatory/choice/loop/parallel. Mutates in place.
compute_conformance
Compute the fraction of sequences that conform to net. Sequences with <2 calls trivially conform. Returns 0.0 when sequences is empty or the net has no arcs.
compute_process_mining
Walk every node’s callSequences blob, mine a Petri net per class that emits ≥2 sequences, classify transitions, and score conformance.