Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACAS doesn't catch when a lot is not associated with a project #838

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions modules/GenericDataParser/src/server/generic_data_parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,13 @@ validateCalculatedResults <- function(calculatedResults, dryRun, curveNames, tes
# columns of batchProjects must include "Project.Code" and "Requested.Name", both strings
batchProjects <- getProjectForBatch(c(unique(calculatedResults$batchCode[batchesToCheck])), mainCode)

# Make sure every batch has a project
batchProjectsMissingProject <- batchProjects[is.na(batchProjects$Project.Code) | batchProjects$Project.Code == "",]
if(nrow(batchProjectsMissingProject) > 0) {
stopUser(paste0("The following ", mainCode, "s do not have a project assigned: ", paste(batchProjectsMissingProject$Requested.Name, collapse=", "),
". Please assign a project to these ", mainCode, "s before proceeding."))
}

# Check if each project is allowed to be loaded to this experiment
# A project can only be used in the experiment if it's an unrestricted project or belongs to the project which this experiment belongs to
projectsDT <- data.table(projectDF)
Expand All @@ -622,7 +629,7 @@ validateCalculatedResults <- function(calculatedResults, dryRun, curveNames, tes

# Merge batch projects to project restrition information
batchProjectWithRestrictionInfo <- as.data.table(merge(batchProjects, projectsDT, by.x="Project.Code", by.y="code"))

# Create a data table with one row per batch with a boolean column as to whether it can be used in the experiment
# if any of the projects the batch belongs to is allowed to be loaded to this experiment, then the batch can be loaded to the experiment
canUseBatchDT <- batchProjectWithRestrictionInfo[ , any(projectAllowedForExperiment), by = Requested.Name]
Expand All @@ -643,7 +650,7 @@ validateCalculatedResults <- function(calculatedResults, dryRun, curveNames, tes
userRoles <- unlist(lapply(recordedByUser$roles, function(role) role$roleEntry$roleName))
if(configList$client.roles.crossProjectLoaderRole %in% userRoles) {
addProjectError <- FALSE
warnUser(paste0("This assay data will be associated with project '",currentProj$name,"' but will reference compounds that are associated with project(s): ",paste0("'",unique(rCompoundsDF$name),"'", collapse = ", ")))
warnUser(paste0("This assay data will be associated with project '",currentProj$name,"' but will reference compounds that are associated with project(s): ",paste0("'",unique(batchProjectWithRestrictionInfo[Requested.Name %in% rCompounds]$name),"'", collapse = ", ")))
}
}
}
Expand Down