R/adam_to_evidence.R
adam_to_evidence.RdCompares a built ADaM dataset - such as one produced by an 'admiral' pipeline
against its metadata and emits R4SUB evidence rows about conformance. The checks are computed directly from the dataset and metadata, so they work whether or not the dataset was passed through 'xportr' or 'metatools'.
adam_to_evidence(
data,
metadata,
ctx,
dataset_name = NULL,
source_name = "adam",
source_version = NULL
)A data.frame: one ADaM dataset.
A Metacore object or a data.frame accepted by
as_variable_metadata().
An r4subcore::r4sub_run_context providing run and study identifiers.
Character or NULL. Which dataset in metadata to check
data against. May be omitted when the metadata covers a single dataset.
Character. Label recorded as the evidence source.
Default "adam".
Character or NULL. Optional version label.
A data.frame conforming to the R4SUB evidence schema.
Four indicators are evaluated:
Each variable described in the metadata is present in the dataset (traceability).
Each dataset column is described in the metadata; columns that are not are flagged (traceability).
Present variables have the data type family the metadata specifies (quality).
Present variables carry a non-empty label attribute (usability).
# Check the CDISC pilot ADSL from pharmaverseadam against the ADaM metadata
# shipped in r4subdata.
ctx <- suppressMessages(r4subcore::r4sub_run_context("CDISCPILOT01", "DEV"))
ev <- suppressMessages(adam_to_evidence(
pharmaverseadam::adsl,
r4subdata::adam_metadata,
ctx,
dataset_name = "ADSL"
))
table(ev$indicator_id, ev$result)
#>
#> fail pass warn
#> Q-ADAM-001 0 15 0
#> Q-ADAM-002 0 15 0
#> T-ADAM-001 1 15 0
#> T-ADAM-002 0 0 40