Skip to content

Commit

Permalink
[GLT-4022] use case start date provided by QC-Gate-ETL
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke committed Oct 23, 2023
1 parent 7c8810e commit 32ea597
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
12 changes: 2 additions & 10 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 @@ -49,16 +49,8 @@ private Case(Builder builder) {
this.timepoint = builder.timepoint;
this.receipts = unmodifiableList(builder.receipts);
this.tests = unmodifiableList(builder.tests);
this.requisition = builder.requisition;
if (builder.startDate != null) {
this.startDate = builder.startDate;
} else {
this.startDate = builder.receipts.stream()
.filter(sample -> sample.getRequisitionId() != null
&& sample.getRequisitionId().longValue() == builder.requisition.getId())
.map(Sample::getCreatedDate)
.min(LocalDate::compareTo).orElse(null);
}
this.requisition = requireNonNull(builder.requisition);
this.startDate = requireNonNull(builder.startDate);
this.latestActivityDate = Stream
.of(receipts.stream().map(Sample::getLatestActivityDate),
tests.stream().map(Test::getLatestActivityDate),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ private List<Case> loadCases(FileReader fileReader, Map<String, Project> project
.receipts(parseIdsAndGet(json, "receipt_ids", JsonNode::asText, samplesById))
.tests(parseTests(json, "assay_tests", samplesById))
.requisition(requisitionsById.get(requisitionId))
.startDate(parseDate(json, "start_date"))
.build();
});
}
Expand Down
3 changes: 2 additions & 1 deletion cardea-server/src/test/resources/testdata/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
}
],
"requisition_id": 512,
"stopped": false
"stopped": false,
"start_date": "2021-07-19"
}
]
1 change: 1 addition & 0 deletions changes/change_startDate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Case start date provided by QC-Gate-ETL (based on latest sample receipt) will be used

0 comments on commit 32ea597

Please sign in to comment.