Function detecting violations of dependencies between attributes (i.e. condition(s) that should hold when (an)other condition(s) hold(s))

detect_attribute_dependencies(
  activitylog,
  antecedent,
  consequent,
  details = TRUE,
  filter_condition = NULL,
  ...
)

Arguments

activitylog

The activity log

antecedent

(Vector of) condition(s) which serve as an antecedent (if the condition(s) in antecedent hold, then the condition(s) in consequent should also hold)

consequent

(Vector of) condition(s) which serve as a consequent (if the condition(s) in antecedent hold, then the condition(s) in consequent should also hold)

details

Boolean indicating wheter details of the results need to be shown

filter_condition

Condition that is used to extract a subset of the activity log prior to the application of the function

...

Named vectors with name of the activity, and value of the threshold.

Value

activitylog containing the rows of the original activity log for which the dependencies between attributes are violated

Examples

# \donttest{ data("hospital_actlog") detect_attribute_dependencies(activitylog = hospital_actlog, antecedent = activity == "Registration", consequent = startsWith(originator,"Clerk"))
#> *** OUTPUT ***
#> The following statement was checked: if condition(s) ~activity == "Registration" hold(s), then ~startsWith(originator, "Clerk") should also hold.
#> This statement holds for 12 (85.71%) of the rows in the activity log for which the first condition(s) hold and does not hold for 2 (14.29%) of these rows.
#> For the following rows, the first condition(s) hold(s), but the second condition does not:
#> # A tibble: 2 x 7 #> patient_visit_nr activity originator start complete #> <dbl> <chr> <chr> <dttm> <dttm> #> 1 528 Registr~ Nurse 6 2017-11-21 18:10:17 2017-11-21 18:15:04 #> 2 534 Registr~ NA 2017-11-22 18:35:00 2017-11-22 18:37:00 #> # ... with 2 more variables: triagecode <dbl>, specialization <chr>
# }