Skip to content

Commit 8c75a12

Browse files
authored
Merge pull request #526 from jrob95/patch-1
Update redcap-survey-link-export-oneshot.R
2 parents e97e124 + 076c268 commit 8c75a12

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

R/redcap-survey-link-export-oneshot.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#' @title
2-
#' Download a file from a REDCap project record
2+
#' Get survey link from REDCap
33
#'
44
#' @description
5-
#' This function uses REDCap's API to download a file.
5+
#' This function uses REDCap's API to get the link for a survey.
66
#'
77
#' @param redcap_uri The
88
#' [uri](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)/url
@@ -11,10 +11,12 @@
1111
#' Required.
1212
#' @param token The user-specific string that serves as the password for a
1313
#' project. Required.
14-
#' @param record The record ID where the file is to be imported. Required
14+
#' @param record The record ID associated with the
15+
#' survey link. Required
1516
#' @param instrument The name of the instrument associated with the
1617
#' survey link. Required
17-
#' @param event The name of the event where the file is saved in REDCap.
18+
#' @param event The name of the event associated with the
19+
#' survey link.
1820
#' Optional
1921
#' @param verbose A boolean value indicating if `message`s should be printed
2022
#' to the R console during the operation. Optional.
@@ -27,21 +29,22 @@
2729
#'
2830
#' @return
2931
#' Currently, a list is returned with the following elements,
32+
#' * `survey_link`: a character string containing the URL for the survey.
3033
#' * `success`: A boolean value indicating if the operation was apparently
3134
#' successful.
3235
#' * `status_code`: The
3336
#' [http status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
3437
#' of the operation.
3538
#' * `outcome_message`: A human readable string indicating the operation's
3639
#' outcome.
37-
#' * `records_affected_count`: The number of records inserted or updated.
38-
#' * `affected_ids`: The subject IDs of the inserted or updated records.
40+
#' * `instrument`: The instrument associated with the survey link.
41+
#' * `records_affected_count`: The number of records associated with
42+
#' the survey link.
43+
#' * `affected_ids`: The subject IDs associated with the survey link.
3944
#' * `elapsed_seconds`: The duration of the function.
4045
#' * `raw_text`: If an operation is NOT successful, the text returned by
4146
#' REDCap. If an operation is successful, the `raw_text` is returned as an
4247
#' empty string to save RAM.
43-
#' * `file_name`: The name of the file persisted to disk. This is useful if
44-
#' the name stored in REDCap is used (which is the default).
4548
#'
4649
#' @details
4750
#' Currently, the function doesn't modify any variable types to conform to

tests/testthat/test-survey-link-export-oneshot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test_that("Nonexistent Record ID", {
6060
expect_equal(result$instrument, "participant_morale_questionnaire")
6161
expect_equal(result$records_affected_count, 0L)
6262
expect_equal(result$affected_ids, character(0))
63-
expect_equal(result$raw_text, "ERROR: The record '-1' does not exist")
63+
expect_equal(result$raw_text, "ERROR: The record \"-1\" does not exist")
6464
})
6565

6666
rm(credential, record, instrument)

0 commit comments

Comments
 (0)