diff --git a/NEWS.md b/NEWS.md index cf1f9526..e812911f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,10 @@ Changes: 7. Improve speed of covariate balance computation. 8. Adding one-sided (calibrated) p-values to results summary and results model. + +9. Adding `unblind_for_evidence_synthesis` field to `cm_diagnostics_summary` table. + +10. The `cm_diagnostics_summary` table now also contains negative controls. Bugfixes: diff --git a/R/Export.R b/R/Export.R index 34da9cbe..1f5254dc 100644 --- a/R/Export.R +++ b/R/Export.R @@ -58,7 +58,7 @@ createCmDiagnosticThresholds <- function(mdrrThreshold = 10, checkmate::reportAssertions(collection = errorMessages) if (!is.null(attritionFractionThreshold)) { warning("The attritionFractionThreshold argument is deprecated and will be ignored. ", - "See generalizabilitySdmThreshold instead.") + "See generalizabilitySdmThreshold instead.") } thresholds <- list() for (name in names(formals(createCmDiagnosticThresholds))) { @@ -594,8 +594,8 @@ exportCmInteractionResults <- function(outputFolder, } exportLikelihoodProfiles <- function(outputFolder, - exportFolder, - databaseId) { + exportFolder, + databaseId) { message("- likelihood_profile table") reference <- getFileReference(outputFolder) fileName <- file.path(exportFolder, "cm_likelihood_profile.csv") @@ -764,7 +764,7 @@ tidyBalance <- function(balance, minCellCount) { round(.data$targetStdDiff, 3) == 0 & round(.data$comparatorStdDiff, 3) == 0 & round(.data$targetComparatorStdDiff, 3) == 0) - ) %>% + ) %>% enforceMinCellValue("targetMeanBefore", minCellCount / inferredTargetBeforeSize, silent = TRUE @@ -1200,7 +1200,6 @@ exportDiagnosticsSummary <- function(outputFolder, pull() equipoise <- bind_rows(lapply(sharedPsFiles, getEquipoise)) results <- reference %>% - filter(.data$outcomeOfInterest) %>% inner_join( resultsSummary, by = join_by("analysisId", "targetId", "comparatorId", "outcomeId")) %>% @@ -1227,6 +1226,7 @@ exportDiagnosticsSummary <- function(outputFolder, # Apply diagnostics thresholds: results <- results %>% + mutate(databaseId = !!databaseId) %>% mutate(balanceDiagnostic = case_when( is.na(.data$maxSdm) ~ "NOT EVALUATED", .data$maxSdm < cmDiagnosticThresholds$sdmThreshold ~ "PASS", @@ -1262,8 +1262,12 @@ exportDiagnosticsSummary <- function(outputFolder, .data$easeDiagnostic != "FAIL" & .data$equipoiseDiagnostic != "FAIL" & .data$balanceDiagnostic != "FAIL" & - .data$sharedBalanceDiagnostic != "FAIL", 1, 0), - databaseId = !!databaseId) + .data$sharedBalanceDiagnostic != "FAIL", 1, 0)) %>% + mutate(unblindForEvidenceSynthesis = ifelse(.data$generalizabilityDiagnostic != "FAIL" & + .data$easeDiagnostic != "FAIL" & + .data$equipoiseDiagnostic != "FAIL" & + .data$balanceDiagnostic != "FAIL" & + .data$sharedBalanceDiagnostic != "FAIL", 1, 0)) # Add deprecated fields: results <- results %>% diff --git a/inst/Results_Eunomia.zip b/inst/Results_Eunomia.zip index f1dc01ae..ea6149df 100644 Binary files a/inst/Results_Eunomia.zip and b/inst/Results_Eunomia.zip differ diff --git a/inst/csv/resultsDataModelSpecification.csv b/inst/csv/resultsDataModelSpecification.csv index 0132bd05..853b7f47 100644 --- a/inst/csv/resultsDataModelSpecification.csv +++ b/inst/csv/resultsDataModelSpecification.csv @@ -131,6 +131,7 @@ cm_diagnostics_summary,attrition_diagnostic,varchar(20),No,No,No,Yes,DEPRECATED: cm_diagnostics_summary,generalizability_diagnostic,varchar(20),Yes,No,No,No,Pass / warning / fail classification of the generalizability diagnostic. cm_diagnostics_summary,ease_diagnostic,varchar(20),Yes,No,No,No,Pass / warning / fail classification of the EASE diagnostic. cm_diagnostics_summary,unblind,int,Yes,No,No,No,"Is unblinding the result recommended? (1 = yes, 0 = no)" +cm_diagnostics_summary,unblind_for_evidence_synthesis,int,Yes,No,No,No,"Is unblinding the result for inclusion in evidence synthesis recommended? This ignores the MDRR diagnostic. (1 = yes, 0 = no)" cm_target_comparator_outcome,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. cm_target_comparator_outcome,outcome_of_interest,int,Yes,No,No,No,"Is the outcome of interest (1 = yes, 0 = no)" cm_target_comparator_outcome,true_effect_size,float,No,No,No,No,The true effect size for the target-comparator-outcome. For negatitive controls this equals 1. diff --git a/inst/sql/sql_server/migrations/Migration_1-v5_2_0.sql b/inst/sql/sql_server/migrations/Migration_1-v5_2_0.sql index 5b0a0fb4..35ab5f1d 100644 --- a/inst/sql/sql_server/migrations/Migration_1-v5_2_0.sql +++ b/inst/sql/sql_server/migrations/Migration_1-v5_2_0.sql @@ -14,8 +14,9 @@ -- Add: -- - generalizability_max_sdm -- - generalizability_diagnostic +-- - unblind_for_evidence_synthesis ALTER TABLE @database_schema.@table_prefixcm_result ADD target_estimator VARCHAR(3), one_sided_p FLOAT, calibrated_one_sided_p FLOAT; ALTER TABLE @database_schema.@table_prefixcm_interaction_result ADD target_estimator VARCHAR(3); ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ADD mean_before FLOAT, mean_after FLOAT, target_std_diff FLOAT, comparator_std_diff FLOAT, target_comparator_std_diff FLOAT; ALTER TABLE @database_schema.@table_prefixcm_shared_covariate_balance ADD mean_before FLOAT, mean_after FLOAT, target_std_diff FLOAT, comparator_std_diff FLOAT, target_comparator_std_diff FLOAT; -ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ADD generalizability_max_sdm FLOAT, generalizability_diagnostic VARCHAR(20); +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ADD generalizability_max_sdm FLOAT, generalizability_diagnostic VARCHAR(20), unblind_for_evidence_synthesis INT; diff --git a/tests/testthat/test-eunomia.R b/tests/testthat/test-eunomia.R index 5deeeec5..0f753553 100644 --- a/tests/testthat/test-eunomia.R +++ b/tests/testthat/test-eunomia.R @@ -218,6 +218,12 @@ test_that("Multiple analyses", { targetComparatorOutcome <- readr::read_csv(file.path(outputFolder, "export", "cm_target_comparator_outcome.csv"), show_col_types = FALSE) expect_true(is.numeric(targetComparatorOutcome$outcome_of_interest)) + # Verify negative controls have diagnostics: + ncDiagnostics <- diagnosticsSummary %>% + inner_join(targetComparatorOutcome) %>% + filter(.data$outcome_of_interest == 0) + expect_gt(nrow(ncDiagnostics), 0) + cohorts <- data.frame( cohortId = c(1, 2, 998, 999, 3, 4), cohortName = c("e1", "e2", "e3", "e4", "o1", "o2")