ctsit / redcapcustodian

Simplified, automated data management on REDCap systems
Other
12 stars 6 forks source link

Port etl job logging #42

Closed mbentz-uf closed 2 years ago

mbentz-uf commented 2 years ago

This pr does a few things:

  1. Fixes devtools::check
  2. Adds etl job logging
  3. Adds tests to verify ported functions

However, there are a few key changes from the stp.

  1. connect_to_db is a new function that wraps DBI::dbConnect. We can use it to connect to a sqlite or any other DBIDriver interface by passing the specific driver and prefix i.e., "RCC", "STP", "LOG".
  2. init_log_con now uses connect_to_db.
  3. init_etl takes an additional log_db_drv parameter. The goal is to be able to pass a sqlite driver when running tests. If log_db_drv is null then it defaults to using MariaDB and looking for LOG_DB_* environment variables.
  4. disable_non_interactive_quit is a new function that prevents quit_non_interactive_run from quitting. I think this should be only be called from tests to verify all possible test cases.
  5. is_db_con uses inherits(con, "DBIConnection") instead of checking == "S4".