filter_rules: Filter Using Declarative Rules

View source: R/filter_rules.R

filter_rulesR Documentation

Filter Using Declarative Rules


This function can be used to filter event data using declaritive rules or constraint templates. It needs a log (object of class log or derivatives, e.g. grouped_log, eventlog, activitylog, etc.). and a set of rules. Rules can be made with the following templates:

  • Cardinality:

    • absent: Check if the specified activity is absent from a case,

    • contains: Check if the specified activity is present (contained) in a case,

    • contains_between: Check if the specified activity is present (contained) in a case between the minimum and maximum number of times,

    • contains_exactly: Check if the specified activity is present (contained) in a case for exactly n times.

  • Relation:

    • ends: Check if cases end with the specified activity,

    • starts: Check if cases start with the specified activity.

    • precedence: Check for precedence between two activities,

    • response: Check for response between two activities,

    • responded_existence: Check for responded existence between two activities,

    • succession: Check for succession between two activities.

  • Exclusiveness:

    • and: Check for co-existence of two activities,

    • xor: Check for exclusiveness of two activities.


filter_rules(log, ..., eventlog = deprecated())

## S3 method for class 'log'
filter_rules(log, ..., eventlog = deprecated())



log: Object of class log or derivatives (grouped_log, eventlog, activitylog, etc.).


Name-rule pairs created by rule functions.


[Deprecated]; please use log instead.


The rules or constraint templates in this package are (partially) based on DecSerFlow (Declarative Service Flow Language). For more information, see the References below.

Grouped Logs

When applied to a grouped_log, the grouping variables are ignored but retained in the returned log.


A filtered log (of same type as input) that satisfied the specified rules.

Methods (by class)

  • filter_rules(log): Filter a log using declaritive rules.


van der Aalst, W. M. P., & Pesic, M. (2006). DecSerFlow: Towards a Truly Declarative Service Flow Language. In M. Bravetti, M. Núñez, & G. Zavattaro (Eds.), Proceedings of the 3rd International Workshop on Web Services and Formal Methods (Vol. 4184, pp. 1–23). Springer. doi: 10.1007/11841197_1

See Also




# Filter where Blood test precedes MRI SCAN and Registration is the start of the case.
patients %>%
 filter_rules(precedence("Blood test","MRI SCAN"),

processcheckR documentation built on Oct. 3, 2022, 5:05 p.m.