define21_example.RdBuilds the example specification shipped in inst/extdata (three SDTM
domains - DM, AE and VS - with codelists, derivation methods, one comment,
value level metadata on the two VS result variables and two MedDRA external
codelists) together with the matching datasets, so every example, test and
vignette in this package runs offline against real inputs.
define21_example()A list with elements spec (a define21_spec) and data (a named
list with data frames DM, AE and VS).
The specification and the data agree, so check_define() on them returns
zero rows; change either side and the discrepancy shows up. The controlled
terminology is not invented: the coded values of SEX, AGEU, AESEV,
NY, VSTESTCD and the units codelist are real CDISC Submission Values,
asserted against a shipped CDISC SDTM Terminology release in the test suite
where that file is available.
ex <- define21_example()
ex$spec
#>
#> ── Define-XML 2.1 specification ────────────────────────────────────────────────
#> ℹ Study: STUDY01 | standard: SDTMIG 3.4 (IG)
#> ℹ 3 dataset(s), 28 variable(s), 9 codelist(s), 2 method(s), 1 comment(s)
#> ℹ 6 value(s) across 2 value list(s), 3 where clause(s), 2 external codelist(s)
#> ✔ [DM] Demographics - 10 variable(s), One record per subject
#> ✔ [AE] Adverse Events - 10 variable(s), One record per adverse event per subject
#> ✔ [VS] Vital Signs - 8 variable(s), One record per vital sign measurement per subject
head(ex$data$DM, 3)
#> STUDYID DOMAIN USUBJID SUBJID AGE AGEU SEX RACE
#> 1 STUDY01 DM STUDY01-001 001 64 YEARS F WHITE
#> 2 STUDY01 DM STUDY01-002 002 58 YEARS M ASIAN
#> 3 STUDY01 DM STUDY01-003 003 71 YEARS F BLACK OR AFRICAN AMERICAN
#> ARM RFSTDTC
#> 1 Placebo 2024-01-15
#> 2 Drug 10 mg 2024-01-18
#> 3 Drug 10 mg 2024-01-22
ex$spec$value_levels[, c("variable", "value", "where_clause", "type")]
#> # A tibble: 6 × 4
#> variable value where_clause type
#> <chr> <chr> <chr> <chr>
#> 1 VSSTRESN SYSBP VS_SYSBP float
#> 2 VSSTRESN DIABP VS_DIABP float
#> 3 VSSTRESN PULSE VS_PULSE float
#> 4 VSSTRESU SYSBP VS_SYSBP text
#> 5 VSSTRESU DIABP VS_DIABP text
#> 6 VSSTRESU PULSE VS_PULSE text