diff --git a/.Rbuildignore b/.Rbuildignore index 85bf6f0..2e5c406 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,3 +7,5 @@ ^LICENSE\.md$ ^design$ ^pkgdown$ +^\.git$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..e5d165e --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.2.0 +Date: 2026-10-15 21:56:09 UTC +SHA: 09c5c0fdeb03f56e33ef1c852d172e139efdb581 diff --git a/DESCRIPTION b/DESCRIPTION index 4330300..84c4599 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,16 +1,31 @@ Package: cdiscdata Title: Versioned CDISC Standards Reference Data -Version: 0.2.0.9000 -Authors@R: person("Bill", "Denney", email = "wdenney@humanpred.com", - role = c("aut", "cre"), - comment = c(ORCID = "0000-0002-5759-428X")) -Description: Provides versioned CDISC Controlled Terminology (SDTM, ADaM), - variable metadata for the SDTM model, the SDTMIG, SENDIG, and ADaMIG - families of implementation guides, CDASH, and QRS supplements, - and Define-XML schemas (XSD) and CDISC XSLT stylesheets. Uses a - validity-date design to store all historical CT versions compactly - without redundant row duplication. Intended as a shared data - dependency for pharmaverse-aligned packages. +Version: 0.2.0 +Authors@R: c( + person("Bill", "Denney", email = "wdenney@humanpredictions.com", + role = c("aut", "cre"), + comment = c(ORCID = "0000-0002-5759-428X")), + person("Clinical Data Interchange Standards Consortium (CDISC)", role = "cph", + comment = "Define-XML schema files in inst/extdata/schema (MIT License)"), + person("Lex", "Jansen", role = "cph", + comment = "Define-XML stylesheets in inst/extdata/stylesheet (MIT License)"), + person("National Cancer Institute Enterprise Vocabulary Services", role = "dtc", + comment = "CDISC Controlled Terminology (public domain)")) +Description: Provides versioned reference data for the standards of the + Clinical Data Interchange Standards Consortium (CDISC) + : the CDISC Controlled Terminology (CT) + for the Study Data Tabulation Model (SDTM) and the Analysis Data Model + (ADaM); variable metadata for the SDTM model and for the families of the + SDTM Implementation Guide (SDTMIG), the Standard for Exchange of + Nonclinical Data Implementation Guide (SENDIG), and the ADaM + Implementation Guide (ADaMIG); the Clinical Data Acquisition Standards + Harmonization (CDASH) model and implementation guide; the Questionnaires, + Ratings, and Scales (QRS) supplements; and the Define-XML schemas, written + in the Extensible Markup Language (XML) Schema Definition (XSD) language, + with Extensible Stylesheet Language Transformations (XSLT) stylesheets + for them. A validity-date design stores every historical CT version + compactly, without duplicating rows. Intended as a shared data + dependency for pharmaverse-aligned packages . License: MIT + file LICENSE Depends: R (>= 4.1.0) Suggests: @@ -21,11 +36,11 @@ Suggests: pkgdown, knitr, rmarkdown, - callr, - pkgbuild + callr LazyData: true LazyDataCompression: xz Encoding: UTF-8 +Language: en-US Config/testthat/edition: 3 URL: https://github.com/humanpred/cdiscdata, https://humanpred.github.io/cdiscdata/ BugReports: https://github.com/humanpred/cdiscdata/issues diff --git a/NEWS.md b/NEWS.md index 1e36881..458c38b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,19 @@ -# cdiscdata (development version) +# cdiscdata 0.2.0 + +## CRAN release preparation + +* First CRAN submission: the maintainer email address is corrected, the + copyright holders of the bundled Define-XML schema files (CDISC, MIT + License) and stylesheets (Lex Jansen, MIT License) are stated in + `Authors@R` and `inst/COPYRIGHTS` (the README had described them as + Apache-licensed), and a spelling word list is added. -* `inst/COPYRIGHTS` lists the source, copyright holder and licence of every bundled file and data table, including the standards metadata tables added in this version. +* Resubmission: the Description explains every acronym and links the CDISC + standards, and the attach test no longer installs the package (it runs + against the installed copy under `R CMD check` and skips from a source + tree), so pkgbuild leaves Suggests. + +* `inst/COPYRIGHTS` lists the source, copyright holder, and license of every bundled file and data table, including the standards metadata tables added in this version. ## Every CDISC Library implementation-guide export, replacing the Rsdtm tables @@ -143,8 +156,6 @@ to obtain them. The Rsdtm copies in `data-raw/ig_source/` and the scripts that read them are removed. -# cdiscdata 0.2.0 - ## Classed conditions and coverage * Every error and warning `get_ig()` and `build_domain_spec()` raise is now diff --git a/R/data.R b/R/data.R index 02145ac..a882987 100644 --- a/R/data.R +++ b/R/data.R @@ -67,7 +67,7 @@ #' \code{"Perm"}, \code{"Cond"}, or the published \code{"Not used"}).} #' \item{codelist_code}{CDISC CT codelist C-code(s) the variable uses, as #' published; several are separated by \code{"; "} (e.g. PPORRESU lists -#' PKUNIT and four normalised-unit codelists). \code{NA} when none.} +#' PKUNIT and four normalized-unit codelists). \code{NA} when none.} #' \item{codelist_submission_values}{The codelist submission value(s), #' where the export gives them (the SEND guides do; the SDTMIG exports do #' not, so look the code up in \code{\link{get_ct}}).} diff --git a/R/get_ct.R b/R/get_ct.R index 65616b8..56929cd 100644 --- a/R/get_ct.R +++ b/R/get_ct.R @@ -8,9 +8,11 @@ #' @return A data frame of CT terms valid at the requested version. #' @export #' @examples -#' get_ct("sdtm") -#' get_ct("sdtm", version = "2024-09-27") -#' get_ct("adam") +#' ct <- get_ct("sdtm") +#' head(ct) +#' ct_2024 <- get_ct("sdtm", version = "2024-09-27") +#' nrow(ct_2024) +#' head(get_ct("adam")) get_ct <- function(type = c("sdtm", "adam"), version = NULL) { type <- match.arg(type) get_dataset(paste0("ct_", type), version = version) diff --git a/R/get_dataset.R b/R/get_dataset.R index 7dcd590..0a6b3d7 100644 --- a/R/get_dataset.R +++ b/R/get_dataset.R @@ -20,9 +20,12 @@ #' path string (for schemas/stylesheets). #' @export #' @examples -#' get_dataset("ct_sdtm") -#' get_dataset("ct_sdtm", version = "2024-09-27") -#' get_dataset("ig_adam", version = "1.3") +#' ct <- get_dataset("ct_sdtm") +#' head(ct) +#' ct_2024 <- get_dataset("ct_sdtm", version = "2024-09-27") +#' nrow(ct_2024) +#' ig_adam_1_3 <- get_dataset("ig_adam", version = "1.3") +#' nrow(ig_adam_1_3) #' get_dataset("define_xml_schema", version = "2.1") #' get_dataset("define_xml_stylesheet", version = "2.0") get_dataset <- function(name, version = NULL) { diff --git a/README.md b/README.md index 780f823..0d607d1 100644 --- a/README.md +++ b/README.md @@ -164,9 +164,9 @@ packages (e.g. `cdisclib`, `defineauto`). Key design decisions: | SDTM model, SDTMIG, SENDIG, ADaMIG, and related guides: variable metadata | 34 CDISC Library CSV exports, downloaded under CDISC's terms and **not redistributed**; only variable metadata is transcribed (not the CDISC Notes, Description, Definition, Notes, or Examples text); see `data-raw/README.md` | CDISC terms and conditions | | CDASH model and CDASHIG variable metadata | 9 CDISC Library CSV exports, as above; the collection wording (question text, prompt) is carried, the definitions, mapping and CRF completion instructions, and implementation notes are not | CDISC terms and conditions | | QRS supplement item metadata | 9 CDISC Library CSV exports, as above; the `--TEST` and `--TESTCD` names and codes are carried, the item text is not | CDISC terms and conditions | -| Define-XML 2.1 schema | [cdisc-org/DataExchange-RWD-Lineage](https://github.com/cdisc-org/DataExchange-RWD-Lineage) | Apache 2.0 | +| Define-XML 2.1 schema | [cdisc-org/DataExchange-RWD-Lineage](https://github.com/cdisc-org/DataExchange-RWD-Lineage) | MIT (CDISC) | | Define-XML 2.0 schema | [dbosak01/defineR](https://github.com/dbosak01/defineR) | MIT | -| XSLT stylesheets | [cdisc-org/data-definition-engine](https://github.com/cdisc-org/data-definition-engine) / [dbosak01/defineR](https://github.com/dbosak01/defineR) | Apache 2.0 / MIT | +| XSLT stylesheets | [cdisc-org/data-definition-engine](https://github.com/cdisc-org/data-definition-engine) / [dbosak01/defineR](https://github.com/dbosak01/defineR) | MIT (Lex Jansen) | ## Related packages diff --git a/cran-comments.md b/cran-comments.md index 44164b2..c8deccb 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,16 +1,57 @@ +## Resubmission + +This is a resubmission of cdiscdata 0.2.0, a new package. In this version I +have addressed each of the reviewer's comments: + +* **Acronyms in the Description.** Every acronym is now explained where it + first appears: CDISC (Clinical Data Interchange Standards Consortium), CT + (Controlled Terminology), SDTM (Study Data Tabulation Model), ADaM + (Analysis Data Model), SDTMIG (SDTM Implementation Guide), SENDIG + (Standard for Exchange of Nonclinical Data Implementation Guide), ADaMIG + (ADaM Implementation Guide), CDASH (Clinical Data Acquisition Standards + Harmonization), QRS (Questionnaires, Ratings, and Scales), XML (Extensible + Markup Language), XSD (XML Schema Definition), and XSLT (Extensible + Stylesheet Language Transformations). + +* **References.** The package provides reference data from the CDISC + standards with functions to retrieve it; it implements no published + method, so there is no method reference to cite. The Description now links + the CDISC standards in angle brackets, . + +* **Installing packages.** No function, example, or vignette installs a + package. The one installation was in a test + (tests/testthat/test-attach.R), which, when the tests ran from a source + tree, built the package and installed it into a temporary library; that + test was already skipped on CRAN. It no longer installs anything: it runs + only against the installed copy that R CMD check provides and skips + otherwise. pkgbuild, which only that test used, is removed from Suggests. + +Since the first submission, the package also gained the variable metadata of +the remaining CDISC implementation guides, the CDASH model and +implementation guide, and the QRS supplements (see NEWS.md); the version +number is unchanged because 0.2.0 has not been released. + ## R CMD check results -0 errors | 0 warnings | 0 notes +0 errors | 0 warnings | 1 note + +* This is a new submission. -## Data sources +## Notes on the submission -All CT data is sourced from the NCI EVS FTP site (public domain, no license -restrictions). XSD schemas and XSLT stylesheets are from the CDISC -DataExchange-DefineXML GitHub repository (Apache License 2.0, included with -attribution in inst/extdata/). +* The package contains data (plus accessor functions) and has no runtime + dependencies. +* Bundled third-party files are listed with their copyright holders and + licenses in inst/COPYRIGHTS and in Authors@R: the Define-XML schema files + (CDISC, MIT License) and stylesheets (Lex Jansen, MIT License). The CDISC + Controlled Terminology data is published by the NCI Enterprise Vocabulary + Services as a public-domain work of the US Government. The variable + metadata of the CDISC standards carries only names, labels, types, and + similar fields, not the standards' text. +* The words flagged by the spell check in DESCRIPTION (ADaM, ADaMIG, CDASH, + CDISC, QRS, SDTM, SDTMIG, SENDIG, XSD, XSLT, pharmaverse) are standards + names and acronyms, each explained in the Description. ## Test environments -- Local: Ubuntu 24.04, R 4.4.x -- GitHub Actions: ubuntu-latest (R release and devel), windows-latest (R release), - macos-latest (R release) +* Local: Windows 11, R 4.6.1 (R CMD check --as-cran) diff --git a/data-raw/fetch_schemas.R b/data-raw/fetch_schemas.R index 3486b4e..68b000b 100644 --- a/data-raw/fetch_schemas.R +++ b/data-raw/fetch_schemas.R @@ -2,8 +2,9 @@ # Safe to re-run; existing files are not re-downloaded. # # Sources (both publicly available, open-source licensed): -# Define-XML 2.1: cdisc-org/DataExchange-RWD-Lineage (MIT License) -# Define-XML 2.0: dbosak01/defineR CRAN package (MIT License) +# Define-XML 2.1: cdisc-org/DataExchange-RWD-Lineage (MIT License, CDISC) +# Define-XML 2.0: dbosak01/defineR CRAN package (CC0), redistributing the +# CDISC Define-XML 2.0 schema files RWD_BASE <- "https://raw.githubusercontent.com/cdisc-org/DataExchange-RWD-Lineage/main/tools/schema" DEFR_BASE <- "https://raw.githubusercontent.com/dbosak01/defineR/master/inst/extdata/2.0.0/cdisc-define-2.0" diff --git a/data-raw/fetch_stylesheets.R b/data-raw/fetch_stylesheets.R index 197b55c..e0ed6e1 100644 --- a/data-raw/fetch_stylesheets.R +++ b/data-raw/fetch_stylesheets.R @@ -2,8 +2,10 @@ # Safe to re-run; existing files are not re-downloaded. # # Sources (both publicly available, open-source licensed): -# Define-XML 2.1: cdisc-org/data-definition-engine (Apache License 2.0) -# Define-XML 2.0: dbosak01/defineR CRAN package (MIT License) +# Define-XML 2.1: cdisc-org/data-definition-engine (MIT License; the +# stylesheet itself is Copyright (c) Lex Jansen, MIT License) +# Define-XML 2.0: dbosak01/defineR CRAN package (CC0; the stylesheet itself +# is Copyright (c) Lex Jansen, MIT License) STYLESHEET_URLS <- c( "define2-1-0.xsl" = diff --git a/inst/COPYRIGHTS b/inst/COPYRIGHTS index 7a1d444..508b89d 100644 --- a/inst/COPYRIGHTS +++ b/inst/COPYRIGHTS @@ -22,11 +22,6 @@ data/ct_sdtm.rda, data/ct_adam.rda Enterprise Vocabulary Services (https://evs.nci.nih.gov/ftp1/CDISC/), a work of the United States Government in the public domain. -data/ig_sdtm.rda, data/ig_adam.rda - Variable metadata transcribed from the published SDTM, SDTMIG, and ADaMIG - specification documents (facts about the standards, not copies of the - documents). - data/ig_sdtm.rda, data/model_sdtm.rda, data/ig_adam.rda, data/cdash_model.rda, data/ig_cdash.rda, data/qrs_supplement.rda, data/ig_sources.rda Variable and item metadata of the CDISC standards (SDTM model, SDTMIG, diff --git a/inst/WORDLIST b/inst/WORDLIST new file mode 100644 index 0000000..e41409d --- /dev/null +++ b/inst/WORDLIST @@ -0,0 +1,76 @@ +ADAE +ADPP +ADPP's +ADSL +ADSL's +ADaM +ADaMIG +API's +BDS +CDASH +CDASHIG +CDISC +CDISC's +CMD +CRF +Codecov +Codelist +DataExchange +Denney's +EVS +GeneTox +IG +IG's +KFSS +KPS +NCA +NCI +NCI's +OCCDS +PGI +PKPARM +PKPARMCD +PKUNIT +PP's +PPORRESU +PPTESTCD's +QRS +README +RWD +Rsdtm +SDTM +SDTMIG +SDTMIG's +SENDIG +SUPPPP +SUPPQUAL +Summarise +TTE +XPT +XSD +XSL +XSLT +YYYY +backfill +catalogue +cdisc +codelist +codelist's +codelists +dataset's +dbosak +defineR +errored +evs +gapped +nca +nci +nih +pharmaverse +popPK +rlang +schemas +stylesheet +stylesheets +subprocess +unioned diff --git a/man/get_ct.Rd b/man/get_ct.Rd index 40a5c14..cc7581a 100644 --- a/man/get_ct.Rd +++ b/man/get_ct.Rd @@ -19,7 +19,9 @@ A data frame of CT terms valid at the requested version. Convenience wrapper around \code{\link{get_dataset}} for CT data. } \examples{ -get_ct("sdtm") -get_ct("sdtm", version = "2024-09-27") -get_ct("adam") +ct <- get_ct("sdtm") +head(ct) +ct_2024 <- get_ct("sdtm", version = "2024-09-27") +nrow(ct_2024) +head(get_ct("adam")) } diff --git a/man/get_dataset.Rd b/man/get_dataset.Rd index 18bbcb9..dbc1be6 100644 --- a/man/get_dataset.Rd +++ b/man/get_dataset.Rd @@ -31,9 +31,12 @@ returns the file path for the requested Define-XML version. Use \code{\link{list_datasets}} to see available dataset names. } \examples{ -get_dataset("ct_sdtm") -get_dataset("ct_sdtm", version = "2024-09-27") -get_dataset("ig_adam", version = "1.3") +ct <- get_dataset("ct_sdtm") +head(ct) +ct_2024 <- get_dataset("ct_sdtm", version = "2024-09-27") +nrow(ct_2024) +ig_adam_1_3 <- get_dataset("ig_adam", version = "1.3") +nrow(ig_adam_1_3) get_dataset("define_xml_schema", version = "2.1") get_dataset("define_xml_stylesheet", version = "2.0") } diff --git a/man/ig_sdtm.Rd b/man/ig_sdtm.Rd index 88d3a4a..9973b22 100644 --- a/man/ig_sdtm.Rd +++ b/man/ig_sdtm.Rd @@ -21,7 +21,7 @@ A data frame with columns: \code{"Perm"}, \code{"Cond"}, or the published \code{"Not used"}).} \item{codelist_code}{CDISC CT codelist C-code(s) the variable uses, as published; several are separated by \code{"; "} (e.g. PPORRESU lists - PKUNIT and four normalised-unit codelists). \code{NA} when none.} + PKUNIT and four normalized-unit codelists). \code{NA} when none.} \item{codelist_submission_values}{The codelist submission value(s), where the export gives them (the SEND guides do; the SDTMIG exports do not, so look the code up in \code{\link{get_ct}}).} diff --git a/tests/testthat/test-attach.R b/tests/testthat/test-attach.R index d4fa7a3..09107b5 100644 --- a/tests/testthat/test-attach.R +++ b/tests/testthat/test-attach.R @@ -5,13 +5,10 @@ # even from inside the package's own functions. See R/utils.R's .pkg_data() # for the fix and rationale. -# Locate a genuine, buildable package source tree, if one is available in -# this test run. devtools::test()/pkgload::load_all() set the working -# directory to the package root; R CMD check instead runs tests against an -# already-installed copy with no source tree alongside it, in which case the -# ambient installation (found via .libPaths()) already *is* the build under -# test, and there is nothing to rebuild. -locate_pkg_source_root <- function() { +# Whether the tests run from a package source tree (devtools::test() and +# pkgload::load_all() set the working directory to the package root), rather +# than against an installed copy as under R CMD check +running_from_source <- function() { candidates <- unique(c( getwd(), tryCatch( @@ -21,46 +18,23 @@ locate_pkg_source_root <- function() { )) for (root in candidates) { has_desc <- file.exists(file.path(root, "DESCRIPTION")) - r_files <- if (dir.exists(file.path(root, "R"))) { - list.files(file.path(root, "R"), pattern = "[.]R$") - } else { - character(0L) + has_r <- dir.exists(file.path(root, "R")) && length(list.files(file.path(root, "R"), pattern = "[.]R$")) > 0L + if (has_desc && has_r) { + return(TRUE) } - if (has_desc && length(r_files) > 0L) return(root) } - NULL + FALSE } +# The subprocess must load cdiscdata from an installed copy that is the build +# under test. Under R CMD check, the installed copy under .libPaths() is that +# build; from a source tree, the installed copy (if any) may be older, and the +# test does not install one, so it skips. test_that("get_ct works via cdiscdata:: alone, no library(), in a fresh subprocess", { skip_on_cran() skip_if_not_installed("callr") - - root <- locate_pkg_source_root() - if (is.null(root)) { - # No source tree alongside the tests (e.g. R CMD check): the ambient - # installation under .libPaths() is the build under test. - lib <- .libPaths() - } else { - skip_if_not_installed("pkgbuild") - build_dir <- withr::local_tempdir() - lib <- withr::local_tempdir() - tarball <- pkgbuild::build( - root, dest_path = build_dir, quiet = TRUE, vignettes = FALSE - ) - # Installed in a separate subprocess, not in this session: when running - # under devtools::test(), cdiscdata is already loaded here via pkgload, - # and install.packages() refuses to (re)install a package that is - # currently in use in the calling session, even into an unrelated - # library path. - callr::r( - function(tarball, lib) { - utils::install.packages(tarball, repos = NULL, type = "source", - lib = lib, quiet = TRUE) - }, - args = list(tarball = tarball, lib = lib) - ) - lib <- c(lib, .libPaths()) - } + skip_if(running_from_source(), "Needs the installed build under test (run under R CMD check)") + lib <- .libPaths() sdtm <- callr::r(function() cdiscdata::get_ct("sdtm"), libpath = lib) expect_s3_class(sdtm, "data.frame")