Cohort-based covariates: binary, aggregated on Eunomia

`covariates` not equivalent to `expectedCovariates`.
Component “rowId”: Numeric: lengths (3, 2) differ
Component “covariateId”: Numeric: lengths (3, 2) differ
Component “covariateValue”: Numeric: lengths (3, 2) differ
Component “timeId”: Numeric: lengths (3, 2) differ

Cohort-based covariates: binary, non-aggregated, temporal on Eunomia

`covariates` not equivalent to `expectedCovariates`.
Component “cohortDefinitionId”: Numeric: lengths (3, 2) differ
Component “covariateId”: Numeric: lengths (3, 2) differ
Component “timeId”: Numeric: lengths (3, 2) differ
Component “sumValue”: Numeric: lengths (3, 2) differ
Component “averageValue”: Numeric: lengths (3, 2) differ

Cohort-based covariates: binary, aggregated, temporal on Eunomia

covariatesContinuous[, names(expectedCovariates)] not equivalent to `expectedCovariates`.
Component “cohortDefinitionId”: Numeric: lengths (2, 1) differ
Component “covariateId”: Numeric: lengths (2, 1) differ
Component “countValue”: Numeric: lengths (2, 1) differ
Component “minValue”: Numeric: lengths (2, 1) differ
Component “maxValue”: Numeric: lengths (2, 1) differ
Component “averageValue”: Numeric: lengths (2, 1) differ

Cohort-based covariates: counts, aggregated on Eunomia

Cohort-based covariates: counts, non-aggregated, temporal on Eunomia

covariatesContinuous[, names(expectedCovariates)] not equivalent to `expectedCovariates`.
Component “cohortDefinitionId”: Numeric: lengths (3, 2) differ
Component “covariateId”: Numeric: lengths (3, 2) differ
Component “countValue”: Numeric: lengths (3, 2) differ
Component “minValue”: Numeric: lengths (3, 2) differ
Component “maxValue”: Numeric: lengths (3, 2) differ
Component “averageValue”: Numeric: lengths (3, 2) differ
Component “timeId”: Numeric: lengths (3, 2) differ

Cohort-based covariates: counts, aggregated, temporal on Eunomia

Error in `eval(code, test_env)`: object 'connection' not found

# This file covers the code in GetDefaultCovariates.R. View coverage for this file using
results <- getDbDefaultCovariateData(connection = eunomiaConnection,
targetTables = list(covariates = "ut_cov",
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM main.ut_cov")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM main.ut_cov_ref")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(connection, "SELECT COUNT(*) FROM main.ut_cov_analysis_ref")[1], 1)
targetTables = list(covariates = "ut_cov_agg",
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM main.ut_cov_agg")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM main.ut_cov_ref_agg")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM main.ut_cov_analysis_ref_agg")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_agg")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_ref_agg")[1], 1)
expect_gt(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_anal_ref_agg")[1], 1)
covCt <- DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov")[1]
covRefCt <- DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_ref")[1]
anlRefCt <- DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_analysis_ref")[1]
# append results rather than deleting the tables
expect_equal(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov")[1], covCt * 2)
expect_equal(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_ref")[1], covRefCt * 2)
expect_equal(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_analysis_ref")[1], anlRefCt * 2)
# Recreate tables (and check create override works)
expect_equal(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov")[1], covCt)
expect_equal(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_ref")[1], covRefCt)
expect_equal(DatabaseConnector::renderTranslateQuerySql(eunomiaConnection, "SELECT COUNT(*) FROM #ut_cov_analysis_ref")[1], anlRefCt)
# AGS - This test fails and is likely due to a bug when using SqlLite
#   results <- getDbDefaultCovariateData(connection = connection,