Skip to contents

Create the base object used to write a Dataset JSON file.

Usage

dataset_json(
  .data,
  item_id,
  name,
  label,
  items,
  dataset_meta,
  version = "1.0.0",
  data_type = c("clinicalData", "referenceData"),
  file_meta = file_metadata(),
  data_meta = data_metadata()
)

Arguments

.data

Input data to contain within the Dataset JSON file. Written to the itemData parameter.

item_id

ID used to label dataset with the itemGroupData parameter. Defined as "Object of Datasets. Key value is a unique identifier for Dataset, corresponding to ItemGroupDef/@OID in Define-XML."

name

Dataset name

label

Dataset Label

items

Variable metadata

dataset_meta

A dataset_metadata object holding pre-specified dataset metadata.

version

Version of Dataset JSON schema to follow.

data_type

Type of data being written. clinicalData for subject level data, and referenceData for non-subject level data (i.e. TDMs, Associated Persons)

file_meta

A file_metadata object holding pre-specified file metadata

data_meta

A data_metadata object holding pre-specified data metadata

Value

dataset_json object pertaining to the specific Dataset JSON version specific

Examples

# Create a basic object
ds_json <- dataset_json(iris, "IG.IRIS", "IRIS", "Iris", iris_items)

# Attach attributes directly
ds_json_updated <- set_data_type(ds_json, "referenceData")
ds_json_updated <- set_file_oid(ds_json_updated, "/some/path")
ds_json_updated <- set_metadata_ref(ds_json_updated, "some/define.xml")
ds_json_updated <- set_metadata_version(ds_json_updated, "MDV.MSGv2.0.SDTMIG.3.3.SDTM.1.7")
ds_json_updated <- set_originator(ds_json_updated, "Some Org")
ds_json_updated <- set_source_system(ds_json_updated, "source system", "1.0")
ds_json_updated <- set_study_oid(ds_json_updated, "SOMESTUDY")

# Create independent objects for metadata sections first
file_meta <- file_metadata(
  originator = "Some Org",
  sys = "source system",
  sys_version = "1.0"
)

data_meta <- data_metadata(
  study = "SOMESTUDY",
  metadata_version = "MDV.MSGv2.0.SDTMIG.3.3.SDTM.1.7",
  metadata_ref = "some/define.xml"
)

dataset_meta <- dataset_metadata(
  item_id = "IG.IRIS",
  name = "IRIS",
  label = "Iris",
  items = iris_items
)

ds_json_from_meta <- dataset_json(
  iris,
  dataset_meta = dataset_meta,
  file_meta = file_meta,
  data_meta = data_meta
  )