Skip to content

Commit

Permalink
point to new server
Browse files Browse the repository at this point in the history
ref #542
  • Loading branch information
wibeasley committed Oct 14, 2024
1 parent f7989c1 commit fcc274e
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 80 deletions.
21 changes: 5 additions & 16 deletions R/redcap-metadata-coltypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,27 @@
#'
#' @examples
#' \dontrun{
#' uri <- "https://bbmc.ouhsc.edu/redcap/api/"
#' uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
#'
#' # A simple project
#' token <- "9A81268476645C4E5F03428B8AC3AA7B" # 153
#' token <- "9A068C425B1341D69E83064A2D273A70" # simple
#' col_types <- redcap_metadata_coltypes(uri, token)
#' redcap_read_oneshot(uri, token, col_types = col_types)$data
#'
#' # A longitudinal project
#' token <- "0434F0E9CF53ED0587847AB6E51DE762" # 212
#' token <- "DA6F2BB23146BD5A7EA3408C1A44A556" # longitudinal
#' col_types <- redcap_metadata_coltypes(uri, token)
#' redcap_read_oneshot(uri, token, col_types = col_types)$data
#'
#' # A repeating instruments project
#' token <- "56F43A10D01D6578A46393394D76D88F" # 2603
#' token <- "64720C527CA236880FBA785C9934F02A" # repeating-instruments-sparse
#' col_types <- redcap_metadata_coltypes(uri, token)
#' redcap_read_oneshot(uri, token, col_types = col_types)$data
#'
#' # A project with every field type and validation type.
#' # Notice it throws a warning that some fields use a comma for a decimal,
#' # while other fields use a period/dot as a decimal
#' token <- "8F5313CAA266789F560D79EFCEE2E2F1" # 2634 - Validation Types
#' token <- "EB1FD5DDE583364AE605629AB7619397" # validation-types-1
#' col_types <- redcap_metadata_coltypes(uri, token)
#' redcap_read_oneshot(uri, token, col_types = col_types)$data
#' }
Expand Down Expand Up @@ -505,14 +505,3 @@ redcap_metadata_internal <- function(
plumbing_variables = .plumbing_variables
)
}

# uri <- "https://bbmc.ouhsc.edu/redcap/api/"
#
# A simple project (pid 153)
# REDCapR:::redcap_metadata_internal(uri, "9A81268476645C4E5F03428B8AC3AA7B")$d_variable
#
# A longitudinal project (pid 212)
# REDCapR:::redcap_metadata_internal(uri, "0434F0E9CF53ED0587847AB6E51DE762")$d_variable
#
# # A repeating measures (pid 3181)
# REDCapR:::redcap_metadata_internal(uri, "22C3FF1C8B08899FB6F86D91D874A159")$d_variable
14 changes: 7 additions & 7 deletions R/redcap-metadata-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@
#'
#' @examples
#' \dontrun{
#' uri <- "https://bbmc.ouhsc.edu/redcap/api/"
#' uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
#'
#' # A simple project (pid 153)
#' token <- "9A81268476645C4E5F03428B8AC3AA7B"
#' # A simple project
#' token <- "9A068C425B1341D69E83064A2D273A70" # simple
#' REDCapR::redcap_metadata_read(redcap_uri=uri, token=token)
#'
#' # A longitudinal project (pid 212)
#' token <- "0434F0E9CF53ED0587847AB6E51DE762"
#' # A longitudinal project
#' token <- "0434F0E9CF53ED0587847AB6E51DE762" # longitudinal
#' REDCapR::redcap_metadata_read(redcap_uri=uri, token=token)
#'
#' # A repeating measures (pid 3181)
#' token <- "22C3FF1C8B08899FB6F86D91D874A159"
#' # A repeating measures
#' token <- "77842BD8C18D3408819A21DD0154CCF4" # vignette-repeating
#' REDCapR::redcap_metadata_read(redcap_uri=uri, token=token)
#' }

Expand Down
4 changes: 2 additions & 2 deletions R/redcap-metadata-write.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
#' \dontrun{
#' # Please don't run this example without changing the token to
#' # point to your server. It could interfere with our testing suite.
#' uri <- "https://bbmc.ouhsc.edu/redcap/api/"
#' token <- "457C24AB91B7FCF5B1A7DA67E70E24C7"
#' uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
#' token <- "06C38F6D76B3863DFAE84069D8DBCFFC" # metadata-write
#'
#' # Read in the dictionary in R's memory from a csv file.
#' ds_to_write <-
Expand Down
4 changes: 2 additions & 2 deletions R/redcap-survey-link-export-oneshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
#'
#' @examples
#' \dontrun{
#' uri <- "https://bbmc.ouhsc.edu/redcap/api/"
#' token <- "8FA9A6BDAE2C0B5DD3CB472DD8E8918C" # pid=817
#' uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
#' token <- "4780D038A2080BA2E7CC904A14218662" # survey
#' record <- 1
#' instrument <- "participant_morale_questionnaire"
#' # event <- "" # only for longitudinal projects
Expand Down
4 changes: 2 additions & 2 deletions R/redcap-users-export.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
#'
#' @examples
#' \dontrun{
#' uri <- "https://bbmc.ouhsc.edu/redcap/api/"
#' token <- "06DEFB601F9B46847DAA9DF0CFA951B4"
#' uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
#' token <- "0BF920AAF9566A8E603F528A498A5729" # dag
#' result <- REDCapR::redcap_users_export(redcap_uri=uri, token=token)
#' result$data_user
#' result$data_user_form
Expand Down
2 changes: 1 addition & 1 deletion documentation-for-developers/r-medicine-2024-part-1.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ View(ds_1)


# View corresponding REDCap project in browser:
# https://bbmc.ouhsc.edu/redcap/redcap_v14.3.13/DataEntry/record_home.php?pid=3181&arm=1&id=1
# https://redcap-dev-2.ouhsc.edu/redcap/redcap_v14.3.13/DataEntry/record_home.php?pid=62&arm=1&id=1


# ---- redcap_metadata_read ----------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions inst/test-data/project-color-boxes/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ id,redcap_data_access_group,color___r,color___g,color___b,color___p,thisform_com

The url and token of the project are:
```r
url <- "https://bbmc.ouhsc.edu/redcap/api"
url <- "https://redcap-dev-2.ouhsc.edu/redcap/api"
token <- "BECD55331CA005887DA3543230E10284"
```

Here's some (slightly modified) code that Benjamin wrote for Issue #51:
```r
> url <- "https://bbmc.ouhsc.edu/redcap/api/"
> url <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
> token <- "BECD55331CA005887DA3543230E10284"
>
> post_result_all <- httr::POST(url=url, body=list(token=token, content='record', format='csv', rawOrLabel='label', fields='id, color'))
Expand Down
10 changes: 5 additions & 5 deletions man/redcap_metadata_coltypes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions man/redcap_metadata_read.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/redcap_metadata_write.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/redcap_survey_link_export_oneshot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/redcap_users_export.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions playgrounds/Breaking_batch.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library(REDCapR)
uri<-"https://bbmc.ouhsc.edu/redcap/api/"
token<-"9A81268476645C4E5F03428B8AC3AA7B"
uri<-"https://redcap-dev-2.ouhsc.edu/redcap/api/"
token<-"9A068C425B1341D69E83064A2D273A70"
dummy_data<-redcap_read_oneshot(redcap_uri=uri, token=token)$data

#testing create_batch_glossary function
Expand Down
4 changes: 2 additions & 2 deletions playgrounds/cron-trigger-hack.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use this hack if the cronjob isn't running properly on the server,
# But the cronjob link is working (see bottom of https://bbmc.ouhsc.edu/redcap/redcap_v10.5.1/ControlCenter/cron_jobs.php)
# But the cronjob link is working (see bottom of https://redcap-dev-2.ouhsc.edu/redcap/redcap_v10.5.1/ControlCenter/cron_jobs.php)

httr::GET("https://redcap.ouhsc.edu/redcap/cron.php")
# httr::GET("https://bbmc.ouhsc.edu/redcap/cron.php")
# httr::GET("https://redcap-dev-2.ouhsc.edu/redcap/cron.php")
8 changes: 4 additions & 4 deletions tests/testthat/test-read-errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test_that("One Shot: Bad Uri -Not HTTPS", {

expect_error(
redcap_read_oneshot(
redcap_uri = "http://bbmc.ouhsc.edu/redcap/api/", # Not HTTPS
redcap_uri = "http://redcap-dev-2.ouhsc.edu/redcap/api/", # Not HTTPS
token = credential$token
)
)
Expand All @@ -22,7 +22,7 @@ test_that("One Shot: Bad Uri -wrong address", {

returned_object <-
redcap_read_oneshot(
redcap_uri = "https://bbmc.ouhsc.edu/redcap/apiFFFFFFFFFFFFFF/", # Wrong url
redcap_uri = "https://redcap-dev-2.ouhsc.edu/redcap/apiFFFFFFFFFFFFFF/", # Wrong url
token = credential$token,
verbose = FALSE
)
Expand All @@ -43,7 +43,7 @@ test_that("Batch: Bad Uri -Not HTTPS", {

expect_error(
redcap_read(
redcap_uri = "http://bbmc.ouhsc.edu/redcap/api/", # Not HTTPS
redcap_uri = "http://redcap-dev-2.ouhsc.edu/redcap/api/", # Not HTTPS
token = credential$token
)
)
Expand All @@ -56,7 +56,7 @@ test_that("Batch: Bad Uri -wrong address", {

expect_error(
redcap_read(
redcap_uri = "https://bbmc.ouhsc.edu/redcap/apiFFFFFFFFFFFFFF/", # Wrong url
redcap_uri = "https://redcap-dev-2.ouhsc.edu/redcap/apiFFFFFFFFFFFFFF/", # Wrong url
token = credential$token
),
expected_message
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test_that("Bad Uri -wrong address (1 of 2)", {

expect_error(
redcap_variables(
redcap_uri = "https://bbmc.ouhsc.edu/redcap/apiFFFFFFFFFFFFFF/", # Wrong url
redcap_uri = "https://redcap-dev-2.ouhsc.edu/redcap/apiFFFFFFFFFFFFFF/", # Wrong url
token = credential$token
),
expected_message
Expand Down
4 changes: 0 additions & 4 deletions tests/testthat/test-write-error.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,3 @@ test_that("Many Batches: writing with read-only privileges --contiue on error",
})

rm(credential)

# playground:
# REDCapR::redcap_write(ds=mtcars, redcap_uri="https://bbmc.ouhsc.edu/redcap/api/", token="9A81268476645C4E5F03428B8AC3AA7B", continue_on_error=TRUE)
# REDCapR::redcap_write(ds=mtcars, redcap_uri="https://bbmc.ouhsc.edu/redcap/redcap_v10.5.1/api/", token="9A81268476645C4E5F03428B8AC3AA7B", continue_on_error=TRUE)
4 changes: 2 additions & 2 deletions vignettes/BasicREDCapROperations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ There is some information that is specific to the REDCap project, as opposed to

```{r project_values}
library(REDCapR) # Load the package into the current R session.
uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "9A81268476645C4E5F03428B8AC3AA7B" # `UnitTestPhiFree` user and simple project (pid 153)
uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token <- "9A068C425B1341D69E83064A2D273A70" # simple
```

Read all records and fields
Expand Down
20 changes: 10 additions & 10 deletions vignettes/TroubleshootingApiCalls.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ knitr::include_graphics("images/PostmanScreenshot.png")

At the bottom of the playground page, the interface attempts to translate your specific API call to different languages, like Python and R. These suggestions are usually correct, but inspect it critically, as you would for any auto-generated script.

1. **Is the URL/URI correct?** Notice the url typically ends with "api/" so it resembles `https://bbmc.ouhsc.edu/redcap/api/` and *not* `https://bbmc.ouhsc.edu/` (even if <https://bbmc.ouhsc.edu/> redirects to <https://bbmc.ouhsc.edu/redcap/>).
1. **Is the URL/URI correct?** Notice the url typically ends with "api/" so it resembles `https://redcap.ouhsc.edu/redcap/api/` and *not* `https://redcap.ouhsc.edu/` (even if <https://redcap.ouhsc.edu/> redirects to <https://redcap.ouhsc.edu/redcap/>).

1. **Is Postman installed and operating correctly?** If it helps to start with a different REDCap server, you can use this dummy project containing fake data hosted by the [OUHSC BBMC](https://www.ouhsc.edu/bbmc/). The url is `https://bbmc.ouhsc.edu/redcap/api/`. There are three key-value pairs: (1) the 'token' is `9A81268476645C4E5F03428B8AC3AA7B`, (2) the 'content' is `record`, and (3) the 'format' should be `CSV`. When checking your own server, the token value should change, but the content and format should not. It should return five records in a CSV format. The 'status' should be `200 OK`. The result should look roughly like this. Notice the line breaks were included in the text values themselves.

Expand Down Expand Up @@ -121,7 +121,7 @@ knitr::include_graphics("images/PostmanScreenshot.png")
1. **Can a user query the API with cURL?** [cURL](https://curl.se/) is a command line tool that's underneath a lot of libraries. If it's installed correctly on your location machine, it can be executed from the terminal or command line.
```shell
curl -X POST -H "Cache-Control: no-cache" -F "token=9A81268476645C4E5F03428B8AC3AA7B" -F "content=record" -F "format=csv" "https://bbmc.ouhsc.edu/redcap/api/"
curl -X POST -H "Cache-Control: no-cache" -F "token=9A068C425B1341D69E83064A2D273A70" -F "content=record" -F "format=csv" "https://redcap-dev-2.ouhsc.edu/redcap/api/"
```
If all these checks pass, proceed to the next section. If not, start by consulting with your REDCap administrator. If that fails, consider creating a GitHub issue for your package (*e.g.*, [redcapAPI](https://github.com/nutterb/redcapAPI) and [REDCapR](https://ouhscbbmc.github.io/REDCapR/) in R, [phpcap](https://github.com/iuredcap/phpcap) in PHP, and [PyCap](https://pycap.readthedocs.io/en/latest/) in Python).
Expand Down Expand Up @@ -200,8 +200,8 @@ There are several ways to call REDCap's API from [R](https://cran.r-project.org/
If this check fails, consider attempting again with the url and token used above in the Postman example.
```r
redcap_uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "9A81268476645C4E5F03428B8AC3AA7B"
redcap_uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token <- "9A068C425B1341D69E83064A2D273A70"
post_body <- list(
token = token,
Expand Down Expand Up @@ -329,8 +329,8 @@ If you're not using REDCapR, you can skip this section and proceed to "Exporting
```r
library(REDCapR) # Load the package into the current R session.
uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "9A81268476645C4E5F03428B8AC3AA7B"
uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token <- "9A068C425B1341D69E83064A2D273A70"
redcap_read(redcap_uri = uri, token = token)$data
```
Expand Down Expand Up @@ -384,8 +384,8 @@ If you're not using REDCapR, you can skip this section and proceed to "Exporting
```r
library(REDCapR) # Load the package into the current R session, if you haven't already.
uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "9A81268476645C4E5F03428B8AC3AA7B"
uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token <- "9A068C425B1341D69E83064A2D273A70"
project <- redcap_project$new(redcap_uri = uri, token = token)
ds_three_columns <- project$read(fields = c("record_id", "sex", "age"))$data
Expand Down Expand Up @@ -447,8 +447,8 @@ If you're not using redcapAPI, you can skip this section and proceed to 'Importi
```r
library(redcapAPI) # Load the package into the current R session.
rcon <- redcapConnection(
url = "https://bbmc.ouhsc.edu/redcap/api/",
token = "9A81268476645C4E5F03428B8AC3AA7B"
url = "https://redcap-dev-2.ouhsc.edu/redcap/api/",
token = "9A068C425B1341D69E83064A2D273A70"
)
exportRecords(rcon)
```
Expand Down
6 changes: 3 additions & 3 deletions vignettes/advanced-redcapr-operations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ There is some information that is specific to a REDCap project, as opposed to an

```{r project_values}
library(REDCapR) #Load the package into the current R session.
uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token_simple <- "9A81268476645C4E5F03428B8AC3AA7B"
token_longitudinal <- "0434F0E9CF53ED0587847AB6E51DE762"
uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token_simple <- "9A068C425B1341D69E83064A2D273A70"
token_longitudinal <- "DA6F2BB23146BD5A7EA3408C1A44A556"
```

Converting from tall/long to wide
Expand Down
4 changes: 2 additions & 2 deletions vignettes/workflow-read.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ This might be the first time you've ever needed to request a token,
and your institution may have a formal process for API approval.
Your REDCap admin can help.

For this vignette, we'll use a fake dataset hosted at `https://bbmc.ouhsc.edu/redcap/api/`
and accessible with the token "9A81268476645C4E5F03428B8AC3AA7B".
For this vignette, we'll use a fake dataset hosted at `https://redcap-dev-2.ouhsc.edu/redcap/api/`
and accessible with the token "9A068C425B1341D69E83064A2D273A70".

Note to REDCap Admins:

Expand Down

0 comments on commit fcc274e

Please sign in to comment.