filter_precedence: Filter Precedence Relations

View source: R/filter_precedence.R

filter_precedenceR Documentation

Filter Precedence Relations

Description

Filters cases based on the precedence relations between two sets of activities.

Usage

filter_precedence(
  log,
  antecedents,
  consequents,
  precedence_type = c("directly_follows", "eventually_follows"),
  filter_method = c("all", "one_of", "none"),
  reverse = FALSE,
  eventlog = deprecated()
)

## S3 method for class 'log'
filter_precedence(
  log,
  antecedents,
  consequents,
  precedence_type = c("directly_follows", "eventually_follows"),
  filter_method = c("all", "one_of", "none"),
  reverse = FALSE,
  eventlog = deprecated()
)

## S3 method for class 'grouped_log'
filter_precedence(
  log,
  antecedents,
  consequents,
  precedence_type = c("directly_follows", "eventually_follows"),
  filter_method = c("all", "one_of", "none"),
  reverse = FALSE,
  eventlog = deprecated()
)

Arguments

log

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

antecedents, consequents

character vector: The set of antecendent and consequent activities. Both are character vectors containing at least one activity identifier. All pairs of antecedents and consequents are turned into seperate precedence rules.

precedence_type

character (default "directly_follows"): When "directly_follows", the consequent activity should happen immediately after the antecedent activities.
When "eventually_follows", other events are allowed to happen in between.

filter_method

character (default "all"): When "all", only cases where all the relations are valid are preserved.
When "one_of", all the cases where at least one of the conditions hold, are preserved.
When "none", none of the relations are allowed.

reverse

logical (default FALSE): Indicating whether the selection should be reversed.

eventlog

[Deprecated]; please use log instead.

Details

In order to extract a subset of an event log which conforms with a set of precedence rules, one can use the filter_precedence method. There are two types of precendence relations which can be tested: activities that should directly follow ("directly_follows") each other, or activities that should eventually follow ("eventually_follows") each other. The type can be set with the precedence_type argument.

Further, the filter requires a vector of one or more antecedents (containing activity labels), and one or more consequents.

Finally, a filter_method argument can be set. This argument is relevant when there is more than one antecedent or consequent. In such a case, you can specify that all possible precedence combinations must be present ("all"), at least one of them ("one_of"), or none ("none").

Value

When given an object of type log, it will return a filtered log. When given an object of type grouped_log, the filter will be applied in a stratified way (i.e. each separately for each group). The returned log will be grouped on the same variables as the original log.

Methods (by class)

  • filter_precedence(log): Filters cases for a log.

  • filter_precedence(grouped_log): Filters cases for a grouped_log.

References

Swennen, M. (2018). Using Event Log Knowledge to Support Operational Exellence Techniques (Doctoral dissertation). Hasselt University.

See Also

Other filters: filter_activity_frequency(), filter_activity_instance(), filter_activity_presence(), filter_activity(), filter_case_condition(), filter_case(), filter_endpoints_condition(), filter_endpoints(), filter_flow_time(), filter_idle_time(), filter_infrequent_flows(), filter_lifecycle_presence(), filter_lifecycle(), filter_precedence_condition(), filter_precedence_resource(), filter_processing_time(), filter_resource_frequency(), filter_resource(), filter_throughput_time(), filter_time_period(), filter_trace_frequency(), filter_trace_length(), filter_trace(), filter_trim_lifecycle(), filter_trim()

Examples


eventdataR::patients %>%
	filter_precedence(antecedents = "Triage and Assessment",
					  consequents = "Blood test",
					  precedence_type = "directly_follows") %>%
	bupaR::traces()

eventdataR::patients %>%
	filter_precedence(antecedents = "Triage and Assessment",
					  consequents = c("Blood test", "X-Ray", "MRI SCAN"),
					  precedence_type = "eventually_follows",
					  filter_method = "one_of") %>%
	bupaR::traces()


edeaR documentation built on April 27, 2023, 9:07 a.m.