Skip to content

Commit

Permalink
MAT-7030: overwrite population sets for qrda generation
Browse files Browse the repository at this point in the history
  • Loading branch information
chubert-sb committed Jun 6, 2024
1 parent ebe95fd commit 074d973
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/main/java/gov/cms/madie/services/CqmMeasureMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import gov.cms.madie.models.cqm.datacriteria.*;
import gov.cms.madie.models.measure.*;
import gov.cms.madie.util.ElmDependencyUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
Expand Down Expand Up @@ -268,7 +269,10 @@ default List<PopulationSet> getPopulationSets(QdmMeasure measure) {
return null;
}

String measureScoring = measure.getScoring().replaceAll(" +", "");
String measureScoring = null;
if (!StringUtils.isEmpty(measure.getScoring())) {
measureScoring = measure.getScoring().replaceAll(" +", "");
}
List<PopulationSet> populationSets = new ArrayList<>();
for (int i = 0; i < measure.getGroups().size(); i++) {
String groupId = measure.getGroups().get(i).getId();
Expand All @@ -291,7 +295,8 @@ default List<PopulationSet> getPopulationSets(QdmMeasure measure) {
generateCqmSupplementalDataElements(
measure.getSupplementalData(), measure.getCqlLibraryName()))
.build();
if (measureScoring.equals("ContinuousVariable") || measureScoring.equals("Ratio")) {
if (!StringUtils.isEmpty(measureScoring)
&& (measureScoring.equals("ContinuousVariable") || measureScoring.equals("Ratio"))) {
populationSet.setObservations(generateCqmObservations(measure));
}
populationSets.add(populationSet);
Expand Down Expand Up @@ -351,6 +356,9 @@ default PopulationMap determinePopulationType(Map<String, Object> acc, String me

default PopulationMap generateCqmPopulations(
List<Population> populations, String cqlLibraryName, String measureScoring) {
if (StringUtils.isEmpty(measureScoring)) {
return null;
}
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> acc = new HashMap<>();
for (Population population : populations) {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/gov/cms/madie/services/QrdaService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import gov.cms.madie.dto.qrda.QrdaExportResponseDto;
import gov.cms.madie.dto.qrda.QrdaRequestDTO;
import gov.cms.madie.dto.SourceDataCriteria;
import gov.cms.madie.models.cqm.CqmMeasure;
import gov.cms.madie.models.dto.TranslatedLibrary;
import gov.cms.madie.models.measure.QdmMeasure;
import lombok.AllArgsConstructor;
Expand All @@ -16,6 +17,7 @@

import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -46,10 +48,11 @@ public QrdaExportResponseDto generateQrda(QrdaRequestDTO request, String accessT

QrdaDTO dto = null;
try {
CqmMeasure cqmMeasure = mapper.measureToCqmMeasure(measure, elms, null);
cqmMeasure.setPopulation_sets(new ArrayList<>());
dto =
QrdaDTO.builder()
.measure(
objectMapper.writeValueAsString(mapper.measureToCqmMeasure(measure, elms, null)))
.measure(objectMapper.writeValueAsString(cqmMeasure))
.testCases(measure.getTestCases())
.sourceDataCriteria(dataCriteria)
.options(buildOptions(measure))
Expand Down

0 comments on commit 074d973

Please sign in to comment.