submission_spec.RdConstructs and validates a submission_spec: the metadata object that drives
write_submission() and check_submission(). variables uses the same
column names xportr expects (dataset, variable, label, type,
length, format, order), so spec$variables can be handed straight to
xportr::xportr_type() and friends without reshaping.
submission_spec(datasets, variables, study = list())A data frame with one row per dataset: dataset (name),
label (dataset label) and class (e.g. "ADSL", "BDS", "OCCDS", or
an SDTM domain class such as "Interventions").
A data frame with one row per variable: dataset (which
dataset it belongs to), variable (name), label, type
("character"/"numeric"), length, format (SAS format, NA if
none) and order (integer position within the dataset).
Optional named list of study-level metadata (e.g.
list(study_id = "CDISCPILOT01", sponsor = "Acme")). Free-form; carried
through to the manifest and print() output only.
A validated submission_spec object.
Scope: this is transport-file metadata — enough to write correct .xpt
files and to run check_submission(). It is deliberately not a Define-XML
model: there is no codelist, value-level metadata, method, comment,
origin, where-clause or document reference here. If you need those, build
them in define21 (or your generator of choice) and hand the result to
write_submission(define_xml = ). study is free-form and is never
validated or written into the transport files.
datasets <- data.frame(
dataset = "DM", label = "Demographics", class = "SDTM",
stringsAsFactors = FALSE
)
variables <- data.frame(
dataset = "DM",
variable = c("USUBJID", "AGE", "SEX"),
label = c("Unique Subject Identifier", "Age", "Sex"),
type = c("character", "numeric", "character"),
length = c(20, 8, 1),
format = NA_character_,
order = 1:3,
stringsAsFactors = FALSE
)
spec <- submission_spec(datasets, variables, study = list(study_id = "CDISCPILOT01"))
spec
#>
#> ── submitpack specification ────────────────────────────────────────────────────
#> ℹ Study: CDISCPILOT01 | datasets: 1 | variables: 3
#> ℹ [DM] Demographics (SDTM: 3 variable(s))