Skip to content

Commit

Permalink
new otional parameter prefix for more customable URLs to secuTrial forms
Browse files Browse the repository at this point in the history
  • Loading branch information
DrEspresso committed May 16, 2024
1 parent a6b38f9 commit 418b569
Show file tree
Hide file tree
Showing 6 changed files with 374 additions and 385 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: secuTrialR
Type: Package
Title: Handling of Data from the Clinical Data Management System 'secuTrial'
Version: 1.3.0
Version: 1.3.1
Authors@R:
c(person(given = "Alan G.",
family = "Haynes",
Expand Down Expand Up @@ -57,7 +57,7 @@ Imports:
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.2
RoxygenNote: 7.2.3
Suggests:
knitr,
lintr,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# secuTrialR 1.3.1

* `build_secuTrial_url()` now has optional parameter `prefix` with default `"apps/WebObjects/"`. (#263)

# secuTrialR 1.3.0

* bug fix to read escaped enclosure characters in free text items, e.g. `\"` (#220, #261)
Expand Down
6 changes: 4 additions & 2 deletions R/build_secuTrial_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' \itemize{
#' \item server id is: \strong{server.secutrial.com}
#' \item instance id is: \strong{ST21-setup-DataCapture}
#' \item url prefix is: \strong{apps/WebObjects/}
#' \item you can find the customer id at the end of the link i.e \strong{TES}
#'
#' Alternatively it can be found in the
Expand All @@ -36,6 +37,7 @@
#' @param customer (optional) string containing secuTrial customer label
#' @param projid (optional) string containing secuTrial project identifier
#' @param docid (optional) secuTrial document/form identifer
#' @param prefix (optional) string containing the URL prefix to the WebObjects application (default: "apps/WebObjects/")
#' @return string containing a URL to desired secuTrial page. Currently we provide no
#' guarantee that the returned URL is valid.
#' @export
Expand Down Expand Up @@ -68,7 +70,7 @@
#' # make several links with all docids
#' build_secuTrial_url(server, instance, customer, project, docids)
#'
build_secuTrial_url <- function(server, instance = NA, customer = NA, projid = NA, docid = NA) {
build_secuTrial_url <- function(server, instance = NA, customer = NA, projid = NA, docid = NA, prefix = "apps/WebObjects/") {
if (all(!is.na(docid)) & (is.na(projid) | is.na(customer) | is.na(instance))) {
warning("'projid', 'customer' and 'instance' must all be provided with 'docid'")
} else if (!is.na(projid) & (is.na(customer) | is.na(instance))) {
Expand All @@ -87,7 +89,7 @@ build_secuTrial_url <- function(server, instance = NA, customer = NA, projid = N
sT_url <- server
# check what info is availalbe and compose with what you have
if (!is.na(instance)) {
sT_url <- paste0(sT_url, "apps/WebObjects/", instance)
sT_url <- paste0(sT_url, prefix, instance)
if (!is.na(customer)) {
sT_url <- paste0(sT_url, ".woa/wa/choose?customer=", customer)
if (!is.na(projid)) {
Expand Down
Loading

0 comments on commit 418b569

Please sign in to comment.