Skip to content

Commit

Permalink
[GLT-4035] added TAT and pause data (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke authored Nov 15, 2023
1 parent fe2991b commit 0a8b4e0
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 10 deletions.
74 changes: 72 additions & 2 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Case.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ public class Requisition {
private final List<RequisitionQcGroup> 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);
this.name = requireNonNull(builder.name);
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);
Expand Down Expand Up @@ -92,19 +96,27 @@ public List<RequisitionQcGroup> 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 {

Expand All @@ -117,6 +129,8 @@ public static class Builder {
private List<RequisitionQcGroup> qcGroups;
private String stopReason;
private boolean stopped;
private boolean paused;
private String pauseReason;

public Builder assayId(Long assayId) {
this.assayId = assayId;
Expand Down Expand Up @@ -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;
}
}
}
48 changes: 48 additions & 0 deletions cardea-data/src/main/java/ca/on/oicr/gsi/cardea/data/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<Sample> getExtractions() {
Expand Down Expand Up @@ -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 {

Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ private List<Case> loadCases(FileReader fileReader, Map<String, Project> 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();
});
}
Expand Down Expand Up @@ -292,6 +298,8 @@ protected Map<Long, Requisition> 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"))
Expand Down Expand Up @@ -707,6 +715,13 @@ private List<Test> parseTests(JsonNode json, String fieldName, Map<String, Sampl
parseIdsAndGet(testNode, "library_qualification_ids", JsonNode::asText, samplesById))
.fullDepthSequencings(
parseIdsAndGet(testNode, "full_depth_sequencing_ids", JsonNode::asText, samplesById))
.extractionDaysSpent(parseInteger(testNode, "extraction_days_spent", true))
.libraryPreparationDaysSpent(
parseInteger(testNode, "library_preparation_days_spent", true))
.libraryQualificationDaysSpent(
parseInteger(testNode, "library_qualification_days_spent", true))
.fullDepthSequencingDaysSpent(
parseInteger(testNode, "full_depth_sequencing_days_spent", true))
.build());
}
return tests;
Expand Down
26 changes: 22 additions & 4 deletions cardea-server/src/test/resources/testdata/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
"extraction_ids": ["SAM413593"],
"library_preparation_ids": ["LIB75802"],
"library_qualification_ids": ["5459_1_LDI73620", "5467_1_LDI73620"],
"full_depth_sequencing_ids": ["5476_1_LDI73620"]
"full_depth_sequencing_ids": ["5476_1_LDI73620"],
"extraction_days_spent": 0,
"library_preparation_days_spent": 0,
"library_qualification_days_spent": 0,
"full_depth_sequencing_days_spent": 0
},
{
"name": "Tumour WT",
Expand All @@ -41,7 +45,11 @@
"extraction_ids": ["SAM413648"],
"library_preparation_ids": ["LIB76197"],
"library_qualification_ids": ["5460_1_LDI73998"],
"full_depth_sequencing_ids": ["5481_1_LDI73998"]
"full_depth_sequencing_ids": ["5481_1_LDI73998"],
"extraction_days_spent": 0,
"library_preparation_days_spent": 0,
"library_qualification_days_spent": 0,
"full_depth_sequencing_days_spent": 0
},
{
"name": "Tumour WG",
Expand All @@ -55,11 +63,21 @@
"extraction_ids": ["SAM413735"],
"library_preparation_ids": ["LIB75803"],
"library_qualification_ids": ["5459_1_LDI73621", "5467_1_LDI73621"],
"full_depth_sequencing_ids": ["5476_1_LDI73621", "5540_1_LDI73621"]
"full_depth_sequencing_ids": ["5476_1_LDI73621", "5540_1_LDI73621"],
"extraction_days_spent": 0,
"library_preparation_days_spent": 0,
"library_qualification_days_spent": 0,
"full_depth_sequencing_days_spent": 0
}
],
"requisition_id": 512,
"stopped": false,
"start_date": "2021-07-19"
"start_date": "2021-07-19",
"receipt_days_spent": 0,
"analysis_review_days_spent": 0,
"release_approval_days_spent": 0,
"release_days_spent": 0,
"case_days_spent": 0,
"pause_days": 0
}
]
6 changes: 6 additions & 0 deletions cardea-server/src/test/resources/testdata/requisitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"name": "REQ-1",
"assay_id": 2,
"stopped": false,
"stop_reason": null,
"paused": false,
"pause_reason": null,
"qc_groups": [
{
"donor_id": "SAM413576",
Expand Down Expand Up @@ -52,6 +55,9 @@
"name": "REQ-X",
"assay_id": null,
"stopped": false,
"stop_reason": null,
"paused": false,
"pause_reason": null,
"qc_groups": [],
"analysis_reviews": [],
"release_approvals": [],
Expand Down
1 change: 1 addition & 0 deletions changes/add_pauses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Requisition pause status and reason
1 change: 1 addition & 0 deletions changes/add_tat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Days spent per QC step at case and test levels

0 comments on commit 0a8b4e0

Please sign in to comment.