Skip to content

Commit

Permalink
deduplicate redundant analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Oct 18, 2024
1 parent 581c10c commit 1ba12be
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions R/ExternalValidatePlp.R
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ getData <- function(design, database, outputFolder, downloadTasks) {
if (!dir.exists(file.path(outputFolder, databaseName))) {
dir.create(file.path(outputFolder, databaseName), recursive = TRUE)
}
if (length(covariateSettings) > 1) {
plpData$covariateData <-
deDuplicateCovariateData(plpData$covariateData)

Check warning on line 737 in R/ExternalValidatePlp.R

View check run for this annotation

Codecov / codecov/patch

R/ExternalValidatePlp.R#L736-L737

Added lines #L736 - L737 were not covered by tests
}
savePlpData(plpData, file = plpDataLocation)
}
} else {
Expand Down Expand Up @@ -845,3 +849,17 @@ createDownloadTasks <- function(validationDesignList) {

return(downloadTasks)
}

#' deplucateCovariateData - Remove duplicate covariate data
#' when downloading data with multiple different covariateSettings sometimes
#' there will be duplicated analysisIds which need to be removed
#' @param covariateData The covariate data Andromeda object
#' @return The deduplicated covariate data
#' @keywords internal
deDuplicateCovariateData <- function(covariateData) {
covariateData$covariateRef <- covariateData$covariateRef %>%
dplyr::distinct()
covariateData$covariates <- covariateData$covariates %>%
dplyr::distinct()
return(covariateData)

Check warning on line 864 in R/ExternalValidatePlp.R

View check run for this annotation

Codecov / codecov/patch

R/ExternalValidatePlp.R#L860-L864

Added lines #L860 - L864 were not covered by tests
}

0 comments on commit 1ba12be

Please sign in to comment.