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 dac663d..21bcd2d 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 @@ -34,6 +34,12 @@ public class Case { private final String timepoint; private final String tissueOrigin; private final String tissueType; + private final int receiptDaysSpent; + private final int analysisReviewDaysSpent; + private final int releaseApprovalDaysSpent; + private final int releaseDaysSpent; + private final int caseDaysSpent; + private final int pauseDays; private Case(Builder builder) { this.id = requireNonNull(builder.id); @@ -57,6 +63,12 @@ private Case(Builder builder) { Stream.of(requisition.getLatestActivityDate())) .flatMap(Function.identity()).filter(Objects::nonNull).max(LocalDate::compareTo) .orElse(null); + this.receiptDaysSpent = builder.receiptDaysSpent; + this.analysisReviewDaysSpent = builder.analysisReviewDaysSpent; + this.releaseApprovalDaysSpent = builder.releaseApprovalDaysSpent; + this.releaseDaysSpent = builder.releaseDaysSpent; + this.caseDaysSpent = builder.caseDaysSpent; + this.pauseDays = builder.pauseDays; } public long getAssayId() { @@ -115,7 +127,30 @@ public String getTissueType() { return tissueType; } - // method used by Dimsum + public int getReceiptDaysSpent() { + return receiptDaysSpent; + } + + public int getAnalysisReviewDaysSpent() { + return analysisReviewDaysSpent; + } + + public int getReleaseApprovalDaysSpent() { + return releaseApprovalDaysSpent; + } + + public int getReleaseDaysSpent() { + return releaseDaysSpent; + } + + public int getCaseDaysSpent() { + return caseDaysSpent; + } + + public int getPauseDays() { + return pauseDays; + } + public boolean isStopped() { return requisition.isStopped(); } @@ -136,7 +171,12 @@ public static class Builder { private String tissueOrigin; private String tissueType; private LocalDate startDate; - + private int receiptDaysSpent; + private int analysisReviewDaysSpent; + private int releaseApprovalDaysSpent; + private int releaseDaysSpent; + private int caseDaysSpent; + private int pauseDays; public Case build() { return new Case(this); @@ -206,5 +246,35 @@ public Builder tissueType(String tissueType) { this.tissueType = tissueType; return this; } + + public Builder receiptDaysSpent(int days) { + this.receiptDaysSpent = days; + return this; + } + + public Builder analysisReviewDaysSpent(int days) { + this.analysisReviewDaysSpent = days; + return this; + } + + public Builder releaseApprovalDaysSpent(int days) { + this.releaseApprovalDaysSpent = days; + return this; + } + + public Builder releaseDaysSpent(int days) { + this.releaseDaysSpent = days; + return this; + } + + public Builder caseDaysSpent(int days) { + this.caseDaysSpent = days; + return this; + } + + public Builder pauseDays(int days) { + this.pauseDays = days; + return this; + } } } diff --git a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Requisition.java b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Requisition.java index 62cc96b..84daa1b 100644 --- a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Requisition.java +++ b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Requisition.java @@ -28,6 +28,8 @@ public class Requisition { private final List qcGroups; private final String stopReason; private final boolean stopped; + private final boolean paused; + private final String pauseReason; private Requisition(Builder builder) { this.id = requireNonNull(builder.id); @@ -35,6 +37,8 @@ private Requisition(Builder builder) { this.assayId = builder.assayId; this.stopped = builder.stopped; this.stopReason = builder.stopReason; + this.paused = builder.paused; + this.pauseReason = builder.pauseReason; this.qcGroups = builder.qcGroups == null ? emptyList() : unmodifiableList(builder.qcGroups); this.analysisReviews = builder.analysisReviews == null ? emptyList() : unmodifiableList(builder.analysisReviews); @@ -92,19 +96,27 @@ public List getQcGroups() { return qcGroups; } + public boolean isStopped() { + return stopped; + } + public String getStopReason() { return stopReason; } + public boolean isPaused() { + return paused; + } + + public String getPauseReason() { + return pauseReason; + } + @Override public int hashCode() { return Objects.hash(id); } - public boolean isStopped() { - return stopped; - } - @JsonPOJOBuilder(withPrefix = "") public static class Builder { @@ -117,6 +129,8 @@ public static class Builder { private List qcGroups; private String stopReason; private boolean stopped; + private boolean paused; + private String pauseReason; public Builder assayId(Long assayId) { this.assayId = assayId; @@ -166,5 +180,15 @@ public Builder stopped(boolean stopped) { this.stopped = stopped; return this; } + + public Builder paused(boolean paused) { + this.paused = paused; + return this; + } + + public Builder pauseReason(String pauseReason) { + this.pauseReason = pauseReason; + return this; + } } } diff --git a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Test.java b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Test.java index 8cc818e..a2f57af 100644 --- a/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Test.java +++ b/cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Test.java @@ -31,6 +31,10 @@ public class Test { private final String tissueOrigin; private final String tissueType; private final String libraryDesignCode; + private final int extractionDaysSpent; + private final int libraryPreparationDaysSpent; + private final int libraryQualificationDaysSpent; + private final int fullDepthSequencingDaysSpent; private Test(Builder builder) { this.name = requireNonNull(builder.name); @@ -55,6 +59,10 @@ private Test(Builder builder) { fullDepthSequencings.stream()) .flatMap(Function.identity()).map(Sample::getLatestActivityDate).max(LocalDate::compareTo) .orElse(null); + this.extractionDaysSpent = builder.extractionDaysSpent; + this.libraryPreparationDaysSpent = builder.libraryPreparationDaysSpent; + this.libraryQualificationDaysSpent = builder.libraryQualificationDaysSpent; + this.fullDepthSequencingDaysSpent = builder.fullDepthSequencingDaysSpent; } public List getExtractions() { @@ -113,6 +121,22 @@ public boolean isLibraryPreparationSkipped() { return libraryPreparationSkipped; } + public int getExtractionDaysSpent() { + return extractionDaysSpent; + } + + public int getLibraryPreparationDaysSpent() { + return libraryPreparationDaysSpent; + } + + public int getLibraryQualificationDaysSpent() { + return libraryQualificationDaysSpent; + } + + public int getFullDepthSequencingDaysSpent() { + return fullDepthSequencingDaysSpent; + } + @JsonPOJOBuilder(withPrefix = "") public static class Builder { @@ -129,6 +153,10 @@ public static class Builder { private String timepoint; private String tissueOrigin; private String tissueType; + private int extractionDaysSpent; + private int libraryPreparationDaysSpent; + private int libraryQualificationDaysSpent; + private int fullDepthSequencingDaysSpent; public Test build() { return new Test(this); @@ -198,5 +226,25 @@ public Builder tissueType(String tissueType) { this.tissueType = tissueType; return this; } + + public Builder extractionDaysSpent(int days) { + this.extractionDaysSpent = days; + return this; + } + + public Builder libraryPreparationDaysSpent(int days) { + this.libraryPreparationDaysSpent = days; + return this; + } + + public Builder libraryQualificationDaysSpent(int days) { + this.libraryQualificationDaysSpent = days; + return this; + } + + public Builder fullDepthSequencingDaysSpent(int days) { + this.fullDepthSequencingDaysSpent = days; + return this; + } } } 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 6031645..9530387 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 @@ -228,6 +228,12 @@ private List loadCases(FileReader fileReader, Map project .tests(parseTests(json, "assay_tests", samplesById)) .requisition(requisitionsById.get(requisitionId)) .startDate(parseDate(json, "start_date")) + .receiptDaysSpent(parseInteger(json, "receipt_days_spent", true)) + .analysisReviewDaysSpent(parseInteger(json, "analysis_review_days_spent", true)) + .releaseApprovalDaysSpent(parseInteger(json, "release_approval_days_spent", true)) + .releaseDaysSpent(parseInteger(json, "release_days_spent", true)) + .caseDaysSpent(parseInteger(json, "case_days_spent", true)) + .pauseDays(parseInteger(json, "pause_days", true)) .build(); }); } @@ -292,6 +298,8 @@ protected Map loadRequisitions(FileReader fileReader, .assayId(parseLong(json, "assay_id", false)) .stopped(parseBoolean(json, "stopped")) .stopReason(parseString(json, "stop_reason", false)) + .paused(parseBoolean(json, "paused")) + .pauseReason(parseString(json, "pause_reason", false)) .qcGroups(parseRequisitionQcGroups(json.get("qc_groups"), donorsById)) .analysisReviews(parseRequisitionQcs(json, "analysis_reviews")) .releaseApprovals(parseRequisitionQcs(json, "release_approvals")) @@ -707,6 +715,13 @@ private List parseTests(JsonNode json, String fieldName, Map