Generates a DataSchema from a Data Processing Elements.

dataschema_extract(data_proc_elem)

Arguments

data_proc_elem

A Data Processing Elements object.

Value

A list of data frame(s) named 'Variables' and (if any) 'Categories', with Rmonize::class 'dataschema'.

Details

The Data Processing Elements specifies the algorithms used to process input variables into harmonized variables in the DataSchema format. It is also contains metadata used to generate documentation of the processing. A Data Processing Elements object is a data frame with specific columns used in data processing: dataschema_variable, input_dataset, input_variables, Mlstr_harmo::rule_category and Mlstr_harmo::algorithm. To initiate processing, the first entry must be the creation of a harmonized primary identifier variable (e.g., participant unique ID).

Examples

{

# Use Rmonize_DEMO to run examples.
library(dplyr)

glimpse(dataschema_extract(
  data_proc_elem = Rmonize_DEMO$`data_processing_elements - final`))
}
#> List of 1
#>  $ Variables: tibble [13 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ name     : chr [1:13] "adm_unique_id" "adm_study" "adm_year_dce" "sdc_age" ...
#>   ..$ label    : chr [1:13] "adm_unique_id" "adm_study" "adm_year_dce" "sdc_age" ...
#>   ..$ valueType: chr [1:13] "text" "text" "text" "text" ...
#>   ..- attr(*, "Rmonize::class")= chr "data_proc_elem"
#>  - attr(*, "madshapR::class")= chr "data_dict_mlstr"
#>  - attr(*, "Rmonize::class")= chr "dataschema_mlstr"