Assesses the content and structure of a dossier object (list of datasets) and generates reports of the results. This function can be used to evaluate data structure, presence of specific fields, coherence across elements, and data dictionary formats.

dossier_evaluate(dossier, taxonomy = NULL, is_data_dict_mlstr = TRUE)

Arguments

dossier

List of data frame, each of them being datasets.

taxonomy

An optional data frame identifying a variable classification schema.

is_data_dict_mlstr

Whether the input data dictionary should be coerced with specific format restrictions for compatibility with other Maelstrom Research software. TRUE by default.

Value

A list of data frames containing assessment reports.

Details

A dossier is a named list containing at least one data frame or more, each of them being datasets. The name of each data frame will be use as the reference name of the dataset.

A taxonomy is a classification schema that can be defined for variable attributes. A taxonomy is usually extracted from an Opal environment, and a taxonomy object is a data frame that must contain at least the columns taxonomy, vocabulary, and terms. Additional details about Opal taxonomies are available online.

The object may be specifically formatted to be compatible with additional Maelstrom Research software, in particular Opal environments.

Examples

# \donttest{

library(dplyr)

# use madshapR_examples provided by the package
dataset1 <- as_dataset(madshapR_examples$`dataset_example`)
dataset2 <- as_dataset(madshapR_examples$`dataset_example - error`,col_id = "part_id")
dossier <- dossier_create(list(dataset1,dataset2))

eval_dossier <- dossier_evaluate(dossier,is_data_dict_mlstr = TRUE)
#> - DOSSIER ASSESSMENT: ----------------------------------------------------
#> - DATA DICTIONARY ASSESSMENT: data_dict --------------
#>     Assess the standard adequacy of naming
#>     Assess the uniqueness and presence of variable names
#>     Assess the presence of possible duplicated columns
#>     Assess the presence of duplicated rows
#>     Assess the presence of empty rows in the data dictionary
#>     Assess the presence of empty column in the data dictionary
#>     Assess the `valueType` column in 'Variables'
#>     Assess the completion of `label` column in 'Variables'
#>     Generate report
#> 
#>     The data dictionary contains no errors/warnings.
#> 
#>   - WARNING MESSAGES (if any): --------------------------------------------
#> 
#> - DATASET ASSESSMENT: dataset1 --------------------------
#>     Assess the standard adequacy of naming
#>     Assess the presence of variable names both in dataset and data dictionary
#>     Assess the presence of possible duplicated variable in the dataset
#>     Assess the presence of possible duplicated participants
#>     Assess the presence of unique value columns in dataset
#>     Assess the presence of empty rows in the dataset
#>     Assess the presence all empty variable in the dataset
#>     Assess the Categories comparison in dataset and data dictionary
#>     Assess the `valueType` comparison in dataset and data dictionary
#>     Generate report
#> 
#>   - WARNING MESSAGES (if any): -------------------------------------------------
#>     
#> - DATA DICTIONARY ASSESSMENT: data_dict --------------
#>     Assess the standard adequacy of naming
#>     Assess the uniqueness and presence of variable names
#>     Assess the presence of possible duplicated columns
#>     Assess the presence of duplicated rows
#>     Assess the presence of empty rows in the data dictionary
#>     Assess the presence of empty column in the data dictionary
#>     Assess the `valueType` column in 'Variables'
#>     Assess the completion of `label` column in 'Variables'
#>     Generate report
#> 
#>     The data dictionary contains no errors/warnings.
#> 
#>   - WARNING MESSAGES (if any): --------------------------------------------
#> 
#> - DATASET ASSESSMENT: dataset2 --------------------------
#>     Assess the standard adequacy of naming
#>     Assess the presence of variable names both in dataset and data dictionary
#>     Assess the presence of possible duplicated variable in the dataset
#>     Assess the presence of possible duplicated participants
#>     Assess the presence of unique value columns in dataset
#>     Assess the presence of empty rows in the dataset
#>     Assess the presence all empty variable in the dataset
#>     Assess the Categories comparison in dataset and data dictionary
#>     Assess the `valueType` comparison in dataset and data dictionary
#>     Generate report
#> 
#>   - WARNING MESSAGES (if any): -------------------------------------------------
#>     
glimpse(eval_dossier)
#> List of 2
#>  $ dataset1:List of 2
#>   ..$ Data dictionary summary: tibble [9 × 6] (S3: tbl_df/tbl/data.frame)
#>   ..$ Dataset assessment     : tibble [7 × 5] (S3: tbl_df/tbl/data.frame)
#>  $ dataset2:List of 2
#>   ..$ Data dictionary summary: tibble [9 × 6] (S3: tbl_df/tbl/data.frame)
#>   ..$ Dataset assessment     : tibble [13 × 5] (S3: tbl_df/tbl/data.frame)

# }