Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pepper 1040 unable obtain tissue fix #2928

Merged
merged 7 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -11,7 +16,9 @@ public OncHistoryDetailUnableObtainTissueStrategy(GeneratorPayload generatorPayl
@Override
public Map<String, Object> generate() {
if (isUnableToObtain()) {
return Map.of();
Map<String, Object> resultMap = new HashMap<>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to update in elastic

resultMap.put(OncHistoryDetail.STATUS_REQUEST, OncHistoryDetail.UNABLE_OBTAIN_TISSUE);
return resultMap;
}
return super.generate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +27,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;
Expand Down Expand Up @@ -233,7 +235,7 @@ protected boolean isNameValuePairs() {
protected List<NameValue> setWorkflowRelatedFields(@NonNull Patch patch) {
List<NameValue> 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
Expand Down Expand Up @@ -279,17 +281,24 @@ protected List<NameValue> 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(),
ssettipalli marked this conversation as resolved.
Show resolved Hide resolved
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()), OncHistoryDetail.UNABLE_OBTAIN_TISSUE));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set the request : status/value when the "unable to obtain tissue" checkbox is checked/true

}
}
return nameValues;
Expand Down
Loading