Turns dataset metadata - either a metacore object or a plain data.frame - into standardized R4SUB evidence rows describing how completely each variable is documented. This lets metadata assembled for a 'pharmaverse' pipeline feed the same evidence table and Submission Confidence Index as any other source.

metacore_to_evidence(
  metadata,
  ctx,
  source_name = "metacore",
  source_version = NULL
)

Arguments

metadata

A Metacore object or a data.frame accepted by as_variable_metadata().

ctx

An r4subcore::r4sub_run_context providing run and study identifiers.

source_name

Character. Label recorded as the evidence source. Default "metacore".

source_version

Character or NULL. Optional version label for the metadata source.

Value

A data.frame conforming to the R4SUB evidence schema.

Details

Two indicators are evaluated, reusing the identifiers emitted by r4subcore::define_xml_to_evidence() so that metadata- and Define-XML-sourced evidence group together in scoring and explainability:

Q-DEFINE-002

Variable is documented (has a label and a data type).

Q-DEFINE-003

Derivation text is present for derived variables.

Examples

# The example ADaM metadata shipped in r4subdata.
ctx <- suppressMessages(r4subcore::r4sub_run_context("STUDY01", "DEV"))
ev  <- suppressMessages(metacore_to_evidence(r4subdata::adam_metadata, ctx))
table(ev$indicator_id, ev$result)
#>               
#>                pass
#>   Q-DEFINE-002   36