Skip to content

Commit

Permalink
don't compare mugshot/file ids
Browse files Browse the repository at this point in the history
ref #539
  • Loading branch information
wibeasley committed Oct 13, 2024
1 parent e8abc0f commit 818ca98
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
structure(list(record = c("1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2",
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
"2", "2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3",
"2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3", "3", "3",
"3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
"3", "3", "3", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4",
"4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "5", "5", "5",
"4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4",
"4", "4", "4", "4", "4", "4", "5", "5", "5", "5", "5", "5", "5",
"5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5",
"5", "5", "5", "5", "5", "6", "6", "6", "6"), field_name = c("address",
"age", "bmi", "comments", "demographics_complete", "dob", "email",
"ethnicity", "health_complete", "height", "interpreter_needed",
"mugshot", "name_first", "name_last", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "address", "age",
"bmi", "comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "interpreter_needed", "mugshot",
"name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "address", "age",
"bmi", "comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "interpreter_needed", "mugshot",
"6", "6", "6", "6"), field_name = c("address", "age", "bmi",
"comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "interpreter_needed", "name_first",
"name_last", "race", "race_and_ethnicity_complete", "record_id",
"sex", "telephone", "weight", "address", "age", "bmi", "comments",
"demographics_complete", "dob", "email", "ethnicity", "health_complete",
"height", "interpreter_needed", "name_first", "name_last", "race",
"race", "race_and_ethnicity_complete", "record_id", "sex", "telephone",
"weight", "address", "age", "bmi", "comments", "demographics_complete",
"dob", "email", "ethnicity", "health_complete", "height", "interpreter_needed",
"name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "address", "age",
"bmi", "comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "mugshot", "name_first", "name_last",
"race", "race", "race_and_ethnicity_complete", "record_id", "sex",
"telephone", "weight", "address", "age", "bmi", "comments", "demographics_complete",
"health_complete", "height", "name_first", "name_last", "race",
"race", "race_and_ethnicity_complete", "record_id", "sex", "telephone",
"weight", "address", "age", "bmi", "comments", "demographics_complete",
"dob", "email", "ethnicity", "health_complete", "height", "interpreter_needed",
"mugshot", "name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "name_first", "name_last",
"demographics_complete", "record_id"), value = c("14 Rose Cottage St.\nKenning UK, 323232",
"11", "204.1", "Character in a book, with some guessing", "2",
"2003-08-30", "[email protected]", "1", "1", "7", "0", "324901",
"Nutmeg", "Nutmouse", "5", "2", "1", "0", "(405) 321-1111", "1",
"14 Rose Cottage Blvd.\nKenning UK 34243", "11", "277.8", "A mouse character from a good book",
"2", "2003-03-10", "[email protected]", "1", "0", "6", "0", "324902",
"Tumtum", "Nutmouse", "3", "5", "0", "2", "1", "(405) 321-2222",
"1", "243 Hill St.\nGuthrie OK 73402", "80", "24.7", "completely made up",
"2", "1934-04-09", "[email protected]", "0", "2", "180", "1", "324903",
"Marcus", "Wood", "4", "5", "2", "3", "1", "(405) 321-3333",
"80", "342 Elm\nDuncanville TX, 75116", "61", "19.8", "This record doesn't have a DAG assigned\n\nSo call up Trudy on the telephone\nSend her a letter in the mail",
"2", "1952-11-02", "[email protected]", "1", "2", "165", "324904",
"Trudy", "DAG", "2", "5", "2", "4", "0", "(405) 321-4444", "54",
"Hotel Suite\nNew Orleans LA, 70115", "59", "27.9", "Had a hand for trouble and a eye for cash\n\nHe had a gold watch chain and a black mustache",
"2003-08-30", "[email protected]", "1", "1", "7", "0", "Nutmeg",
"Nutmouse", "5", "2", "1", "0", "(405) 321-1111", "1", "14 Rose Cottage Blvd.\nKenning UK 34243",
"11", "277.8", "A mouse character from a good book", "2", "2003-03-10",
"[email protected]", "1", "0", "6", "0", "Tumtum", "Nutmouse",
"3", "5", "0", "2", "1", "(405) 321-2222", "1", "243 Hill St.\nGuthrie OK 73402",
"80", "24.7", "completely made up", "2", "1934-04-09", "[email protected]",
"0", "2", "180", "1", "Marcus", "Wood", "4", "5", "2", "3", "1",
"(405) 321-3333", "80", "342 Elm\nDuncanville TX, 75116", "61",
"19.8", "This record doesn't have a DAG assigned\n\nSo call up Trudy on the telephone\nSend her a letter in the mail",
"2", "1952-11-02", "[email protected]", "1", "2", "165", "Trudy",
"DAG", "2", "5", "2", "4", "0", "(405) 321-4444", "54", "Hotel Suite\nNew Orleans LA, 70115",
"59", "27.9", "Had a hand for trouble and a eye for cash\n\nHe had a gold watch chain and a black mustache",
"2", "1955-04-15", "[email protected]", "2", "0", "193.04",
"0", "324905", "John Lee", "Walker", "1", "6", "2", "5", "1",
"(405) 321-5555", "104", "blank-for-gray", "blank-for-gray",
"0", "6")), row.names = c(NA, -107L), spec = structure(list(cols = list(
record = structure(list(), class = c("collector_character",
"collector")), field_name = structure(list(), class = c("collector_character",
"collector")), value = structure(list(), class = c("collector_character",
"collector"))), default = structure(list(), class = c("collector_character",
"collector")), delim = ","), class = "col_spec"), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"))
"0", "John Lee", "Walker", "1", "6", "2", "5", "1", "(405) 321-5555",
"104", "blank-for-gray", "blank-for-gray", "0", "6")), row.names = c(NA,
-102L), class = c("tbl_df", "tbl", "data.frame"))
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
structure(list(record = c("1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2",
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
"2", "2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3",
"2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3", "3", "3",
"3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
"3", "3", "3", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4",
"4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "5", "5", "5",
"4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4",
"4", "4", "4", "4", "4", "4", "5", "5", "5", "5", "5", "5", "5",
"5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5",
"5", "5", "5", "5", "5", "6", "6", "6", "6"), field_name = c("address",
"age", "bmi", "comments", "demographics_complete", "dob", "email",
"ethnicity", "health_complete", "height", "interpreter_needed",
"mugshot", "name_first", "name_last", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "address", "age",
"bmi", "comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "interpreter_needed", "mugshot",
"name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "address", "age",
"bmi", "comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "interpreter_needed", "mugshot",
"6", "6", "6", "6"), field_name = c("address", "age", "bmi",
"comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "interpreter_needed", "name_first",
"name_last", "race", "race_and_ethnicity_complete", "record_id",
"sex", "telephone", "weight", "address", "age", "bmi", "comments",
"demographics_complete", "dob", "email", "ethnicity", "health_complete",
"height", "interpreter_needed", "name_first", "name_last", "race",
"race", "race_and_ethnicity_complete", "record_id", "sex", "telephone",
"weight", "address", "age", "bmi", "comments", "demographics_complete",
"dob", "email", "ethnicity", "health_complete", "height", "interpreter_needed",
"name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "address", "age",
"bmi", "comments", "demographics_complete", "dob", "email", "ethnicity",
"health_complete", "height", "mugshot", "name_first", "name_last",
"race", "race", "race_and_ethnicity_complete", "record_id", "sex",
"telephone", "weight", "address", "age", "bmi", "comments", "demographics_complete",
"health_complete", "height", "name_first", "name_last", "race",
"race", "race_and_ethnicity_complete", "record_id", "sex", "telephone",
"weight", "address", "age", "bmi", "comments", "demographics_complete",
"dob", "email", "ethnicity", "health_complete", "height", "interpreter_needed",
"mugshot", "name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"name_first", "name_last", "race", "race", "race_and_ethnicity_complete",
"record_id", "sex", "telephone", "weight", "name_first", "name_last",
"demographics_complete", "record_id"), value = c("14 Rose Cottage St.\nKenning UK, 323232",
"11", "204.1", "Character in a book, with some guessing", "2",
"2003-08-30", "[email protected]", "1", "1", "7", "0", "324901",
"Nutmeg", "Nutmouse", "5", "2", "1", "0", "(405) 321-1111", "1",
"14 Rose Cottage Blvd.\nKenning UK 34243", "11", "277.8", "A mouse character from a good book",
"2", "2003-03-10", "[email protected]", "1", "0", "6", "0", "324902",
"Tumtum", "Nutmouse", "3", "5", "0", "2", "1", "(405) 321-2222",
"1", "243 Hill St.\nGuthrie OK 73402", "80", "24.7", "completely made up",
"2", "1934-04-09", "[email protected]", "0", "2", "180", "1", "324903",
"Marcus", "Wood", "4", "5", "2", "3", "1", "(405) 321-3333",
"80", "342 Elm\nDuncanville TX, 75116", "61", "19.8", "This record doesn't have a DAG assigned\n\nSo call up Trudy on the telephone\nSend her a letter in the mail",
"2", "1952-11-02", "[email protected]", "1", "2", "165", "324904",
"Trudy", "DAG", "2", "5", "2", "4", "0", "(405) 321-4444", "54",
"Hotel Suite\nNew Orleans LA, 70115", "59", "27.9", "Had a hand for trouble and a eye for cash\n\nHe had a gold watch chain and a black mustache",
"2003-08-30", "[email protected]", "1", "1", "7", "0", "Nutmeg",
"Nutmouse", "5", "2", "1", "0", "(405) 321-1111", "1", "14 Rose Cottage Blvd.\nKenning UK 34243",
"11", "277.8", "A mouse character from a good book", "2", "2003-03-10",
"[email protected]", "1", "0", "6", "0", "Tumtum", "Nutmouse",
"3", "5", "0", "2", "1", "(405) 321-2222", "1", "243 Hill St.\nGuthrie OK 73402",
"80", "24.7", "completely made up", "2", "1934-04-09", "[email protected]",
"0", "2", "180", "1", "Marcus", "Wood", "4", "5", "2", "3", "1",
"(405) 321-3333", "80", "342 Elm\nDuncanville TX, 75116", "61",
"19.8", "This record doesn't have a DAG assigned\n\nSo call up Trudy on the telephone\nSend her a letter in the mail",
"2", "1952-11-02", "[email protected]", "1", "2", "165", "Trudy",
"DAG", "2", "5", "2", "4", "0", "(405) 321-4444", "54", "Hotel Suite\nNew Orleans LA, 70115",
"59", "27.9", "Had a hand for trouble and a eye for cash\n\nHe had a gold watch chain and a black mustache",
"2", "1955-04-15", "[email protected]", "2", "0", "193.04",
"0", "324905", "John Lee", "Walker", "1", "6", "2", "5", "1",
"(405) 321-5555", "104", "blank-for-gray", "blank-for-gray",
"0", "6")), row.names = c(NA, -107L), spec = structure(list(cols = list(
record = structure(list(), class = c("collector_character",
"collector")), field_name = structure(list(), class = c("collector_character",
"collector")), value = structure(list(), class = c("collector_character",
"collector"))), default = structure(list(), class = c("collector_character",
"collector")), delim = ","), class = "col_spec"), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"))
"0", "John Lee", "Walker", "1", "6", "2", "5", "1", "(405) 321-5555",
"104", "blank-for-gray", "blank-for-gray", "0", "6")), row.names = c(NA,
-102L), class = c("tbl_df", "tbl", "data.frame"))
21 changes: 12 additions & 9 deletions tests/testthat/test-read-eav-oneshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ test_that("default", {

expect_s3_class(returned_object$data, "tbl")
})


test_that("specify-records", {
testthat::skip_on_cran()
path_expected <- "test-data/specific-redcapr/read-eav-oneshot/specify-records.R"
Expand Down Expand Up @@ -155,7 +153,6 @@ test_that("specify-fields-zero-length", {

expect_s3_class(returned_object$data, "tbl")
})

test_that("specify-forms", {
testthat::skip_on_cran()
path_expected <- "test-data/specific-redcapr/read-eav-oneshot/specify-forms.R"
Expand Down Expand Up @@ -255,10 +252,14 @@ test_that("blank-for-gray-status-true", {
verbose = FALSE
)

if (update_expectation) save_expected(returned_object$data, path_expected)
d <-
returned_object$data |>
dplyr::filter(field_name != "mugshot") # Don't compare file IDs across servers.

if (update_expectation) save_expected(d, path_expected)
expected_data_frame <- retrieve_expected(path_expected)

expect_equal(returned_object$data, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data)
expect_equal(d, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data)
expect_equal(returned_object$status_code, expected=200L)
expect_equal(returned_object$raw_text, expected="", ignore_attr = TRUE) # dput(returned_object$raw_text)
expect_true(returned_object$records_collapsed=="", "A subset of records was not requested.")
Expand All @@ -283,10 +284,14 @@ test_that("blank-for-gray-status-false", {
verbose = FALSE
)

if (update_expectation) save_expected(returned_object$data, path_expected)
d <-
returned_object$data |>
dplyr::filter(field_name != "mugshot") # Don't compare file IDs across servers.

if (update_expectation) save_expected(d, path_expected)
expected_data_frame <- retrieve_expected(path_expected)

expect_equal(returned_object$data, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data)
expect_equal(d, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data)
expect_equal(returned_object$status_code, expected=200L)
expect_equal(returned_object$raw_text, expected="", ignore_attr = TRUE) # dput(returned_object$raw_text)
expect_true(returned_object$records_collapsed=="", "A subset of records was not requested.")
Expand All @@ -297,7 +302,6 @@ test_that("blank-for-gray-status-false", {

expect_s3_class(returned_object$data, "tbl")
})

test_that("date-range", {
testthat::skip_on_cran()
expected_outcome_message <- "\\d+ records and \\d+ columns were read from REDCap in \\d+(\\.\\d+\\W|\\W)seconds\\."
Expand Down Expand Up @@ -327,7 +331,6 @@ test_that("date-range", {

expect_s3_class(returned_object$data, "tbl")
})

test_that("bad token -Error", {
testthat::skip_on_cran()
expected_outcome_message <- "The REDCapR read/export operation was not successful\\."
Expand Down

0 comments on commit 818ca98

Please sign in to comment.