Function detecting time anomalies, which can refer to activities with negative or zero duration

detect_time_anomalies(
  activitylog,
  anomaly_type = c("both", "negative", "zero"),
  details = TRUE,
  filter_condition = NULL
)

Arguments

activitylog

The activity log

anomaly_type

Type of anomalies that need to be detected (either "negative", "zero" or "both")

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

Value

activitylog containing the rows of the original activity log for which a negative or zero duration is detected, together with the duration value and whether it constitutes a zero or negative duration

Examples

# \donttest{ data("hospital_actlog") detect_time_anomalies(activitylog = hospital_actlog)
#> Selected anomaly type: both
#> *** OUTPUT ***
#> For 5 rows in the activity log (9.43%), an anomaly is detected.
#> The anomalies are spread over the activities as follows:
#> # A tibble: 3 x 3 #> # Groups: activity [3] #> activity type n #> <chr> <chr> <int> #> 1 Registration negative duration 3 #> 2 Clinical exam zero duration 1 #> 3 Trage negative duration 1
#> Anomalies are found in the following rows:
#> # A tibble: 5 x 9 #> patient_visit_nr activity originator start complete #> <dbl> <chr> <chr> <dttm> <dttm> #> 1 518 Registr~ Clerk 12 2017-11-21 11:45:16 2017-11-21 11:22:16 #> 2 518 Registr~ Clerk 6 2017-11-21 11:45:16 2017-11-21 11:22:16 #> 3 518 Registr~ Clerk 9 2017-11-21 11:45:16 2017-11-21 11:22:16 #> 4 520 Trage Nurse 17 2017-11-21 13:43:16 2017-11-21 13:39:00 #> 5 528 Clinica~ Doctor 1 2017-11-21 19:00:00 2017-11-21 19:00:00 #> # ... with 4 more variables: triagecode <dbl>, specialization <chr>, #> # duration <dbl>, type <chr>
# }