Skip to content

Commit

Permalink
Merged in fixNPECharacterization (pull request #40)
Browse files Browse the repository at this point in the history
Fixed NullPointerException during saving of a cohort characterization with missing design
  • Loading branch information
Oleg Kuzik authored and alex-odysseus committed Sep 4, 2024
2 parents accf315 + 7f7f196 commit b669f55
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.ohdsi.analysis.cohortcharacterization.design.FeatureAnalysisAggregate;
import org.ohdsi.webapi.feanalysis.domain.*;
import org.ohdsi.webapi.feanalysis.dto.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -52,6 +54,9 @@ private Object convertDesignToJson(final FeAnalysisEntity source) {
switch (type) {
case CRITERIA_SET:
FeAnalysisWithCriteriaEntity<?> sourceWithCriteria = (FeAnalysisWithCriteriaEntity<?>) source;
if (CollectionUtils.isEmpty(sourceWithCriteria.getDesign())) {
return Collections.emptyList();
}
return sourceWithCriteria.getDesign()
.stream()
.map(this::convertCriteria)
Expand Down

0 comments on commit b669f55

Please sign in to comment.