Package {definecore}


Title: Generate CDISC Define-XML from Metacore Objects
Version: 0.1.1
Description: Generates CDISC Define-XML documents (versions 2.0 and 2.1) from metacore metadata objects. Maps dataset, variable, codelist, and derivation information into an ODM-based Define-XML structure suitable for further review and regulatory use. Integrates with the pharmaverse metacore ecosystem.
License: MIT + file LICENSE
URL: https://github.com/shekharchalwadigrepo-hub/definecore
BugReports: https://github.com/shekharchalwadigrepo-hub/definecore/issues
Depends: R (≥ 4.1.0)
Imports: metacore, xml2, dplyr, rlang, cli, glue, magrittr
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
Encoding: UTF-8
RoxygenNote: 7.3.2
Config/testthat/edition: 3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-10-22 06:21:35 UTC; skrch
Author: Shakhar Eranna Chalwadi [aut, cre]
Maintainer: Shakhar Eranna Chalwadi <skrchalwadicg@gmail.com>
Repository: CRAN
Date/Publication: 2026-11-04 20:00:02 UTC

definecore: Generate CDISC Define-XML from Metacore Objects

Description

Generates CDISC Define-XML documents (versions 2.0 and 2.1) from metacore metadata objects.

Author(s)

Maintainer: Shakhar Eranna Chalwadi skrchalwadicg@gmail.com

See Also

Useful links:


Write Define-XML from a metacore object

Description

Generates a CDISC Define-XML (version 2.0 or 2.1) document from a metacore metadata object. The output is an ODM-based XML file containing dataset (ItemGroupDef), variable (ItemDef), codelist, and derivation (MethodDef) metadata suitable as a starting point for regulatory submissions.

Usage

write_define_xml(
  meta,
  file,
  define_version = c("2.1", "2.0"),
  study_oid = NULL,
  study_name = "STUDY",
  study_description = "Study Description",
  protocol_name = study_name,
  standard_name = NULL,
  standard_version = NULL,
  file_oid = NULL,
  origin_default = "Derived",
  quiet = FALSE
)

Arguments

meta

A metacore object (R6 class).

file

Character string. Path to the output define.xml file.

define_version

Character. "2.0" or "2.1". Default "2.1".

study_oid

Character. ODM Study OID. Default generated.

study_name

Character. Study name for GlobalVariables.

study_description

Character. Study description.

protocol_name

Character. Protocol name. Defaults to study_name.

standard_name

Character. Name of the content standard (e.g., "SDTM-IG", "ADaM-IG"). Used for Define-XML 2.1 def:Standard.

standard_version

Character. Version of the content standard.

file_oid

Character. ODM FileOID. Default generated.

origin_default

Character. Default origin if missing (e.g., "Derived").

quiet

Logical. Suppress messages. Default FALSE.

Value

Invisibly returns the path to the written file.

Examples


library(metacore)
load(metacore_example("pilot_ADaM.rda"))  # loads object named 'metacore'
tmp <- tempfile(fileext = ".xml")
write_define_xml(metacore, tmp, study_name = "CDISCPILOT01")
unlink(tmp)