use of org.hl7.fhir.r4.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluator method evaluatePatientMeasures.
/**
* Evaluates measures for a given patient
*
* @param patientId Patient id to evaluate measures for
* @param measureContexts Measure info with parameters
* @param evidenceOptions Evidence options impacting the returned MeasureReports
* @return List of Measure Reports
*/
public List<MeasureReport> evaluatePatientMeasures(String patientId, List<MeasureContext> measureContexts, MeasureEvidenceOptions evidenceOptions) {
List<MeasureReport> measureReports = new ArrayList<>();
MeasureReport measureReport;
for (MeasureContext measureContext : measureContexts) {
measureReport = evaluatePatientMeasure(patientId, measureContext, evidenceOptions);
measureReports.add(measureReport);
}
return measureReports;
}
use of org.hl7.fhir.r4.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class SparkCqlEvaluator method getFilteredRequests.
/**
* @param requests Request object to filter.
* @param libraries Map of library id to version used for filtering
* down request based on library id. If this argument
* is null or empty, then no library id filtering
* is performed.
* @param expressions Used to optionally override which expressions will
* run for each individual CqlEvaluationRequest. If this
* argument is null or empty, no expressions are overwritten.
*
* @return CqlEvaluationRequests with the original requests optionally filtered
* based on the library ids the.
* Requests will optionally have their expressions overridden
* by args.expressions. if any are provided.
* Individual requests will also will also have any global
* parameters set on each individual CqlEvaluationRequest.
*/
protected CqlEvaluationRequests getFilteredRequests(CqlEvaluationRequests requests, Map<String, String> libraries, Collection<String> expressions) {
if (requests != null) {
List<CqlEvaluationRequest> evaluations = requests.getEvaluations();
if (libraries != null && !libraries.isEmpty()) {
evaluations = evaluations.stream().filter(r -> libraries.keySet().contains(r.getDescriptor().getLibraryId())).collect(Collectors.toList());
}
if (expressions != null && !expressions.isEmpty()) {
evaluations.forEach(x -> x.setExpressions(x.getExpressions().stream().filter(e -> expressions.contains(e.getName())).collect(Collectors.toSet())));
}
if (requests.getGlobalParameters() != null) {
for (CqlEvaluationRequest evaluation : evaluations) {
for (Map.Entry<String, Parameter> globalParameter : requests.getGlobalParameters().entrySet()) {
Map<String, Parameter> parameters = evaluation.getParameters();
if (parameters == null) {
evaluation.setParameters(new HashMap<>());
parameters = evaluation.getParameters();
}
parameters.putIfAbsent(globalParameter.getKey(), globalParameter.getValue());
}
}
}
requests.setEvaluations(evaluations);
jobSpecification.set(requests);
}
return requests;
}
use of org.hl7.fhir.r4.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProviderTest method inOperationReturnsFalseWhenFhirReturnsFalse.
@Test
public void inOperationReturnsFalseWhenFhirReturnsFalse() throws Exception {
ValueSetInfo info = new ValueSetInfo();
info.setId("urn:oid:Test");
Code code = new Code();
code.setSystem(TEST_SYSTEM);
code.setCode(TEST_CODE);
code.setDisplay(TEST_DISPLAY);
Parameters parameters = new Parameters();
parameters.getParameterFirstRep().setName("result").setValue(new BooleanType(false));
mockFhirResourceRetrieval("/ValueSet/Test/$validate-code?code=" + urlencode(code.getCode()) + "&system=" + urlencode(code.getSystem()) + "&_format=json", parameters);
boolean result = provider.in(code, info);
assertFalse(result);
}
use of org.hl7.fhir.r4.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProviderTest method expandOperationReturnsCorrectCodesMoreThanZero.
@Test
public void expandOperationReturnsCorrectCodesMoreThanZero() {
ValueSetInfo info = new ValueSetInfo();
info.setId("urn:oid:Test");
ValueSet valueSet = new ValueSet();
valueSet.setId("Test");
valueSet.getExpansion().getContainsFirstRep().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
Parameters parameters = new Parameters();
parameters.getParameterFirstRep().setName("return").setResource(valueSet);
mockFhirResourceRetrieval("/ValueSet/Test/$expand?_format=json", parameters);
Iterable<Code> codes = provider.expand(info);
List<Code> list = StreamSupport.stream(codes.spliterator(), false).collect(Collectors.toList());
assertEquals(list.size(), 1);
assertEquals(list.get(0).getSystem(), TEST_SYSTEM);
assertEquals(list.get(0).getCode(), TEST_CODE);
}
use of org.hl7.fhir.r4.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProviderTest method inOperationReturnsTrueWhenFhirReturnsTrue.
@Test
public void inOperationReturnsTrueWhenFhirReturnsTrue() throws Exception {
ValueSetInfo info = new ValueSetInfo();
info.setId("urn:oid:Test");
Code code = new Code();
code.setSystem(TEST_SYSTEM);
code.setCode(TEST_CODE);
code.setDisplay(TEST_DISPLAY);
Parameters parameters = new Parameters();
parameters.getParameterFirstRep().setName("result").setValue(new BooleanType(true));
mockFhirResourceRetrieval("/ValueSet/Test/$validate-code?code=" + urlencode(code.getCode()) + "&system=" + urlencode(code.getSystem()) + "&_format=json", parameters);
boolean result = provider.in(code, info);
assertTrue(result);
}
Aggregations