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

add collection check on strats for HR and update test #160

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -8,6 +8,7 @@
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.collections4.CollectionUtils;
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50;
import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
Expand Down Expand Up @@ -197,10 +198,14 @@ private void sortParameters(
madieMeasure.getGroups().stream()
.forEach(
(g) ->
strats.addAll(
g.getStratifications().stream()
.map(s -> s.getCqlDefinition())
.collect(Collectors.toList())));
{
if (CollectionUtils.isNotEmpty(g.getStratifications())) {
strats.addAll(
g.getStratifications().stream()
.map(s -> s.getCqlDefinition())
.collect(Collectors.toList()));
}
});
}

Collections.sort(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
import gov.cms.madie.madiefhirservice.utils.ResourceFileUtil;
import gov.cms.madie.madiefhirservice.utils.ResourceUtils;
import gov.cms.madie.models.common.Version;
import gov.cms.madie.models.measure.Group;
import gov.cms.madie.models.measure.Measure;
import gov.cms.madie.models.measure.MeasureGroupTypes;
import gov.cms.madie.models.measure.MeasureMetaData;
import gov.cms.madie.models.measure.MeasureScoring;
import gov.cms.madie.models.measure.Population;
import gov.cms.madie.models.measure.PopulationType;
import org.hl7.fhir.MeasureGroup;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Attachment;
import org.hl7.fhir.r4.model.Bundle;
Expand All @@ -24,6 +30,7 @@
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.Date;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -53,6 +60,22 @@ class HumanReadableServiceTest implements ResourceFileUtil {

@BeforeEach
void setUp() {
Group measureGroup1 = Group.builder()
.id("GroupId1")
.groupDescription("some random group")
.measureGroupTypes(List.of(MeasureGroupTypes.OUTCOME))
.scoring(MeasureScoring.COHORT.toString())
.populations(List.of(
Population.builder()
.id("PopId1")
.name(PopulationType.INITIAL_POPULATION)
.definition("Initial Population")
.description(null)
.build()
))
.build();
measureGroup1.setStratifications(null);

madieMeasure =
Measure.builder()
.id("madie-test-id")
Expand All @@ -67,6 +90,7 @@ void setUp() {
.copyright("test_copyright")
.disclaimer("test_disclaimer")
.build())
.groups(List.of(measureGroup1))
.build();

measure =
Expand Down
Loading