Introducing framework for testthat tests

This commit is contained in:
pegeler 2018-06-25 00:39:56 -04:00
parent 4f2974701c
commit 4d6ee65d98
6 changed files with 4154 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.html
.Rhistory
.Rproj.user
test-data/

View File

@ -1,4 +1,4 @@
# library(testthat)
# library(REDCapRITS)
#
# test_check("REDCapRITS")
library(testthat)
library(REDCapRITS)
test_check("REDCapRITS")

View File

@ -0,0 +1,11 @@
record_id,redcap_event_name,redcap_repeat_instrument,redcap_repeat_instance,redcap_data_access_group,redcap_survey_identifier,informed_consent_and_addendum_timestamp,icf_first_name,icf_last_name,icf_date,icf_sign,icf_consenter_name,icf_consentee_info,icf_consentee_sign,icf_consentee_date,informed_consent_and_addendum_complete,signed_consent_1,signed_consent_2,signed_consent_3,signed_addendum1,signed_addendum2,signed_addendum3,upload_of_signed_icfs_complete,demo_date,demo_name_first,demo_name_init,demo_name_last,demo_date_birth,demo_street_ad,demo_city_ad,demo_state_ad,demo_zip,demo_daytime,demo_email,demo_ethnic,demo_racial,demo_racial_oth,demo_military_mrn,demo_ssn,demographics_complete,elig_icf,elig_ischem,elig_signs___1,elig_signs___2,elig_signs___3,elig_signs___4,elig_card_cath,elig_card_cath_details,elig_cath_disease_severity,elig_cath_vessel,elig_ejection_fraction,elig_cath_ffr,elig_ccta,elig_card_cath_details_2,elig_cath_disease_severity_2,elig_ejection_fraction_2,elig_cta_score,elig_nocom_med,elig_ischemia_dilated,elig_doc_acs,elig_lvef,elig_nyha_class,elig_hos_hfref,elig_stroke,elig_carnial_hemo,elig_renal,elig_valvular,elig_life_expect,elig_enroll_clinic,elig_intol_ace,elig_intol_arb,elig_intol_statin,elig_intol_pcsk,elig_preg,elig_liver_dis,elig_hist_rhab,elig_high_dose,elig_study_yes,elig_date,elig_study_no,eligibility_complete
806-1,baseline_arm_1,,,uf_test,,,,,,,,,,,,[document],,,[document],,,2,2018-05-08,Philip,B,Chase,1964-04-09,"5959 NW 13th Ave",Gainesville,FL,32605,"(352) 555-0760",bobsyouruncle@example.org,2,5,,2,111-22-3333,2,1,1,1,0,0,0,1,1,,,60,1,1,1,,60,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,1,2018-05-08,,2
806-1,followup_month_3_arm_1,,,uf_test,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-1,baseline_arm_1,informed_consent,1,uf_test,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-1,baseline_arm_1,informed_consent_and_addendum,1,uf_test,,"2018-05-08 21:15:12",Philip,Chase,2018-05-08,[document],"Philip B Chase",UF,[document],2018-05-08,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-1,baseline_arm_1,informed_consent_and_addendum,2,uf_test,,,Bobs,Youruncle,2018-06-21,[document],"Yo Mama","Anywhere she wants",[document],2018-06-21,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-1,baseline_arm_1,informed_consent_and_addendum,3,uf_test,,,Bobs,Youruncle,2018-06-21,[document],zsdf,DF,[document],2018-06-21,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-2,baseline_arm_1,,,uf_test,,,,,,,,,,,,[document],,,[document],,,2,2018-05-08,afadgs,afd,afdsgfd,1977-06-26,24325543,2352453,fwef,32601,"(352) 294-5299",,2,89,,,123-45-6789,2,1,1,0,1,0,0,0,,,,,,0,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,1,2018-05-08,,2
806-2,followup_month_3_arm_1,,,uf_test,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-2,baseline_arm_1,informed_consent,1,uf_test,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
806-2,baseline_arm_1,informed_consent_and_addendum,1,uf_test,,"2018-05-08 21:02:39",test,test,2018-05-08,[document],taryn,stoffs,[document],2018-05-08,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1 record_id redcap_event_name redcap_repeat_instrument redcap_repeat_instance redcap_data_access_group redcap_survey_identifier informed_consent_and_addendum_timestamp icf_first_name icf_last_name icf_date icf_sign icf_consenter_name icf_consentee_info icf_consentee_sign icf_consentee_date informed_consent_and_addendum_complete signed_consent_1 signed_consent_2 signed_consent_3 signed_addendum1 signed_addendum2 signed_addendum3 upload_of_signed_icfs_complete demo_date demo_name_first demo_name_init demo_name_last demo_date_birth demo_street_ad demo_city_ad demo_state_ad demo_zip demo_daytime demo_email demo_ethnic demo_racial demo_racial_oth demo_military_mrn demo_ssn demographics_complete elig_icf elig_ischem elig_signs___1 elig_signs___2 elig_signs___3 elig_signs___4 elig_card_cath elig_card_cath_details elig_cath_disease_severity elig_cath_vessel elig_ejection_fraction elig_cath_ffr elig_ccta elig_card_cath_details_2 elig_cath_disease_severity_2 elig_ejection_fraction_2 elig_cta_score elig_nocom_med elig_ischemia_dilated elig_doc_acs elig_lvef elig_nyha_class elig_hos_hfref elig_stroke elig_carnial_hemo elig_renal elig_valvular elig_life_expect elig_enroll_clinic elig_intol_ace elig_intol_arb elig_intol_statin elig_intol_pcsk elig_preg elig_liver_dis elig_hist_rhab elig_high_dose elig_study_yes elig_date elig_study_no eligibility_complete
2 806-1 baseline_arm_1 uf_test [document] [document] 2 2018-05-08 Philip B Chase 1964-04-09 5959 NW 13th Ave Gainesville FL 32605 (352) 555-0760 bobsyouruncle@example.org 2 5 2 111-22-3333 2 1 1 1 0 0 0 1 1 60 1 1 1 60 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2018-05-08 2
3 806-1 followup_month_3_arm_1 uf_test
4 806-1 baseline_arm_1 informed_consent 1 uf_test
5 806-1 baseline_arm_1 informed_consent_and_addendum 1 uf_test 2018-05-08 21:15:12 Philip Chase 2018-05-08 [document] Philip B Chase UF [document] 2018-05-08 2
6 806-1 baseline_arm_1 informed_consent_and_addendum 2 uf_test Bobs Youruncle 2018-06-21 [document] Yo Mama Anywhere she wants [document] 2018-06-21 2
7 806-1 baseline_arm_1 informed_consent_and_addendum 3 uf_test Bobs Youruncle 2018-06-21 [document] zsdf DF [document] 2018-06-21 2
8 806-2 baseline_arm_1 uf_test [document] [document] 2 2018-05-08 afadgs afd afdsgfd 1977-06-26 24325543 2352453 fwef 32601 (352) 294-5299 2 89 123-45-6789 2 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2018-05-08 2
9 806-2 followup_month_3_arm_1 uf_test
10 806-2 baseline_arm_1 informed_consent 1 uf_test
11 806-2 baseline_arm_1 informed_consent_and_addendum 1 uf_test 2018-05-08 21:02:39 test test 2018-05-08 [document] taryn stoffs [document] 2018-05-08 2

View File

@ -0,0 +1,3 @@
# Longitudinal data from @pbchase; Issue #7 -------------------------------
# Something will go here.

View File

@ -0,0 +1,20 @@
context("Longitudinal data")
test_that("CSV export matches reference", {
# Reading in the files
file_paths <- file.path(
system.file("tests", "testthat", "data", package = "REDCapRITS"),
c(
records = "WARRIORtestForSoftwa_DATA_2018-06-21_1431.csv",
metadata = "WARRIORtestForSoftwareUpgrades_DataDictionary_2018-06-21.csv"
)
)
redcap <- lapply(file_paths, read.csv, stringsAsFactors = FALSE)
names(redcap) <- c("records", "metadata")
redcap[["metadata"]] <- with(redcap, metadata[metadata[,1] > "",])
redcap_output <- with(redcap, REDCap_split(records, metadata))
expect_known_hash(redcap_output, "dff3a52955")
})