View source: R/etl_qa_run_pipeline.R
etl_qa_setup_config | R Documentation |
This function creates a configuration object for the ETL QA pipeline based on
the provided parameters. It is the first step called upon by
etl_qa_run_pipeline
.
etl_qa_setup_config(
data_source_type,
connection = NULL,
data_params = list(),
output_directory = NULL,
digits_mean = 0,
digits_prop = 3,
abs_threshold = 3,
rel_threshold = 2
)
data_source_type |
Character string specifying the type of data source |
connection |
A DBIConnection object for SQL Server connections |
data_params |
List of parameters specific to the data source |
output_directory |
Character string specifying the output directory |
digits_mean |
Integer specifying decimal places for mean rounding |
digits_prop |
Integer specifying decimal places for proportion rounding |
abs_threshold |
Numeric threshold for flagging absolute changes |
rel_threshold |
Numeric threshold for flagging relative changes |
This is an internal function accessible only by use of :::
, for example,
apde:::etl_qa_setup_config(...)
. The arguments are identical to those used
by etl_qa_run_pipeline
. Please review that helpful for details.
An S3 object of class "qa_data_config", which is a list containing the configuration settings.
## Not run:
# The following examples generate config objects which can be passed to
# etl_qa_initial_results()
# Example with RADS
config.rads <- etl_qa_setup_config(
data_source_type = 'rads',
data_params = list(
function_name = 'get_data_birth',
time_var = 'chi_year',
time_range = c(2021, 2022),
cols = c('chi_age', 'race4', 'birth_weight_grams', 'birthplace_city',
'num_prev_cesarean', 'mother_date_of_birth'),
version = 'final',
kingco = FALSE,
check_chi = FALSE
),
output_directory = 'C:/temp/'
)
class(config.rads)
# Example with R data.frame
birth_data <- rads::get_data_birth(year = c(2021:2022),
kingco = F,
cols = c('chi_age', 'race4', 'birth_weight_grams',
'birthplace_city', 'num_prev_cesarean',
'chi_year', 'mother_date_of_birth'),
)
config.df <- etl_qa_setup_config(
data_source_type = 'r_dataframe',
data_params = list(
data = birth_data,
time_var = 'chi_year',
time_range = c(2021, 2022),
cols = c('chi_age', 'race4', 'birth_weight_grams', 'birthplace_city',
'num_prev_cesarean', 'mother_date_of_birth'),
check_chi = FALSE
),
output_directory = 'C:/temp/'
)
class(config.df)
# Example with SQL Server
library(DBI)
myconnection <- rads::validate_hhsaw_key()
config.sql <- etl_qa_setup_config(
data_source_type = 'sql_server',
connection = myconnection,
data_params = list(
schema_table = 'birth.final_analytic',
time_var = 'chi_year',
time_range = c(2021, 2022),
cols =c('chi_age', 'race4', 'birth_weight_grams', 'birthplace_city',
'num_prev_cesarean', 'mother_date_of_birth'),
check_chi = FALSE
),
output_directory = 'C:/temp/'
)
class(config.sql)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.