Skip to main content

LCM Marimo

Linear Continuous Process Mapper

A prototypical implementation of linear and continuous process maps for the exploratory analysis of sequential behavior in event logs. This Python application builds upon interactive Sankey diagrams to provide effective visualizations of process behavior. The system loads event logs, constructs process maps using different abstractions (such as sequence-based, set-based, and last-activity-based), and visualizes them to display relevant insights in a precise yet interpretable way.

Overview

Annotated interface screenshot UI of the application. Users choose an event log from the logs/ folder via the event log selector (H), and can either analyze it as-is or apply further transformations by editing the marimo notebook. The UI supports folding activities (A) and activity selection (B). Furthermore, users can select from the three generic LCMs: sequence-, set-, or last-activity abstraction (C) and choose whether to visualize self-loops and empty traces (D). After selecting the desired visualization controls, they can refresh the visualization (E), which refreshes the Sankey diagram (F). Here, they can freely reposition nodes to adjust the visualization to their needs. More details about edges and nodes are revealed on hover (G). The current settings are also available as a generate call to copy into a notebook cell (I).

How to Run

This is the marimo version of the LCPM.

To get started:

uv sync

Then to run:

uv run marimo run marimo_app.py

Or to edit;

uv run marimo edit marimo_app.py

Event logs

Put event logs in the logs/ folder and choose one from the Event log dropdown at the top of the app. Both .xes and .csv files are supported. A CSV needs these columns:

  • case:concept:name: case ID
  • concept:name: activity
  • time:timestamp: timestamp

The included logs/log.csv is a preprocessed subset of BPI Challenge 2020: Domestic Declarations by Boudewijn van Dongen (2020), Version 1, 4TU.ResearchData. Source: https://doi.org/10.4121/uuid:3f422315-ed9d-4882-891f-e180b5b4feb5

The subset contains 8,260 cases and 46,375 events; all included cases start in 2018. It was converted from DomesticDeclarations2H.xes to CSV, retaining only case ID, activity, and timestamp, with timestamps expressed in UTC.

This dataset is licensed under Creative Commons Attribution–NonCommercial 4.0 International (CC BY-NC 4.0). Its reuse and redistribution are subject to that license, including its attribution and noncommercial-use conditions. The repository’s MIT license applies to the code, not to this dataset.

Install

pip install linear-continuous-process-mapper

This installs the lcm library only. The interactive notebook needs the extra: pip install "linear-continuous-process-mapper[notebook]".

Programmatic Use

The widgets in marimo_app.py are one way to call the lcm library. The same maps can be drawn from code, without any widgets. To fix a state you found interactively, copy the call from Reproduce this map in code below the map.

programmatic_example.py is a worked analysis of the included log in this style. It compares map types, folds activities, measures what each activity adds to a map, and transforms the log before mapping it. It has no widgets and is meant to be read with its code visible, so open it in edit mode:

uv run marimo edit programmatic_example.py
import lcm

lcm_service = lcm.get_service(lcm.load_event_log("logs/log.csv"))

figure, metadata = lcm_service.generate(
    activities=None,  # None keeps all of them; folded ones go by their fold name
    map_type=lcm.MapType.SEQUENCE_BASED,  # or "sequence_based"
    allow_loops=True,  # has no effect on sequence-based maps
    visualize_empty_cases=True,
    folds={"Rejections": ["Declaration REJECTED by ADMINISTRATION", "Declaration REJECTED by SUPERVISOR"]},
)

All arguments are optional and invalid choices raise a ValueError. figure is a Plotly figure and metadata is a dict of counts. generate starts from the full log on every call, so one service can draw many maps. In a marimo notebook, every cell needs its own variable names:

# One cell
set_map, set_metadata = lcm_service.generate(map_type="set_based")
set_map
# Another cell
last_activity_map, last_activity_metadata = lcm_service.generate(map_type="last_activity_based")
last_activity_map

Display the figure directly. Wrapping it in mo.ui.plotly() leaves a blank plot, because that wrapper does not support Sankey traces.

Traces and layout

A trace is a distinct sequence of activities, with the number of cases that follow it. generate lists the traces of the map, the most frequent first (ties: the longer one, then by sequence), at most 500:

figure, metadata = lcm_service.generate(map_type="sequence_based", layout="traces")

metadata["traces"]            # [{"name", "sequence", "cases", "links", "nodes"}, ...]
metadata["traces_truncated"]  # True when there were more than 500 traces
  • name is the activities joined with →; the empty trace is EMPTY TRACE. If two different sequences would get the same name (only possible when an activity holds → itself), the later one gets (2), (3) and so on. sequence is the list of activities and is the reliable way to identify a trace.
  • links are the links the trace uses, in order, and nodes the nodes it passes, starting with the root. Both are numbered as the figure numbers its own links and nodes (their position in link.source and node.label). A step that is not drawn (a repeated activity with allow_loops=False) has no link.

generate(trace_limit=500) sets how many of the most frequent traces are stored. Every stored trace adds to the size of the figure (500 traces of a map of 20,000 cases added about 670 KB), so lower it, or use 0 to store none (the layout then falls back to "auto"), when figures are kept or sent around; a negative value raises a ValueError.

The list is plain data (it can go through json.dumps) and the figure carries the same one in figure.data[0].meta:

figure.data[0].meta["lcm"]
# {"traces": [...], "truncated": bool, "layout": "auto" or "traces"}

layout is "auto" (Plotly places the nodes) or "traces". With "traces" the nodes of the most frequent trace share the top edge of the root, so the trace is a straight band from the root. The other traces are stacked below it, row by row, and the nodes get fixed positions (node.x, node.y, arrangement="freeform" (the nodes stay where they are put and can still be dragged), pad of 10 px). Any other value raises a ValueError. Traces that were cut at 500 are not laid out as rows; their nodes are placed below the others. A column that does not fit below the common top starts higher, as far as it has to.

The positions depend on the size of the plot area. After changing the height or the margins of the figure, call lcm.relayout to place the nodes again:

figure.update_layout(height=900, margin=dict(l=110, r=10, t=100, b=140))
lcm.relayout(figure)

It returns the figure. A figure drawn with layout="auto" stays as it is. Plotly sizes the nodes of a map with loops or cycles by its own rules, which relayout follows only approximately, so the top edges can differ by a few pixels there.

Project Structure

marimo_app.py - The main entry point for running the application, via a marimo notebook. It is also the example of interactive use of the library.

programmatic_example.py - An example analysis that uses the library from code, without widgets.

lcm - The library, independent of marimo. lcm/__init__.py wires together all components (data processors, graph builders, analyzers) in get_service. It contains the main analytical components:

  • data - Event log data handling using PM4Py. Loads XES and CSV files, orders each case's events by timestamp, applies folds, filters by activities, and creates the variants for analysis
  • domain - Graph analysis algorithms that enrich process graphs with business metrics including flow analysis, leakage detection, termination ratios, and node balancing
  • graph_builders - Multiple strategies for constructing process graphs from event data: set-based prefix graphs, sequence-based prefix trees, and last-activity-based graphs with configurable loop handling
  • services - High-level orchestration services that coordinate graph construction and the complete analytics pipeline from raw data to visualizations
  • visualization - Interactive Sankey diagram generator using Plotly that converts enriched process graphs into color-coded flow visualizations with hover details and activity legends

tests - Tests of the library. Run them with uv run pytest.

Repository Authors

Metadata

Release files for linear-continuous-process-mapper 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linear-continuous-process-mapper 0.2.0
File Size Uploaded Provenance Actions
linear_continuous_process_mapper-0.2.0.tar.gz 1.4 MB Without provenance Details for linear_continuous_process_mapper-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for linear-continuous-process-mapper 0.2.0
File Interpreter ABI Platform Actions
linear_continuous_process_mapper-0.2.0-py3-none-any.whl Python 3 none any Details for linear_continuous_process_mapper-0.2.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / linear_continuous_process_mapper-0.2.0.tar.gz

Download URL linear_continuous_process_mapper-0.2.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
d42d63dc0f7ad4c2e4fcb0b44a973de52a18e311df424b6e17143f589fb94224
BLAKE2b-256 checksum
How to use checksums
d358f042d2e928b18233f09c9cfe2fd8d2adc6fbe6682b6be2a4796c627da82f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / linear_continuous_process_mapper-0.2.0-py3-none-any.whl

Download URL linear_continuous_process_mapper-0.2.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6011a2d25d60a2ffa3dbec0e6c6e19a388bd14739242e50e5f10010d037ecdb0
BLAKE2b-256 checksum
How to use checksums
d15fe70d42ab382f6abe11794cada28380550c3b2e5efe763d7f13a325f10b9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for linear-continuous-process-mapper 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page