"load_rfv run using sequential and parallel loading returns same results"

"load_trn run using sequential and parallel loading returns same results"

## Description: Test convert_dia() function
c_s <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, nThread = 4))
c_s <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, nThread = 1))
c_p <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, nThread = 2))
test_that("convert_dia run using sequential and parallel loading returns same results", {
c_p_sum <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, collapse = "ID_MERGE", aggr_type = "earliest", nThread = 2))
c_s_sum <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, collapse = "ID_MERGE", aggr_type = "latest", nThread = 1))
c_p_sum <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, collapse = "ID_MERGE", aggr_type = "latest", nThread = 2))
test_that("convert_dia summarizing using sequential and parallel loading returns same results", {
c_s_sum <- suppressMessages(convert_dia(d_p, codes_to_find = diseases, collapse = "ID_MERGE", aggr_type = "earliest", nThread = 1))
date_cols <- colnames(c_s)[which(as.vector(c_s[,lapply(.SD, class)])[1,] == "POSIXct")]
suppressWarnings(c_s[,(date_cols):= lapply(.SD, as.character), .SDcols = date_cols])
#c_s[] <- lapply(c_s, gsub, pattern = '"', replacement = '')
for (j in colnames(c_s)) data.table::set(c_s, j = j, value = gsub(pattern = '"', replacement = '', c_s[[j]], fixed = TRUE))
for (j in colnames(c_s)) data.table::set(c_s, j = j, value = gsub(pattern = '\\', replacement = '', c_s[[j]], fixed = TRUE))
for (j in colnames(c_s)) data.table::set(c_s, j = j, value = gsub(pattern = '\\\\', replacement = '', c_s[[j]], fixed = TRUE))
if(OVERWRITE | !file.exists(paste0(folder_parse, "dia_conv.csv"))) {data.table::fwrite(c_s, paste0(folder_parse, "dia_conv.csv"))}
l_s <- data.table::fread(paste0(folder_parse, "dia_conv.csv"), na.strings = "NA", strip.white = FALSE, colClasses = apply(c_s, 2, class))
date_cols <- colnames(c_s_sum)[which(as.vector(c_s_sum[,lapply(.SD, class)])[1,] == "POSIXct")]
suppressWarnings(c_s_sum[,(date_cols):= lapply(.SD, as.character), .SDcols = date_cols])
#c_s_sum[] <- lapply(c_s_sum, gsub, pattern = '"', replacement = '')
for (j in colnames(c_s_sum)) data.table::set(c_s_sum, j = j, value = gsub(pattern = '"', replacement = '', c_s_sum[[j]], fixed = TRUE))
for (j in colnames(c_s_sum)) data.table::set(c_s_sum, j = j, value = gsub(pattern = '\\', replacement = '', c_s_sum[[j]], fixed = TRUE))
for (j in colnames(c_s_sum)) data.table::set(c_s_sum, j = j, value = gsub(pattern = '\\\\', replacement = '', c_s_sum[[j]], fixed = TRUE))
if(OVERWRITE | !file.exists(paste0(folder_parse, "dia_conv_sum.csv"))) {data.table::fwrite(c_s_sum, paste0(folder_parse, "dia_conv_sum.csv"))}
l_s_sum <- data.table::fread(paste0(folder_parse, "dia_conv_sum.csv"), na.strings = "NA", strip.white = FALSE, colClasses = apply(c_s_sum, 2, class))