Skip to content

Commit

Permalink
pre-release updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ezraporter committed Apr 10, 2024
1 parent dbb14d8 commit 3d9d608
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 215 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Version 1.1.0 (Released 2024-03-28)

- `read_redcap()` now supports instruments that follow a mixed repeating/non-repeating structure with the `allow_mixed_structure` parameter
- Mixed structure instruments (those with both repeating and nonrepeating elements) can be supported by setting `allow_mixed_structure` to `TRUE` or `getOption("redcaptidier.allow.mixed.structure", FALSE)`.
- When allowed, nonrepeating elements of mixed structure insturments will be treated as repeating elements with a single instance.
- When allowed, nonrepeating elements of mixed structure instruments will be treated as repeating elements with a single instance.
- Missing data codes from REDCap additional customization settings are now handled. Non-logical values are converted to `NA` in `yesno`, `truefalse`, and `checkbox` fields with a warning.
- Warnings for MDCs can be silenced with `options(redcaptidier.allow.mdc = TRUE)`.
- `raw_or_label` now accepts `"haven"` as an option, converting categorical fields to `haven_labelled` vectors instead of factors.
Expand Down
6 changes: 3 additions & 3 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -624,23 +624,23 @@ check_field_is_logical <- function(x) {
#'
#' @keywords internal
check_extra_field_values <- function(x, values) {
extra_vals <- setdiff(as.character(x), values) |> na.omit()
extra_vals <- setdiff(as.character(x), values) %>% na.omit()
if (length(extra_vals) == 0) {
return(NULL)
}
as.character(extra_vals)
}

check_extra_field_values_message <- function(extra_field_values, call = caller_env()) {
extra_field_values <- extra_field_values |>
extra_field_values <- extra_field_values %>%
discard(is.null)

if (length(extra_field_values) == 0) {
return(NULL)
}

fields <- names(extra_field_values)
values <- flatten_chr(extra_field_values) |> unique()
values <- flatten_chr(extra_field_values) %>% unique()

msg <- c(
`!` = "{.code {fields}} contain{?s/} values with no labels: {values}",
Expand Down
6 changes: 3 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,13 @@ parse_logical_cols <- function(db_data, db_metadata, call = caller_env()) {
out[logical_cols$field_name_updated] <- map(parsed, "parsed")

if (!getOption("redcaptidier.allow.mdc", FALSE)) {
problems <- parsed |>
map("problems") |>
problems <- parsed %>%
map("problems") %>%
discard(is.null)

if (length(problems) > 0) {
fields <- names(problems)
values <- flatten_chr(problems) |> unique()
values <- flatten_chr(problems) %>% unique()

msg <- c(
`!` = "{.code {fields}} {?is/are} logical but contain{?s/} non-logical values: {values}",
Expand Down
157 changes: 0 additions & 157 deletions utility/cli_message_examples_reprex.R

This file was deleted.

16 changes: 10 additions & 6 deletions utility/cli_message_examples_reprex.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ read_redcap(letters[1:3], classic_token)
read_redcap("https://www.google.com", classic_token)
#> Error in `read_redcap()`:
#> ✖ The REDCapR export operation was not successful.
#> ! The URL returned the HTTP error code 405 (POST Method not allowed).
#> ℹ Are you sure the URI points to an active REDCap API endpoint?
#> ℹ URI: `https://www.google.com`
#> ! An unexpected error occured.
#> ℹ This means that you probably discovered a bug!
#> ℹ Please consider submitting a bug report here:
#> <https://github.com/CHOP-CGTInformatics/REDCapTidieR/issues>.
#> Caused by error in `redcap_metadata_read()`:
#> ! The REDCapR metadata export operation was not successful. The error message was:
#> <html><body><h1>404 Not Found</h1></body></html>

read_redcap("https://www.google.comm", classic_token)
#> Error in `read_redcap()`:
Expand Down Expand Up @@ -255,7 +259,7 @@ withr::with_tempdir({
})
#> Error:
#> ✖ File
#> ''/private/var/folders/qc/mmjjyjq50530z9r_7mfqcqfhxkkk67/T/RtmpQi1Xne/file52d750f31b3f/temp.csv''
#> ''/private/var/folders/9c/k1m0bzys7gb1v32g86hfn5sn5k86h1/T/Rtmp1QPC0p/file5c744dd73619/temp.csv''
#> already exists.
#> ℹ Overwriting files is disabled by default. Set `overwrite = TRUE` to overwrite
#> existing file.
Expand Down Expand Up @@ -296,7 +300,7 @@ withr::with_tempdir({
write_redcap_xlsx(file = filepath)
})
#> Warning in write_redcap_xlsx(., file = filepath): ! No extension provided for `file`:
#> '/private/var/folders/qc/mmjjyjq50530z9r_7mfqcqfhxkkk67/T/RtmpQi1Xne/file52d72e91eb7b/temp'
#> '/private/var/folders/9c/k1m0bzys7gb1v32g86hfn5sn5k86h1/T/Rtmp1QPC0p/file5c7456597c2b/temp'
#> ℹ The extension '.xlsx' will be appended to the file name.

# Printed supertibble
Expand Down Expand Up @@ -339,4 +343,4 @@ read_redcap(redcap_uri, Sys.getenv("REDCAPTIDIER_MDC_API"))
#> # data_na_pct <formttbl>, form_complete_pct <formttbl>
```

<sup>Created on 2024-03-27 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>
<sup>Created on 2024-04-10 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>
Loading

0 comments on commit 3d9d608

Please sign in to comment.