From f1f84ced5d7ae23290f80c41c3577663f229b340 Mon Sep 17 00:00:00 2001 From: Dillan Cooke Date: Tue, 17 Oct 2023 13:54:12 -0400 Subject: [PATCH] [GLT-4012] added assay turn-around time targets --- .../ca/on/oicr/gsi/cardea/data/Assay.java | 12 ++ .../on/oicr/gsi/cardea/data/AssayTargets.java | 134 ++++++++++++++++++ .../java/ca/on/oicr/gsi/cardea/data/Case.java | 1 - .../on/oicr/gsi/cardea/server/CaseLoader.java | 18 +++ .../gsi/cardea/server/CaseLoaderTest.java | 12 ++ .../src/test/resources/testdata/assays.json | 11 ++ changes/add_tatTargets.md | 1 + 7 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/AssayTargets.java create mode 100644 changes/add_tatTargets.md diff --git a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Assay.java b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Assay.java index bbccb25..d32deff 100644 --- a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Assay.java +++ b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Assay.java @@ -19,6 +19,7 @@ public class Assay { private final Map> metricCategories; private final String name; private final String version; + private final AssayTargets targets; public Assay(Builder builder) { this.id = requireNonNull(builder.id); @@ -30,6 +31,7 @@ public Assay(Builder builder) { .collect(Collectors.toMap(entry -> entry.getKey(), entry -> Collections.unmodifiableList(entry.getValue()))); this.metricCategories = Collections.unmodifiableMap(tempMap); + this.targets = requireNonNull(builder.targets); } public String getDescription() { @@ -52,6 +54,10 @@ public String getVersion() { return version; } + public AssayTargets getTargets() { + return targets; + } + @JsonPOJOBuilder(withPrefix = "") public static class Builder { @@ -60,6 +66,7 @@ public static class Builder { private Map> metricCategories; private String name; private String version; + private AssayTargets targets; public Assay build() { return new Assay(this); @@ -90,6 +97,11 @@ public Builder version(String version) { return this; } + public Builder targets(AssayTargets targets) { + this.targets = targets; + return this; + } + } } diff --git a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/AssayTargets.java b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/AssayTargets.java new file mode 100644 index 0000000..e88e7ce --- /dev/null +++ b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/AssayTargets.java @@ -0,0 +1,134 @@ +package ca.on.oicr.gsi.cardea.data; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; + +/** + * Immutable Assay Targets + */ +@JsonDeserialize(builder = AssayTargets.Builder.class) +public class AssayTargets { + + private final Integer caseDays; + private final Integer receiptDays; + private final Integer extractionDays; + private final Integer libraryPreparationDays; + private final Integer libraryQualificationDays; + private final Integer fullDepthSequencingDays; + private final Integer analysisReviewDays; + private final Integer releaseApprovalDays; + private final Integer releaseDays; + + private AssayTargets(Builder builder) { + this.caseDays = builder.caseDays; + this.receiptDays = builder.receiptDays; + this.extractionDays = builder.extractionDays; + this.libraryPreparationDays = builder.libraryPreparationDays; + this.libraryQualificationDays = builder.libraryQualificationDays; + this.fullDepthSequencingDays = builder.fullDepthSequencingDays; + this.analysisReviewDays = builder.analysisReviewDays; + this.releaseApprovalDays = builder.releaseApprovalDays; + this.releaseDays = builder.releaseDays; + } + + public Integer getCaseDays() { + return caseDays; + } + + public Integer getReceiptDays() { + return receiptDays; + } + + public Integer getExtractionDays() { + return extractionDays; + } + + public Integer getLibraryPreparationDays() { + return libraryPreparationDays; + } + + public Integer getLibraryQualificationDays() { + return libraryQualificationDays; + } + + public Integer getFullDepthSequencingDays() { + return fullDepthSequencingDays; + } + + public Integer getAnalysisReviewDays() { + return analysisReviewDays; + } + + public Integer getReleaseApprovalDays() { + return releaseApprovalDays; + } + + public Integer getReleaseDays() { + return releaseDays; + } + + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + private Integer caseDays; + private Integer receiptDays; + private Integer extractionDays; + private Integer libraryPreparationDays; + private Integer libraryQualificationDays; + private Integer fullDepthSequencingDays; + private Integer analysisReviewDays; + private Integer releaseApprovalDays; + private Integer releaseDays; + + public Builder caseDays(Integer caseDays) { + this.caseDays = caseDays; + return this; + } + + public Builder receiptDays(Integer receiptDays) { + this.receiptDays = receiptDays; + return this; + } + + public Builder extractionDays(Integer extractionDays) { + this.extractionDays = extractionDays; + return this; + } + + public Builder libraryPreparationDays(Integer libraryPreparationDays) { + this.libraryPreparationDays = libraryPreparationDays; + return this; + } + + public Builder libraryQualificationDays(Integer libraryQualificationDays) { + this.libraryQualificationDays = libraryQualificationDays; + return this; + } + + public Builder fullDepthSequencingDays(Integer fullDepthSequencingDays) { + this.fullDepthSequencingDays = fullDepthSequencingDays; + return this; + } + + public Builder analysisReviewDays(Integer analysisReviewDays) { + this.analysisReviewDays = analysisReviewDays; + return this; + } + + public Builder releaseApprovalDays(Integer releaseApprovalDays) { + this.releaseApprovalDays = releaseApprovalDays; + return this; + } + + public Builder releaseDays(Integer releaseDays) { + this.releaseDays = releaseDays; + return this; + } + + public AssayTargets build() { + return new AssayTargets(this); + } + + } + +} diff --git a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Case.java b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Case.java index 1912e98..13ce146 100644 --- a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Case.java +++ b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Case.java @@ -11,7 +11,6 @@ import java.util.function.Function; import java.util.stream.Stream; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; diff --git a/cardea-server/src/main/java/ca/on/oicr/gsi/cardea/server/CaseLoader.java b/cardea-server/src/main/java/ca/on/oicr/gsi/cardea/server/CaseLoader.java index c1e5b68..bb795fd 100644 --- a/cardea-server/src/main/java/ca/on/oicr/gsi/cardea/server/CaseLoader.java +++ b/cardea-server/src/main/java/ca/on/oicr/gsi/cardea/server/CaseLoader.java @@ -1,6 +1,7 @@ package ca.on.oicr.gsi.cardea.server; import ca.on.oicr.gsi.cardea.data.Assay; +import ca.on.oicr.gsi.cardea.data.AssayTargets; import ca.on.oicr.gsi.cardea.data.Case; import ca.on.oicr.gsi.cardea.data.CaseData; import ca.on.oicr.gsi.cardea.data.Donor; @@ -199,6 +200,7 @@ protected Map loadAssays(FileReader fileReader) .description(parseString(json, "description", false)) .version(parseString(json, "version", true)) .metricCategories(parseMetricCategories(json.get("metric_categories"))) + .targets(parseAssayTargets(json.get("targets"))) .build()); return assays.stream().collect(Collectors.toMap(Assay::getId, Function.identity())); } @@ -650,6 +652,22 @@ private List parseMetrics(JsonNode json) throws DataParseException { return metrics; } + private AssayTargets parseAssayTargets(JsonNode json) throws DataParseException { + AssayTargets.Builder builder = new AssayTargets.Builder(); + if (json != null && json.isObject()) { + builder.caseDays(parseInteger(json, "case_days", false)) + .receiptDays(parseInteger(json, "receipt_days", false)) + .extractionDays(parseInteger(json, "extraction_days", false)) + .libraryPreparationDays(parseInteger(json, "library_preparation_days", false)) + .libraryQualificationDays(parseInteger(json, "library_qualification_days", false)) + .fullDepthSequencingDays(parseInteger(json, "full_depth_sequencing_days", false)) + .analysisReviewDays(parseInteger(json, "analysis_review_days", false)) + .releaseApprovalDays(parseInteger(json, "release_approval_days", false)) + .releaseDays(parseInteger(json, "release_days", false)); + } + return builder.build(); + } + private Set parseProjects(JsonNode json, String fieldName, Map projectsByName) throws DataParseException { JsonNode projectsNode = json.get(fieldName); diff --git a/cardea-server/src/test/java/ca/on/oicr/gsi/cardea/server/CaseLoaderTest.java b/cardea-server/src/test/java/ca/on/oicr/gsi/cardea/server/CaseLoaderTest.java index d16402e..e0d3d24 100644 --- a/cardea-server/src/test/java/ca/on/oicr/gsi/cardea/server/CaseLoaderTest.java +++ b/cardea-server/src/test/java/ca/on/oicr/gsi/cardea/server/CaseLoaderTest.java @@ -5,6 +5,7 @@ import static org.mockito.Mockito.when; import ca.on.oicr.gsi.cardea.data.Assay; +import ca.on.oicr.gsi.cardea.data.AssayTargets; import ca.on.oicr.gsi.cardea.data.Case; import ca.on.oicr.gsi.cardea.data.CaseData; import ca.on.oicr.gsi.cardea.data.Donor; @@ -166,6 +167,17 @@ public void testLoadAssays() throws Exception { .orElse(null); assertNotNull(metric); assertEquals(new BigDecimal("0.7"), metric.getMinimum()); + AssayTargets targets = assay.getTargets(); + assertNotNull(targets); + assertEquals(Integer.valueOf(45), targets.getCaseDays()); + assertEquals(Integer.valueOf(2), targets.getReceiptDays()); + assertEquals(Integer.valueOf(3), targets.getExtractionDays()); + assertEquals(Integer.valueOf(3), targets.getLibraryPreparationDays()); + assertEquals(Integer.valueOf(4), targets.getLibraryQualificationDays()); + assertEquals(Integer.valueOf(7), targets.getFullDepthSequencingDays()); + assertEquals(Integer.valueOf(2), targets.getAnalysisReviewDays()); + assertEquals(Integer.valueOf(3), targets.getReleaseApprovalDays()); + assertEquals(Integer.valueOf(3), targets.getReleaseDays()); } } diff --git a/cardea-server/src/test/resources/testdata/assays.json b/cardea-server/src/test/resources/testdata/assays.json index 829b084..c8f1ffd 100644 --- a/cardea-server/src/test/resources/testdata/assays.json +++ b/cardea-server/src/test/resources/testdata/assays.json @@ -933,6 +933,17 @@ ] } ] + }, + "targets": { + "case_days": 45, + "receipt_days": 2, + "extraction_days": 3, + "library_preparation_days": 3, + "library_qualification_days": 4, + "full_depth_sequencing_days": 7, + "analysis_review_days": 2, + "release_approval_days": 3, + "release_days": 3 } } ] diff --git a/changes/add_tatTargets.md b/changes/add_tatTargets.md new file mode 100644 index 0000000..f293189 --- /dev/null +++ b/changes/add_tatTargets.md @@ -0,0 +1 @@ +Assay turn-around time targets