Skip to content

Commit

Permalink
[GLT-4295] mark skip true if consent is revoked (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
djcooke authored Nov 19, 2024
1 parent 1bed049 commit a911a93
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,27 @@ public Boolean getSkip() {
return (sequencerRun.getStatus() != null
&& "Failed".equals(sequencerRun.getStatus().getState()))
|| Boolean.TRUE.equals(lane.isAnalysisSkipped())
|| (runSample.getStatus() != null && "Failed".equals(runSample.getStatus().getState()));
|| (runSample.getStatus() != null && "Failed".equals(runSample.getStatus().getState()))
|| isConsentRevoked();
}
}

private boolean isConsentRevoked() {
if (isConsentRevoked(sample)) {
return true;
}
return parentSamples.stream().anyMatch(parent -> isConsentRevoked(parent));
}

private static boolean isConsentRevoked(Sample sample) {
if (sample.getAttributes() == null) {
return false;
}
return sample.getAttributes().stream()
.filter(attr -> "Consent".equals(attr.getName()))
.anyMatch(attr -> "REVOKED".equals(attr.getValue()));
}

@Override
public String getSampleProvenanceId() {
return sequencerRun.getId() + "_" + lane.getPosition() + "_" + sample.getId();
Expand Down Expand Up @@ -454,7 +471,8 @@ private HashMultimap<String, String> processSampleAttributes(Sample sample) {
attrs.put("Preparation Kit", sample.getPreparationKit().getName());
}

// Geospiza sample type is gDNA - recategorize the "Tissue Type" to the correct attribute name
// Geospiza sample type is gDNA - recategorize the "Tissue Type" to the correct
// attribute name
// of "Tissue Preparation"
if (Arrays.asList("gDNA", "gDNA_wga").contains(sample.getSampleType())
&& (attrs.containsKey(LimsSampleAttribute.TISSUE_TYPE.toString())
Expand All @@ -469,7 +487,8 @@ private HashMultimap<String, String> processSampleAttributes(Sample sample) {

@Override
public List<String> getBatchIds() {
// Should return an empty list if there are none. Null is used to omit the attribue from old
// Should return an empty list if there are none. Null is used to omit the
// attribue from old
// provenance versons (see SampleProvenanceDto and SimpleSampleProvenance)
List<String> batchIds = new ArrayList<>();
addBatchId(sample, batchIds);
Expand Down

0 comments on commit a911a93

Please sign in to comment.