From 516b5b164ec466a1512ea17538aec235a26446e8 Mon Sep 17 00:00:00 2001 From: grapigeau Date: Fri, 11 Oct 2024 13:15:38 -0400 Subject: [PATCH] add in detailed case summary input format to cardea plugin --- .../CaseSummaryDetailedFormatDefinition.java | 10 ++ .../cardea/CaseSummaryDetailedValue.java | 105 ++++++++++++++++++ .../gsi/shesmu/cardea/LimsSequencingInfo.java | 24 ++++ .../shesmu/cardea/SequencingTestValue.java | 46 ++++++++ plugin-cardea/src/main/java/module-info.java | 4 +- 5 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedFormatDefinition.java create mode 100644 plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedValue.java create mode 100644 plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/LimsSequencingInfo.java create mode 100644 plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/SequencingTestValue.java diff --git a/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedFormatDefinition.java b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedFormatDefinition.java new file mode 100644 index 000000000..168b97d54 --- /dev/null +++ b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedFormatDefinition.java @@ -0,0 +1,10 @@ +package ca.on.oicr.gsi.shesmu.cardea; + +import ca.on.oicr.gsi.shesmu.plugin.input.InputFormat; + +public class CaseSummaryDetailedFormatDefinition extends InputFormat { + + public CaseSummaryDetailedFormatDefinition() { + super("case_detailed_summary", CaseSummaryDetailedValue.class); + } +} diff --git a/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedValue.java b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedValue.java new file mode 100644 index 000000000..f48a150b8 --- /dev/null +++ b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/CaseSummaryDetailedValue.java @@ -0,0 +1,105 @@ +package ca.on.oicr.gsi.shesmu.cardea; + +import ca.on.oicr.gsi.shesmu.plugin.Tuple; +import ca.on.oicr.gsi.shesmu.plugin.input.ShesmuVariable; +import java.time.Instant; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class CaseSummaryDetailedValue { + private final String assayName; + private final String assayVersion; + private final String caseIdentifier; + private final String caseStatus; + private final Optional completedDate; + private final Set sequencing; + private final long requisitionId; + private final String requisitionName; + private final boolean stopped; + private final boolean paused; + + public CaseSummaryDetailedValue( + String assayName, + String assayVersion, + String caseIdentifier, + String caseStatus, + Optional completedDate, + Stream sequencingTestValueStream, + long requisitionId, + String requisitionName, + boolean stopped, + boolean paused) { + super(); + this.assayName = assayName; + this.assayVersion = assayVersion; + this.caseIdentifier = caseIdentifier; + this.caseStatus = caseStatus; + this.completedDate = completedDate; + this.sequencing = + sequencingTestValueStream + .map( + sequencingTest -> + new Tuple( + sequencingTest.test(), + sequencingTest.type(), + sequencingTest.isComplete(), + sequencingTest.limsIds())) + .collect(Collectors.toSet()); + this.requisitionId = requisitionId; + this.requisitionName = requisitionName; + this.stopped = stopped; + this.paused = paused; + } + + @ShesmuVariable + public String assay_name() { + return assayName; + } + + @ShesmuVariable + public String assay_version() { + return assayVersion; + } + + @ShesmuVariable + public String case_identifier() { + return caseIdentifier; + } + + @ShesmuVariable + public String case_status() { + return caseStatus; + } + + @ShesmuVariable + public Optional completed_date() { + return completedDate; + } + + @ShesmuVariable(type = "ao4test$stype$sis_complete$blims_ids$ao2lims_id$ssupplemental$b") + public Set sequencing() { + return sequencing; + } + + @ShesmuVariable + public long requisition_id() { + return requisitionId; + } + + @ShesmuVariable + public String requisition_name() { + return requisitionName; + } + + @ShesmuVariable + public boolean stopped() { + return stopped; + } + + @ShesmuVariable + public boolean paused() { + return paused; + } +} diff --git a/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/LimsSequencingInfo.java b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/LimsSequencingInfo.java new file mode 100644 index 000000000..e907d7fb0 --- /dev/null +++ b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/LimsSequencingInfo.java @@ -0,0 +1,24 @@ +package ca.on.oicr.gsi.shesmu.cardea; + +import ca.on.oicr.gsi.shesmu.plugin.input.ShesmuVariable; + +public class LimsSequencingInfo { + private final String limsId; + private final boolean supplemental; + + public LimsSequencingInfo(String limsId, boolean supplemental) { + super(); + this.limsId = limsId; + this.supplemental = supplemental; + } + + @ShesmuVariable + public String limsId() { + return limsId; + } + + @ShesmuVariable + public boolean supplemental() { + return supplemental; + } +} diff --git a/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/SequencingTestValue.java b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/SequencingTestValue.java new file mode 100644 index 000000000..641b44b07 --- /dev/null +++ b/plugin-cardea/src/main/java/ca/on/oicr/gsi/shesmu/cardea/SequencingTestValue.java @@ -0,0 +1,46 @@ +package ca.on.oicr.gsi.shesmu.cardea; + +import ca.on.oicr.gsi.shesmu.plugin.Tuple; +import ca.on.oicr.gsi.shesmu.plugin.input.ShesmuVariable; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class SequencingTestValue { + private final String test; + private final String type; + private final Set limsIds; + private final boolean isComplete; + + public SequencingTestValue( + String test, String type, Stream limsIds, boolean isComplete) { + super(); + this.test = test; + this.type = type; + this.limsIds = + limsIds + .map(info -> new Tuple(info.limsId(), info.supplemental())) + .collect(Collectors.toSet()); + this.isComplete = isComplete; + } + + @ShesmuVariable + public String test() { + return test; + } + + @ShesmuVariable + public String type() { + return type; + } + + @ShesmuVariable + public Set limsIds() { + return limsIds; + } + + @ShesmuVariable + public boolean isComplete() { + return isComplete; + } +} diff --git a/plugin-cardea/src/main/java/module-info.java b/plugin-cardea/src/main/java/module-info.java index adc916bb9..4d84b31be 100644 --- a/plugin-cardea/src/main/java/module-info.java +++ b/plugin-cardea/src/main/java/module-info.java @@ -1,3 +1,4 @@ +import ca.on.oicr.gsi.shesmu.cardea.CaseSummaryDetailedFormatDefinition; import ca.on.oicr.gsi.shesmu.cardea.CaseSummaryFormatDefinition; import ca.on.oicr.gsi.shesmu.plugin.input.InputFormat; @@ -7,5 +8,6 @@ requires ca.on.oicr.gsi.shesmu; provides InputFormat with - CaseSummaryFormatDefinition; + CaseSummaryFormatDefinition, + CaseSummaryDetailedFormatDefinition; }