Skip to content

Commit

Permalink
tests for filtering forms of metadata
Browse files Browse the repository at this point in the history
ref #445
  • Loading branch information
wibeasley committed Oct 22, 2022
1 parent 2339468 commit 86b7eb7
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
structure(list(field_name = c("record_id", "name_first", "name_last",
"address", "telephone", "email", "dob", "age", "sex", "race",
"ethnicity", "interpreter_needed"), form_name = c("demographics",
"demographics", "demographics", "demographics", "demographics",
"demographics", "demographics", "demographics", "demographics",
"race_and_ethnicity", "race_and_ethnicity", "race_and_ethnicity"
), section_header = c(NA, "Contact Information", NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA), field_type = c("text", "text", "text",
"notes", "text", "text", "text", "text", "radio", "checkbox",
"radio", "truefalse"), field_label = c("Study ID", "First Name",
"Last Name", "Street, City, State, ZIP", "Phone number", "E-mail",
"Date of birth", "Age (years)", "Gender", "Race (Select all that apply)",
"Ethnicity", "Are interpreter services requested?"), select_choices_or_calculations = c(NA,
NA, NA, NA, NA, NA, NA, NA, "0, Female | 1, Male", "1, American Indian/Alaska Native | 2, Asian | 3, Native Hawaiian or Other Pacific Islander | 4, Black or African American | 5, White | 6, Unknown / Not Reported",
"0, Unknown / Not Reported | 1, NOT Hispanic or Latino | 2, Hispanic or Latino",
NA), field_note = c(NA, NA, NA, NA, "Include Area Code", NA,
NA, NA, NA, NA, NA, NA), text_validation_type_or_show_slider_number = c(NA,
NA, NA, NA, "phone", "email", "date_ymd", NA, NA, NA, NA, NA),
text_validation_min = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_), text_validation_max = c(NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), identifier = c(NA, "y", "y",
"y", "y", "y", "y", NA, NA, NA, NA, NA), branching_logic = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), required_field = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), custom_alignment = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), question_number = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), matrix_group_name = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), matrix_ranking = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), field_annotation = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_)), row.names = c(NA,
-12L), class = c("tbl_df", "tbl", "data.frame"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
structure(list(field_name = c("record_id", "name_first", "name_last",
"address", "telephone", "email", "dob", "age", "sex"), form_name = c("demographics",
"demographics", "demographics", "demographics", "demographics",
"demographics", "demographics", "demographics", "demographics"
), section_header = c(NA, "Contact Information", NA, NA, NA,
NA, NA, NA, NA), field_type = c("text", "text", "text", "notes",
"text", "text", "text", "text", "radio"), field_label = c("Study ID",
"First Name", "Last Name", "Street, City, State, ZIP", "Phone number",
"E-mail", "Date of birth", "Age (years)", "Gender"), select_choices_or_calculations = c(NA,
NA, NA, NA, NA, NA, NA, NA, "0, Female | 1, Male"), field_note = c(NA,
NA, NA, NA, "Include Area Code", NA, NA, NA, NA), text_validation_type_or_show_slider_number = c(NA,
NA, NA, NA, "phone", "email", "date_ymd", NA, NA), text_validation_min = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), text_validation_max = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), identifier = c(NA,
"y", "y", "y", "y", "y", "y", NA, NA), branching_logic = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), required_field = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), custom_alignment = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), question_number = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), matrix_group_name = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), matrix_ranking = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), field_annotation = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_)), row.names = c(NA,
-9L), class = c("tbl_df", "tbl", "data.frame"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
structure(list(field_name = c("height", "weight", "bmi", "comments",
"mugshot"), form_name = c("health", "health", "health", "health",
"health"), section_header = c(NA, NA, NA, "General Comments",
NA), field_type = c("text", "text", "calc", "notes", "file"),
field_label = c("Height (cm)", "Weight (kilograms)", "BMI",
"Comments", "Mugshot"), select_choices_or_calculations = c(NA,
NA, "round(([weight]*10000)/(([height])^(2)),1)", NA, NA),
field_note = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), text_validation_type_or_show_slider_number = c("number",
"integer", NA, NA, NA), text_validation_min = c("130", "35",
NA, NA, NA), text_validation_max = c("215", "200", NA, NA,
NA), identifier = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), branching_logic = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
), required_field = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), custom_alignment = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
), question_number = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), matrix_group_name = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
), matrix_ranking = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_), field_annotation = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
)), row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"
))
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
structure(list(field_name = c("race", "ethnicity", "interpreter_needed"
), form_name = c("race_and_ethnicity", "race_and_ethnicity",
"race_and_ethnicity"), section_header = c(NA_character_, NA_character_,
NA_character_), field_type = c("checkbox", "radio", "truefalse"
), field_label = c("Race (Select all that apply)", "Ethnicity",
"Are interpreter services requested?"), select_choices_or_calculations = c("1, American Indian/Alaska Native | 2, Asian | 3, Native Hawaiian or Other Pacific Islander | 4, Black or African American | 5, White | 6, Unknown / Not Reported",
"0, Unknown / Not Reported | 1, NOT Hispanic or Latino | 2, Hispanic or Latino",
NA), field_note = c(NA_character_, NA_character_, NA_character_
), text_validation_type_or_show_slider_number = c(NA_character_,
NA_character_, NA_character_), text_validation_min = c(NA_character_,
NA_character_, NA_character_), text_validation_max = c(NA_character_,
NA_character_, NA_character_), identifier = c(NA_character_,
NA_character_, NA_character_), branching_logic = c(NA_character_,
NA_character_, NA_character_), required_field = c(NA_character_,
NA_character_, NA_character_), custom_alignment = c(NA_character_,
NA_character_, NA_character_), question_number = c(NA_character_,
NA_character_, NA_character_), matrix_group_name = c(NA_character_,
NA_character_, NA_character_), matrix_ranking = c(NA_character_,
NA_character_, NA_character_), field_annotation = c(NA_character_,
NA_character_, NA_character_)), row.names = c(NA, -3L), class = c("tbl_df",
"tbl", "data.frame"))
24 changes: 2 additions & 22 deletions inst/test-data/specific-redcapr/metadata-read/normal.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,5 @@ NA, NA, NA, NA, NA, NA, "130", "35", NA, NA, NA, NA, NA, NA),
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_)), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -17L), spec = structure(list(
cols = list(field_name = structure(list(), class = c("collector_character",
"collector")), form_name = structure(list(), class = c("collector_character",
"collector")), section_header = structure(list(), class = c("collector_character",
"collector")), field_type = structure(list(), class = c("collector_character",
"collector")), field_label = structure(list(), class = c("collector_character",
"collector")), select_choices_or_calculations = structure(list(), class = c("collector_character",
"collector")), field_note = structure(list(), class = c("collector_character",
"collector")), text_validation_type_or_show_slider_number = structure(list(), class = c("collector_character",
"collector")), text_validation_min = structure(list(), class = c("collector_character",
"collector")), text_validation_max = structure(list(), class = c("collector_character",
"collector")), identifier = structure(list(), class = c("collector_character",
"collector")), branching_logic = structure(list(), class = c("collector_character",
"collector")), required_field = structure(list(), class = c("collector_character",
"collector")), custom_alignment = structure(list(), class = c("collector_character",
"collector")), question_number = structure(list(), class = c("collector_character",
"collector")), matrix_group_name = structure(list(), class = c("collector_character",
"collector")), matrix_ranking = structure(list(), class = c("collector_character",
"collector")), field_annotation = structure(list(), class = c("collector_character",
"collector"))), default = structure(list(), class = c("collector_character",
"collector")), skip = 1), class = "col_spec"))
NA_character_, NA_character_)), row.names = c(NA, -17L), class = c("tbl_df",
"tbl", "data.frame"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
structure(list(field_name = c("record_id", "variable_00002",
"variable_00003", "variable_00004", "variable_00005", "variable_00012",
"variable_00013", "variable_00014", "variable_00015", "variable_00016",
"variable_00017"), form_name = c("form_0001", "form_0001", "form_0001",
"form_0001", "form_0001", "form_0003", "form_0003", "form_0003",
"form_0003", "form_0003", "form_0003"), section_header = c(NA,
NA, NA, NA, NA, "<div class=\"rich-text-field-label\"><p style=\"text-align: center;\"><span style=\"color: #000080;\">Please answer the following questions in form_0003</span></p></div>",
NA, NA, NA, NA, NA), field_type = c("text", "radio", "checkbox",
"notes", "text", "descriptive", "text", "radio", "checkbox",
"notes", "text"), field_label = c("Long description for variable record_id",
"\n <span lang=\"en\">{Name of University} is one part of a super awesome study.\n\n We will also collect some small biological samples, such as saliva.\n\n Do you have any questions about what the study involves?</span>\n\n <span lang=\"es\">La {nombre de la universidad} forma parte de un estudio fabuloso.\n\n También se colectará algunas muestras biológicas, como saliva.\n\n ¿Tiene alguna pregunta sobre lo que implica el estudio?</span>\"\n ",
"Long description for variable variable_00003", "Long description for variable variable_00004",
"Long description for variable variable_00005", "Long description for variable variable_00012",
"Long description for variable variable_00013", "Long description for variable variable_00014",
"Long description for variable variable_00015", "Long description for variable variable_00016",
"Long description for variable variable_00017"), select_choices_or_calculations = c(NA,
"1, Yup | 2, Nope | 3, Other", "1, Yup | 2, Nope | 3, Other",
NA, NA, NA, NA, "1, Yup | 2, Nope | 3, Other", "1, Yup | 2, Nope | 3, Other",
NA, NA), field_note = c("Field note record_id", "Field note variable_00002",
"Field note variable_00003", "Field note variable_00004", "Field note variable_00005",
"Field note variable_00012", "Field note variable_00013", "Field note variable_00014",
"Field note variable_00015", "Field note variable_00016", "Field note variable_00017"
), text_validation_type_or_show_slider_number = c(NA, NA, NA,
NA, "date_ymd", NA, NA, NA, NA, NA, "date_ymd"), text_validation_min = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_
), text_validation_max = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_), identifier = c(NA,
NA, NA, "y", NA, "y", NA, NA, NA, "y", NA), branching_logic = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_
), required_field = c(NA, "y", NA, "y", NA, NA, NA, "y", NA,
"y", NA), custom_alignment = c(NA, NA, NA, NA, "RH", NA, NA,
NA, "RH", NA, NA), question_number = c(NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_),
matrix_group_name = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
), matrix_ranking = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
), field_annotation = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
)), row.names = c(NA, -11L), class = c("tbl_df", "tbl", "data.frame"
))
Loading

0 comments on commit 86b7eb7

Please sign in to comment.