From 0adc343134a69944f451fca448d82a4de442b1d7 Mon Sep 17 00:00:00 2001 From: "Sampath K. Settipalli" Date: Tue, 20 Aug 2024 11:57:46 -0500 Subject: [PATCH 1/6] PEPPER-1040 . update onc history detail.request when unableObtainTissue is checked/set to true --- .../dsm/model/patch/BasePatch.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java index 7f4ea8b744..83723c7035 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java @@ -26,6 +26,7 @@ import org.broadinstitute.dsm.model.elastic.export.ExportFacade; import org.broadinstitute.dsm.model.elastic.export.ExportFacadePayload; import org.broadinstitute.dsm.model.elastic.export.generate.GeneratorPayload; +import org.broadinstitute.dsm.model.elastic.export.generate.OncHistoryDetailSourceGenerator; import org.broadinstitute.dsm.model.participant.data.FamilyMemberConstants; import org.broadinstitute.dsm.service.EventService; import org.broadinstitute.dsm.statics.DBConstants; @@ -279,17 +280,24 @@ protected List setWorkflowRelatedFields(@NonNull Patch patch) { patch.getNameValues(), patch.getDdpParticipantId()), "sent")); } } - } else if (patch.getNameValue().getName().equals("oD.unableObtainTissue") && !(boolean) patch.getNameValue().getValue()) { - boolean hasReceivedDate = new OncHistoryDetailDaoImpl().hasReceivedDate(getOncHistoryDetailId(patch)); + } else if (patch.getNameValue().getName().equals("oD.unableObtainTissue")) { + if (!(boolean) patch.getNameValue().getValue()) { + boolean hasReceivedDate = new OncHistoryDetailDaoImpl().hasReceivedDate(getOncHistoryDetailId(patch)); - if (hasReceivedDate) { - nameValues.add(setAdditionalValue("oD.request", - new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), - patch.getNameValues(), patch.getDdpParticipantId()), "received")); + if (hasReceivedDate) { + nameValues.add(setAdditionalValue("oD.request", + new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), + patch.getNameValues(), patch.getDdpParticipantId()), "received")); + } else { + nameValues.add(setAdditionalValue("oD.request", + new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), + patch.getNameValues(), patch.getDdpParticipantId()), "sent")); + } } else { + //"unable to obtain tissue" : checked/true .. update request status nameValues.add(setAdditionalValue("oD.request", new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), - patch.getNameValues(), patch.getDdpParticipantId()), "sent")); + patch.getNameValues(), patch.getDdpParticipantId()), OncHistoryDetailSourceGenerator.UNABLE_OBTAIN_TISSUE)); } } return nameValues; From daef5b0ddf129d537f21896be766d8379bd4e491 Mon Sep 17 00:00:00 2001 From: "Sampath K. Settipalli" Date: Tue, 20 Aug 2024 12:05:45 -0500 Subject: [PATCH 2/6] PEPPER-1040 . update onc history detail.request when unableObtainTissue is checked/set to true --- .../main/java/org/broadinstitute/dsm/model/patch/BasePatch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java index 83723c7035..d45f0cb880 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java @@ -234,7 +234,7 @@ protected boolean isNameValuePairs() { protected List setWorkflowRelatedFields(@NonNull Patch patch) { List nameValues = new ArrayList<>(); if (patch.getNameValue().getValue() == null) { - // if the date that was sent in is null, we don't want to set the workflow fields + // if the value that was sent in is null, we don't want to set the workflow fields return nameValues; } //mr request workflow From c4b0ef9b78731b79c901094fef01c1cbbef52aa8 Mon Sep 17 00:00:00 2001 From: "Sampath K. Settipalli" Date: Tue, 20 Aug 2024 12:38:14 -0500 Subject: [PATCH 3/6] PEPPER-1040 . update onc history detail.request when unableObtainTissue is checked/set to true --- .../java/org/broadinstitute/dsm/db/OncHistoryDetail.java | 1 + .../OncHistoryDetailUnableObtainTissueStrategy.java | 9 ++++++++- .../org/broadinstitute/dsm/model/patch/BasePatch.java | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/db/OncHistoryDetail.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/db/OncHistoryDetail.java index f7b407c929..86d4d4eb99 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/db/OncHistoryDetail.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/db/OncHistoryDetail.java @@ -91,6 +91,7 @@ public class OncHistoryDetail implements HasDdpInstanceId { public static final String STATUS_RETURNED = "returned"; public static final String STATUS_REQUEST = "request"; public static final String STATUS_UNABLE_TO_OBTAIN = "unableToObtain"; + public static final String UNABLE_OBTAIN_TISSUE = "unableObtainTissue"; public static final String PROBLEM_INSUFFICIENT_PATH = "insufficientPath"; public static final String PROBLEM_INSUFFICIENT_SHL = "insufficientSHL"; public static final String PROBLEM_NO_E_SIGN = "noESign"; diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/elastic/export/generate/OncHistoryDetailUnableObtainTissueStrategy.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/elastic/export/generate/OncHistoryDetailUnableObtainTissueStrategy.java index 7b9799e3d9..98349d6bbb 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/elastic/export/generate/OncHistoryDetailUnableObtainTissueStrategy.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/elastic/export/generate/OncHistoryDetailUnableObtainTissueStrategy.java @@ -1,7 +1,12 @@ package org.broadinstitute.dsm.model.elastic.export.generate; +import lombok.extern.slf4j.Slf4j; +import org.broadinstitute.dsm.db.OncHistoryDetail; + +import java.util.HashMap; import java.util.Map; +@Slf4j public class OncHistoryDetailUnableObtainTissueStrategy extends UnableObtainTissueStrategy { public OncHistoryDetailUnableObtainTissueStrategy(GeneratorPayload generatorPayload) { @@ -11,7 +16,9 @@ public OncHistoryDetailUnableObtainTissueStrategy(GeneratorPayload generatorPayl @Override public Map generate() { if (isUnableToObtain()) { - return Map.of(); + Map resultMap = new HashMap<>(); + resultMap.put(OncHistoryDetail.STATUS_REQUEST, OncHistoryDetail.UNABLE_OBTAIN_TISSUE); + return resultMap; } return super.generate(); } diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java index d45f0cb880..3da5051971 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java @@ -13,6 +13,7 @@ import lombok.NonNull; import org.apache.commons.lang3.StringUtils; import org.broadinstitute.dsm.db.DDPInstance; +import org.broadinstitute.dsm.db.OncHistoryDetail; import org.broadinstitute.dsm.db.dao.ddp.onchistory.OncHistoryDetailDaoImpl; import org.broadinstitute.dsm.db.dao.ddp.participant.ParticipantDataDao; import org.broadinstitute.dsm.db.dao.queue.EventDao; @@ -297,9 +298,10 @@ protected List setWorkflowRelatedFields(@NonNull Patch patch) { //"unable to obtain tissue" : checked/true .. update request status nameValues.add(setAdditionalValue("oD.request", new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), - patch.getNameValues(), patch.getDdpParticipantId()), OncHistoryDetailSourceGenerator.UNABLE_OBTAIN_TISSUE)); + patch.getNameValues(), patch.getDdpParticipantId()), OncHistoryDetail.UNABLE_OBTAIN_TISSUE)); } } + logger.info("----namevalues: " + nameValues); return nameValues; } From 69d93a51567b9272f7ea3abf23ef9ffb96bacdfc Mon Sep 17 00:00:00 2001 From: "Sampath K. Settipalli" Date: Wed, 21 Aug 2024 14:09:15 -0500 Subject: [PATCH 4/6] PEPPER-1040 . cleanup --- .../main/java/org/broadinstitute/dsm/model/patch/BasePatch.java | 1 - 1 file changed, 1 deletion(-) diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java index 3da5051971..8eb18d27b2 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java @@ -301,7 +301,6 @@ protected List setWorkflowRelatedFields(@NonNull Patch patch) { patch.getNameValues(), patch.getDdpParticipantId()), OncHistoryDetail.UNABLE_OBTAIN_TISSUE)); } } - logger.info("----namevalues: " + nameValues); return nameValues; } From 529408478a91eebb2ce8eb4f5e60163fead25d88 Mon Sep 17 00:00:00 2001 From: "Sampath K. Settipalli" Date: Wed, 21 Aug 2024 20:40:02 -0500 Subject: [PATCH 5/6] PEPPER-1040 . cleanup --- .../dsm/model/patch/BasePatch.java | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java index 8eb18d27b2..14c6e6b90f 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java @@ -27,7 +27,6 @@ import org.broadinstitute.dsm.model.elastic.export.ExportFacade; import org.broadinstitute.dsm.model.elastic.export.ExportFacadePayload; import org.broadinstitute.dsm.model.elastic.export.generate.GeneratorPayload; -import org.broadinstitute.dsm.model.elastic.export.generate.OncHistoryDetailSourceGenerator; import org.broadinstitute.dsm.model.participant.data.FamilyMemberConstants; import org.broadinstitute.dsm.service.EventService; import org.broadinstitute.dsm.statics.DBConstants; @@ -282,24 +281,14 @@ protected List setWorkflowRelatedFields(@NonNull Patch patch) { } } } else if (patch.getNameValue().getName().equals("oD.unableObtainTissue")) { - if (!(boolean) patch.getNameValue().getValue()) { - boolean hasReceivedDate = new OncHistoryDetailDaoImpl().hasReceivedDate(getOncHistoryDetailId(patch)); - - if (hasReceivedDate) { - nameValues.add(setAdditionalValue("oD.request", - new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), - patch.getNameValues(), patch.getDdpParticipantId()), "received")); - } else { - nameValues.add(setAdditionalValue("oD.request", - new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), - patch.getNameValues(), patch.getDdpParticipantId()), "sent")); - } - } else { - //"unable to obtain tissue" : checked/true .. update request status - nameValues.add(setAdditionalValue("oD.request", - new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), - patch.getNameValues(), patch.getDdpParticipantId()), OncHistoryDetail.UNABLE_OBTAIN_TISSUE)); - } + String status = (boolean) patch.getNameValue().getValue() + ? OncHistoryDetail.UNABLE_OBTAIN_TISSUE + : new OncHistoryDetailDaoImpl().hasReceivedDate(getOncHistoryDetailId(patch)) + ? "received" + : "sent"; + nameValues.add(setAdditionalValue("oD.request", + new Patch(patch.getId(), PARTICIPANT_ID, patch.getParentId(), patch.getUser(), patch.getNameValue(), + patch.getNameValues(), patch.getDdpParticipantId()), status)); } return nameValues; } From 663e1eda5679edb72fa11d9f28d5516fe99576bb Mon Sep 17 00:00:00 2001 From: "Sampath K. Settipalli" Date: Wed, 21 Aug 2024 22:14:38 -0500 Subject: [PATCH 6/6] PEPPER-1040 . cleanup --- .../main/java/org/broadinstitute/dsm/model/patch/BasePatch.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java index 14c6e6b90f..ebf500216c 100644 --- a/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java +++ b/pepper-apis/dsm-core/src/main/java/org/broadinstitute/dsm/model/patch/BasePatch.java @@ -281,6 +281,8 @@ protected List setWorkflowRelatedFields(@NonNull Patch patch) { } } } else if (patch.getNameValue().getName().equals("oD.unableObtainTissue")) { + // if unable to obtain tissue, set request to "unable to obtain" + // if not unable to obtain, check if received date exists, if so set request to "received", otherwise set to "sent" String status = (boolean) patch.getNameValue().getValue() ? OncHistoryDetail.UNABLE_OBTAIN_TISSUE : new OncHistoryDetailDaoImpl().hasReceivedDate(getOncHistoryDetailId(patch))