# test data for prepare_hcv_report_data()
# initiate list
d <- list()
d$hcv_start <- data.frame(
patient_id = c(1, 2, 3, 3),
starttre = lubridate::dmy(rep("1/1/2010", 3), "20/3/2011"),
stringsAsFactors = FALSE
)
d$hcv_characteristics <- data.frame(
patient_id = c(1, 2, 3),
adm_date = c("2007-01-05T12:10:01.000+0200",
NA_character_,
"2001-05-18T12:10:01.000+0200"),
gender = c(NA_character_, "F", "M"),
age = c(1, 25, 7),
stringsAsFactors = FALSE
)
assertthat::assert_that(all(unique(d$hcv_start$patient_id) ==
unique(d$hcv_characteristics$patient_id)))
d$hcv_perf_status <-
data.frame(
patient_id = c(1, 1, 2, 2, 3),
assessment_date = lubridate::dmy(c("1/12/2009",
"4/1/2010",
"1/1/2010",
NA_character_,
"5/1/2010")),
performance_status_ecog = c("3=Limited self care",
"2=Capable of self care",
NA_character_,
"0=Fully active",
"1=Ambulatory"),
stringsAsFactors = FALSE
)
d$hcv_weight_height <- data.frame(
patient_id = c(1, 2, 3),
assessment_date = lubridate::dmy(c("1/12/2009",
"1/10/2009",
"5/1/2010")),
weight = c(58, 103, 24),
height = c(162, 181, 136),
stringsAsFactors = FALSE
)
d$hcv_genotype <- data.frame(
patient_id = c(1, 1,
2, 2,
3),
samp_date = lubridate::dmy(c("5/1/2010", "12/12/2009",
"5/1/2010", "1/1/2010",
NA_character_)),
hcv_genotype_done = c("Yes", "Yes",
"No", "Yes",
NA_character_),
hcv_genotype = c("Genotype 1", "Genotype 2",
"Genotype 3", "Genotype 4",
NA_character_),
hcv_genotype_sub_type = c("Subtype a",
"Subtype b",
"Subtype c",
"Subtype d",
"Subtype e"),
fib_score = c("F0 no fibrosis",
"F1 mild fibrosis",
"F2 moderate fibrosis",
NA_character_,
"F4 cirrhosis"),
child_pugh = c(5, 10, NA_integer_, 16, 12),
stringsAsFactors = FALSE
)
d$hcv_treatment <- data.frame(
patient_id = c(1, 1, 1,
2, 2,
3, 3),
visit_date = lubridate::dmy(c("1/1/2010", "5/1/2010", NA_character_,
"12/12/2009", "1/1/2010",
"20/3/2011", "20/3/2011")),
tx_status = c("Eligible / Already under treatment", "Eligible / Already under treatment",
"Not eligible",
"Not eligible", "Not eligible",
"Follow up after treatment", "Follow up after treatment"),
tx_decision = c("Initiation/ Re-initiation", "Initiation/ Re-initiation", "Initiation/ Re-initiation",
"Modification due to adverse event", "Initiation/ Re-initiation",
"Initiation/ Re-initiation", "Initiation/ Re-initiation"),
tx_prescribed = c("SOF/DCV (FDC)", "GLE/PIB (FDC)", "SOF/DCV (FDC)",
"GLE/PIB (FDC)", "SOF/DCV (FDC)",
"Sofosbuvir (SOF)","Daclatasvir (DCV)"),
stringsAsFactors = FALSE
)
d$hcv_end <- data.frame(
patient_id = c(1, 2, 3, 3),
end_date = lubridate::dmy("12/12/2009",
"1/9/2010",
NA_character_,
"1/12/2011"),
outcome = c("Died",
"Cured",
"LTFU during treatment",
"Failed"),
end_fu = c("Yes", "Unknown", NA_character_, "No"),
end_fu_reason = c("Death", "Cured", "Loss to Follow up", NA_character_),
stringsAsFactors = FALSE
)
# save
saveRDS(d, "inst/testdata/testdata-prepare_hcv_report_data.rds", version = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.