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

Fix Measure Report Evaluated Resources. #262

Merged
merged 1 commit into from
Oct 6, 2020
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
@@ -1,13 +1,7 @@
package org.opencds.cqf.dstu3.evaluation;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;

import org.cqframework.cql.elm.execution.ExpressionDef;
Expand Down Expand Up @@ -278,6 +272,7 @@ private MeasureReport evaluate(Measure measure, Context context, List<Patient> p

HashMap<String, Resource> resources = new HashMap<>();
HashMap<String, HashSet<String>> codeToResourceMap = new HashMap<>();
Set<String> evaluatedResourcesList = new HashSet<>();

MeasureScoring measureScoring = MeasureScoring.fromCode(measure.getScoring().getCodingFirstRep().getCode());
if (measureScoring == null) {
Expand Down Expand Up @@ -545,16 +540,17 @@ private MeasureReport evaluate(Measure measure, Context context, List<Patient> p
}

if (!list.isEmpty()) {
list.setId(UUID.randomUUID().toString());
list.setId("List/" + UUID.randomUUID().toString());
list.setTitle(key);
resources.put(list.getId(), list);
list.getEntry().forEach(listResource -> evaluatedResourcesList.add(listResource.getItem().getReference()));
}
}

if (!resources.isEmpty()) {
List<Reference> evaluatedResourceIds = new ArrayList<>();
resources.forEach((key, resource) -> {
evaluatedResourceIds.add(new Reference(resource.getId()));
evaluatedResourcesList.forEach((resource) -> {
evaluatedResourceIds.add(new Reference(resource));
});

// TODO: DSTU3 Doesn't support this..
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package org.opencds.cqf.r4.evaluation;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;

import org.cqframework.cql.elm.execution.ExpressionDef;
Expand Down Expand Up @@ -279,6 +273,7 @@ private MeasureReport evaluate(Measure measure, Context context, List<Patient> p

HashMap<String, Resource> resources = new HashMap<>();
HashMap<String, HashSet<String>> codeToResourceMap = new HashMap<>();
Set<String> evaluatedResourcesList = new HashSet<>();

MeasureScoring measureScoring = MeasureScoring.fromCode(measure.getScoring().getCodingFirstRep().getCode());
if (measureScoring == null) {
Expand Down Expand Up @@ -544,26 +539,21 @@ private MeasureReport evaluate(Measure measure, Context context, List<Patient> p
}

if (!list.isEmpty()) {
list.setId(UUID.randomUUID().toString());
list.setId("List/" + UUID.randomUUID().toString());
list.setTitle(key);
resources.put(list.getId(), list);
list.getEntry().forEach(listResource -> evaluatedResourcesList.add(listResource.getItem().getReference()));
}
}

if (!resources.isEmpty()) {
if (!evaluatedResourcesList.isEmpty()) {
List<Reference> evaluatedResourceIds = new ArrayList<>();
resources.forEach((key, resource) -> {
evaluatedResourceIds.add(new Reference(resource.getId()));
evaluatedResourcesList.forEach((resource) -> {
evaluatedResourceIds.add(new Reference(resource));
});
report.setEvaluatedResource(evaluatedResourceIds);
/*
FhirMeasureBundler bundler = new FhirMeasureBundler();
org.hl7.fhir.r4.model.Bundle evaluatedResources = bundler.bundle(resources.values());
evaluatedResources.setId(UUID.randomUUID().toString());
report.setEvaluatedResource(Collections.singletonList(new Reference(evaluatedResources.getId())));
report.addContained(evaluatedResources);
*/
}

if (sdeAccumulators.size() > 0) {
report = processAccumulators(report, sdeAccumulators, sde, isSingle, patients);
}
Expand Down