Skip to content

Commit

Permalink
[GLT-4012] added assay turn-around time targets (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke authored Oct 18, 2023
1 parent d39cb61 commit 7c8810e
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Assay.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Assay {
private final Map<MetricCategory, List<MetricSubcategory>> metricCategories;
private final String name;
private final String version;
private final AssayTargets targets;

public Assay(Builder builder) {
this.id = requireNonNull(builder.id);
Expand All @@ -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() {
Expand All @@ -52,6 +54,10 @@ public String getVersion() {
return version;
}

public AssayTargets getTargets() {
return targets;
}

@JsonPOJOBuilder(withPrefix = "")
public static class Builder {

Expand All @@ -60,6 +66,7 @@ public static class Builder {
private Map<MetricCategory, List<MetricSubcategory>> metricCategories;
private String name;
private String version;
private AssayTargets targets;

public Assay build() {
return new Assay(this);
Expand Down Expand Up @@ -90,6 +97,11 @@ public Builder version(String version) {
return this;
}

public Builder targets(AssayTargets targets) {
this.targets = targets;
return this;
}

}

}
134 changes: 134 additions & 0 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/AssayTargets.java
Original file line number Diff line number Diff line change
@@ -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);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -199,6 +200,7 @@ protected Map<Long, Assay> 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()));
}
Expand Down Expand Up @@ -650,6 +652,22 @@ private List<Metric> 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<Project> parseProjects(JsonNode json, String fieldName,
Map<String, Project> projectsByName) throws DataParseException {
JsonNode projectsNode = json.get(fieldName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}

Expand Down
11 changes: 11 additions & 0 deletions cardea-server/src/test/resources/testdata/assays.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
]
1 change: 1 addition & 0 deletions changes/add_tatTargets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assay turn-around time targets

0 comments on commit 7c8810e

Please sign in to comment.