Skip to content

Commit

Permalink
handle flows update
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyclements committed May 14, 2024
1 parent d7f8031 commit d76e82d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions R/handle_flows.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,20 @@ filter_date_range <- function(data, date, format, tzone, start = TRUE) {
} else {
return(dplyr::filter(data, date_posix > as.POSIXct(data$created_on, format="%Y-%m-%dT%H:%M:%OS", tz = "UTC")))
}
}

#' Helper function to handle flow data of a specified type.
#'
#' This function processes flow data of a specified type and extracts relevant information.
#'
#' @param data A data frame containing flow data.
#' @param type The type of flow data to handle.
#' @param type_2 The group within `type` to handle.
#'
#' @export
#' @return A tibble with relevant information.
#'
handle_type_flow <- function(data, type = "completed", type_2 = "category") {
response <- ifelse(is.na(data$values[[type]][[type_2]]), "No response", data$values[[type]][[type_2]])
return(tibble::tibble(uuid = data$contact$uuid, interacted = data$responded, response, created_run_on = data$created_on))
}

0 comments on commit d76e82d

Please sign in to comment.