Modify daqapo::detect_value_range_violations to generate different result

I have the activitylog object below:

hospital<-structure(list(patient_visit_nr = c(510, 512, 510, 512, 512, 
                                              510, 517, 518, 518, 518, 519, 519, 520, 519, 521, 521, 519, 522, 
                                              522, 523, 524, 525, 526, 523, 527, 527, 527, 528, 528, 523), 
                         activity = c("registration", "Registration", "Triage", "Triage", 
                                      "Clinical exam", "Clinical exam", "Triage", "Registration", 
                                      "Registration", "Registration", "Registration", "Triage", 
                                      "Trage", "Clinical exam", "Triage", "Registration", "Treatment", 
                                      "Registration", "Triaga", "Registration", "Triage", "Triage", 
                                      "Triage", "Triage", "Registration", "Triage", "Clinical exam", 
                                      "Registration", "Triage", "Clinical exam"), originator = c("Clerk 9", 
                                                                                                 "Clerk 12", "Nurse 27", "Nurse 27", "Doctor 7", "Doctor 7", 
                                                                                                 "Nurse 17", "Clerk 12", "Clerk 6", "Clerk 9", "Clerk 12", 
                                                                                                 "Nurse 17", "Nurse 17", "Doctor 4", "Nurse 17", "Clerk 3", 
                                                                                                 "Nurse 17", "Clerk 3", "Nurse 5", "Clerk 9", "Nurse 5", "Nurse 5", 
                                                                                                 "Nurse 5", "Nurse 27", "Clerk 6", "Nurse 5", "Doctor 4", 
                                                                                                 "Nurse 6", "Nurse 6", "Doctor 4"), start = structure(c(1511173097, 
                                                                                                                                                        1511173994, 1511174048, 1511174652, 1511177232, 1511177701, 
                                                                                                                                                        1511264116, 1511264716, 1511264716, 1511264716, 1511265581, 
                                                                                                                                                        1511270783, 1511271796, 1511272354, 1511272924, 1511273120, 
                                                                                                                                                        1511275132, 1511277137, 1511277325, 1511282528, 1511283843, 
                                                                                                                                                        1511283853, 1511283855, 1511285190, 1511287330, 1511287331, 
                                                                                                                                                        1511287333, 1511287817, 1511288105, 1511288209), tzone = "UTC", class = c("POSIXct", 
                                                                                                                                                                                                                                  "POSIXt")), complete = structure(c(1511173206, 1511174220, 
                                                                                                                                                                                                                                                                     1511174508, 1511175017, 1511177637, 1511177769, 1511264340, 
                                                                                                                                                                                                                                                                     1511263336, 1511263336, 1511263336, 1511265952, 1511271138, 
                                                                                                                                                                                                                                                                     1511271540, 1511272954, 1511273169, 1511290800, 1511275761, 
                                                                                                                                                                                                                                                                     1511277499, 1511277484, 1511283119, 1511283965, 1511283968, 
                                                                                                                                                                                                                                                                     1511283970, 1511287261, 1511287447, 1511287448, 1511287450, 
                                                                                                                                                                                                                                                                     1511288104, 1511288412, 1511288528), tzone = "UTC", class = c("POSIXct", 
                                                                                                                                                                                                                                                                                                                                   "POSIXt")), triagecode = c(3, 3, 3, 3, 3, NA, 3, 4, 4, 4, 
                                                                                                                                                                                                                                                                                                                                                              4, 4, 5, 4, 2, 2, 4, 2, 2, 3, 3, 3, 4, 3, 2, 2, 2, 3, 3, 
                                                                                                                                                                                                                                                                                                                                                              3), specialization = c("TRAU", "URG", "TRAU", "URG", "URG", 
                                                                                                                                                                                                                                                                                                                                                                                     "URG", "URG", "PED", "PED", "PED", "PED", "PED", "URG", "PED", 
                                                                                                                                                                                                                                                                                                                                                                                     "URG", "URG", "PED", "URG", "URG", "URG", "URG", "URG", "URG", 
                                                                                                                                                                                                                                                                                                                                                                                     "URG", "URG", "URG", "URG", "TRAU", "TRAU", "URG"), .order = 1:30), row.names = c(NA, 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       -30L), class = c("activitylog", "log", "tbl_df", "tbl", "data.frame"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ), case_id = "patient_visit_nr", activity_id = "activity", resource_id = "originator", timestamps = c("start", 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "complete"))

and I want to modify the function daqapo::detect_value_range_violations in order to give me as final result the :

# Log of 0 events consisting of:
5 traces 
6 cases 
7 instances of 5 activities 
4 resources 

instead of the tibble that is generated with

hospital %>%
  detect_value_range_violations(triagecode = domain_numeric(from = 0, to = 5))

. How can i modify this function?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation