Skip to content

adapters

adapters ¤

Shape-driven adapters that convert legacy detector DataFrames into the canonical :class:~ts_shape.eventlog.model.EventLog.

There is one adapter implementation per shape (point, interval, summary, static). The per-method specifics live in :mod:ts_shape.eventlog.taxonomy (the REGISTRY). A custom adapter for a specific (class, method) pair can be registered with @register_adapter(...) to override the shape-driven default — useful for the few detectors whose legacy schema does not fit any standard shape.

register_adapter ¤

register_adapter(
    class_name: str, method_name: str
) -> Callable[[AdapterFn], AdapterFn]

Register a custom adapter for a specific (class, method).

The function will be called with (legacy_df, *, rule, detector, objects, qualifiers).

adapt ¤

adapt(
    legacy: DataFrame,
    *,
    rule: LabelRule,
    detector: str,
    objects: Mapping[str, object] | None = None,
    qualifiers: Mapping[str, str] | None = None
) -> EventLog

Convert one detector's output into a canonical :class:EventLog.