Skip to content

Commit

Permalink
[GLT-4120] skip analysis review based on deliverables
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke committed Apr 10, 2024
1 parent 4dd6b1d commit 076f918
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 93 deletions.
57 changes: 29 additions & 28 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.format.settings.url": ".vscode/eclipse-java-google-style.xml",
"[java]": {
"editor.defaultFormatter": "redhat.java",
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file"
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features",
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.formatOnSave": false // Formatting breaks multi-level lists and doesn't respect config
},
"editor.tabSize": 2,
"java.saveActions.organizeImports": true,
"java.sources.organizeImports.staticStarThreshold": 2
"java.configuration.updateBuildConfiguration": "automatic",
"java.format.settings.url": ".vscode/eclipse-java-google-style.xml",
"[java]": {
"editor.defaultFormatter": "redhat.java",
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file"
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features",
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.formatOnSave": false // Formatting breaks multi-level lists and doesn't respect config
},
"editor.tabSize": 2,
"java.saveActions.organizeImports": true,
"java.sources.organizeImports.staticStarThreshold": 2,
"java.compile.nullAnalysis.mode": "automatic"
}
1 change: 1 addition & 0 deletions changes/change_analysisReviewSkip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Analysis review will be marked 'N/A' for cases where none of the deliverables require analysis review
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public Function<String, Predicate<Test>> testPredicate() {
PAUSED(string -> kase -> ("Yes".equals(string)) ? kase.getRequisition().isPaused() : !kase.getRequisition().isPaused()),
COMPLETED(string -> {
CompletedGate gate = getGate(string);
return gate.predicate();
Predicate<Case> applicable = x -> gate.isApplicable(x);
return applicable.and(gate.predicate());
}) {
@Override
public Function<String, Predicate<Test>> testPredicate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,33 @@ public boolean qualifySample(Sample sample, MetricCategory requestCategory) {
ANALYSIS_REVIEW("Analysis Review", true) {
@Override
public boolean qualifyCase(Case kase) {
return qualifyCaseForDeliverableType(kase, null, CaseDeliverable::getAnalysisReviewQcPassed);
if (SampleUtils.isAnalysisReviewSkipped(kase)) {
return FULL_DEPTH_SEQUENCING.qualifyCase(kase);
} else {
return qualifyCaseForDeliverableType(kase, null, CaseDeliverable::getAnalysisReviewQcPassed);
}
}
},
ANALYSIS_REVIEW_DATA_RELEASE("Analysis Review - Data Release", true, DeliverableType.DATA_RELEASE) {
@Override
public boolean qualifyCase(Case kase) {
return qualifyCaseForDeliverableType(kase, DeliverableType.DATA_RELEASE,
CaseDeliverable::getAnalysisReviewQcPassed);
if (SampleUtils.isAnalysisReviewSkipped(kase)) {
return FULL_DEPTH_SEQUENCING.qualifyCase(kase);
} else {
return qualifyCaseForDeliverableType(kase, DeliverableType.DATA_RELEASE,
CaseDeliverable::getAnalysisReviewQcPassed);
}
}
},
ANALYSIS_REVIEW_CLINICAL_REPORT("Analysis Review - Clinical Report", true, DeliverableType.CLINICAL_REPORT) {
@Override
public boolean qualifyCase(Case kase) {
return qualifyCaseForDeliverableType(kase, DeliverableType.CLINICAL_REPORT,
CaseDeliverable::getAnalysisReviewQcPassed);
if (SampleUtils.isAnalysisReviewSkipped(kase)) {
return FULL_DEPTH_SEQUENCING.qualifyCase(kase);
} else {
return qualifyCaseForDeliverableType(kase, DeliverableType.CLINICAL_REPORT,
CaseDeliverable::getAnalysisReviewQcPassed);
}
}
},
RELEASE_APPROVAL("Release Approval", false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,25 @@ public boolean qualifySample(Sample sample, MetricCategory requestCategory) {
ANALYSIS_REVIEW("Analysis Review", true) {
@Override
public boolean qualifyCase(Case kase) {
return CompletedGate.FULL_DEPTH_SEQUENCING.qualifyCase(kase)
return !SampleUtils.isAnalysisReviewSkipped(kase)
&& CompletedGate.FULL_DEPTH_SEQUENCING.qualifyCase(kase)
&& !CompletedGate.ANALYSIS_REVIEW.qualifyCase(kase);
}
},
ANALYSIS_REVIEW_DATA_RELEASE("Analysis Review - Data Release", true) {
@Override
public boolean qualifyCase(Case kase) {
return CompletedGate.FULL_DEPTH_SEQUENCING.qualifyCase(kase)
return !SampleUtils.isAnalysisReviewSkipped(kase)
&& CompletedGate.FULL_DEPTH_SEQUENCING.qualifyCase(kase)
&& CompletedGate.ANALYSIS_REVIEW_DATA_RELEASE.isApplicable(kase)
&& !CompletedGate.ANALYSIS_REVIEW_DATA_RELEASE.qualifyCase(kase);
}
},
ANALYSIS_REVIEW_CLINICAL_REPORT("Analysis Review - Clinical Report", true) {
@Override
public boolean qualifyCase(Case kase) {
return CompletedGate.FULL_DEPTH_SEQUENCING.qualifyCase(kase)
return !SampleUtils.isAnalysisReviewSkipped(kase)
&& CompletedGate.FULL_DEPTH_SEQUENCING.qualifyCase(kase)
&& CompletedGate.ANALYSIS_REVIEW_CLINICAL_REPORT.isApplicable(kase)
&& !CompletedGate.ANALYSIS_REVIEW_CLINICAL_REPORT.qualifyCase(kase);
}
Expand All @@ -266,17 +269,15 @@ public boolean qualifyCase(Case kase) {
RELEASE_APPROVAL_DATA_RELEASE("Release Approval - Data Release", false) {
@Override
public boolean qualifyCase(Case kase) {
return (kase.isStopped() || CompletedGate.ANALYSIS_REVIEW_DATA_RELEASE.qualifyCase(kase))
&& CompletedGate.RELEASE_APPROVAL_DATA_RELEASE.isApplicable(kase)
&& !CompletedGate.RELEASE_APPROVAL_DATA_RELEASE.qualifyCase(kase);
return Helpers.isPendingReleaseApproval(kase, CompletedGate.ANALYSIS_REVIEW_DATA_RELEASE,
CompletedGate.RELEASE_APPROVAL_DATA_RELEASE);
}
},
RELEASE_APPROVAL_CLINICAL_REPORT("Release Approval - Clinical Report", false) {
@Override
public boolean qualifyCase(Case kase) {
return (kase.isStopped() || CompletedGate.ANALYSIS_REVIEW_CLINICAL_REPORT.qualifyCase(kase))
&& CompletedGate.RELEASE_APPROVAL_CLINICAL_REPORT.isApplicable(kase)
&& !CompletedGate.RELEASE_APPROVAL_CLINICAL_REPORT.qualifyCase(kase);
return Helpers.isPendingReleaseApproval(kase, CompletedGate.ANALYSIS_REVIEW_CLINICAL_REPORT,
CompletedGate.RELEASE_APPROVAL_CLINICAL_REPORT);
}
},
RELEASE("Release", false) {
Expand Down Expand Up @@ -395,6 +396,14 @@ public static boolean hasPendingQc(List<Sample> samples) {
public static boolean hasPendingDataReview(List<Sample> samples) {
return samples.stream().anyMatch(pendingDataReview);
}

public static boolean isPendingReleaseApproval(Case kase, CompletedGate previousGate,
CompletedGate gate) {
if (!kase.isStopped() && !previousGate.qualifyCase(kase)) {
return false;
}
return gate.isApplicable(kase) && !gate.qualifyCase(kase);
}
}

}
5 changes: 5 additions & 0 deletions src/main/java/ca/on/oicr/gsi/dimsum/util/SampleUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ca.on.oicr.gsi.dimsum.util;

import java.util.function.Predicate;
import ca.on.oicr.gsi.cardea.data.Case;
import ca.on.oicr.gsi.cardea.data.Sample;

public class SampleUtils {
Expand Down Expand Up @@ -44,4 +45,8 @@ public static boolean isPendingDataReview(Sample sample) {
public static boolean isTopUpRequired(Sample sample) {
return TOP_UP_REASON.equals(sample.getQcReason());
}

public static boolean isAnalysisReviewSkipped(Case kase) {
return kase.getProjects().stream().allMatch(project -> project.isAnalysisReviewSkipped());
}
}
24 changes: 23 additions & 1 deletion src/test/java/ca/on/oicr/gsi/dimsum/MockCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static List<Case> getCases() {
makeCase12(), makeCase13(), makeCase14(), makeCase15(), makeCase16(), makeCase17(),
makeCase18(), makeCase19(), makeCase20(), makeCase21(), makeCase22(), makeCase23(),
makeCase24(), makeCase25(), makeCase26(), makeCase27(), makeCase28(), makeCase29(),
makeCase30(), makeCase31());
makeCase30(), makeCase31(), makeCase32(), makeCase33());

private static Case makeCase0() {
final int caseNumber = 0;
Expand Down Expand Up @@ -398,6 +398,28 @@ private static Case makeCase31() {
return kase;
}

private static Case makeCase32() {
// Analysis review skipped, but case is not there yet anyway
final int caseNumber = 32;
Case kase = makeCase("PRO32_0001", "Single Test", "PRO32", "REQ32", caseNumber);
addTest(kase, caseNumber, 1, "test", "WG", false, false, false, false);
addDeliverable(kase, DeliverableType.DATA_RELEASE, "FastQ");
Project project = kase.getProjects().iterator().next();
when(project.isAnalysisReviewSkipped()).thenReturn(true);
return kase;
}

private static Case makeCase33() {
// Full-depth completed, analysis review skipped
final int caseNumber = 33;
Case kase = makeCase("PRO33_0001", "Single Test", "PRO33", "REQ33", caseNumber);
addTest(kase, caseNumber, 1, "test", "WG", true, true, true, true);
addDeliverable(kase, DeliverableType.DATA_RELEASE, "FastQ");
Project project = kase.getProjects().iterator().next();
when(project.isAnalysisReviewSkipped()).thenReturn(true);
return kase;
}

private static Case makeCase(String donorName, String assayName, String projectName,
String requisitionName, int caseNumber) {
Case kase = mock(Case.class);
Expand Down
Loading

0 comments on commit 076f918

Please sign in to comment.