Skip to content

Commit

Permalink
Pepper 1040 unable obtain tissue fix (#2928)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssettipalli authored Aug 22, 2024
1 parent e6b7523 commit e92bed3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
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<>();
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 Down Expand Up @@ -233,7 +234,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,18 +280,17 @@ 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));

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 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))
? "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;
}
Expand Down

0 comments on commit e92bed3

Please sign in to comment.