ds.validate_table: Check if a dataframe/table is compliant to peekbank json...

View source: R/peekds_validators.R

ds.validate_tableR Documentation

Check if a dataframe/table is compliant to peekbank json before database import

Description

Check if a dataframe/table is compliant to peekbank json before database import

Usage

ds.validate_table(
  df_table,
  table_type,
  cdi_expected,
  dir_csv,
  is_null_field_required = TRUE
)

Arguments

df_table

the dataframe to be saved

table_type

the type of dataframe, for the most updated table types specified by schema, please use functionds.list_ds_tables()

is_null_field_required

by default is set to TRUE which means that all the columns in the json file are required; when user specifically sets this to FALSE, then the fields that are allowed null values are not required.

Value

an empty string when the input data frame is compliant with json specification, such as having all the required columns, primary key field has unique values, etc. Otherwise, the function returns a list of messages describing detailed issues that needs to be fixed

Examples

## Not run: 
is_valid <-ds.validate_table(df_table = df_table, table_type = "xy_data", cdi_expected = F, dir_csv = "../processed_data")

## End(Not run)


langcog/peekbankr documentation built on Jan. 6, 2025, 10:09 a.m.