use of org.hl7.fhir.r5.model.Measure 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.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class FHIRRestUtilsTest method testGetParametersForMeasureIdentifier.
/**
* Test the successful building of a response.
*/
@Test
public void testGetParametersForMeasureIdentifier() {
String idValue = "idValue";
String idSystem = "idSystem";
Identifier identifier = new Identifier().setValue(idValue).setSystem(idSystem);
String version = "1.0.0";
FhirResourceResolver<Measure> measureResolver = Mockito.mock(FhirResourceResolver.class);
Mockito.when(measureResolver.resolveByIdentifier(idValue, idSystem, version)).thenReturn(createMeasure(testMeasureDef));
List<MeasureParameterInfo> parameterInfoList = FHIRRestUtils.getParametersForMeasureIdentifier(measureResolver, identifier, version);
MeasureParameterInfo expectedParamInfo = new MeasureParameterInfo();
expectedParamInfo.setname("aName");
expectedParamInfo.setUse("In");
expectedParamInfo.setMax("1");
expectedParamInfo.setMin(0);
expectedParamInfo.setType("String");
expectedParamInfo.setDocumentation(null);
expectedParamInfo.defaultValue("42");
assertThat(parameterInfoList, containsInAnyOrder(expectedParamInfo));
}
use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class FHIRRestUtilsTest method testGetParametersWithDefaultsForMeasureId.
@Test
public void testGetParametersWithDefaultsForMeasureId() {
String measureId = "measureId";
FhirResourceResolver<Measure> measureResolver = Mockito.mock(FhirResourceResolver.class);
Mockito.when(measureResolver.resolveById(measureId)).thenReturn(createMeasure(testMeasureDef));
List<MeasureParameterInfo> parameterInfoList = FHIRRestUtils.getParametersForMeasureId(measureResolver, measureId);
MeasureParameterInfo expectedParamInfo = new MeasureParameterInfo();
expectedParamInfo.setname("aName");
expectedParamInfo.setUse("In");
expectedParamInfo.setMax("1");
expectedParamInfo.setMin(0);
expectedParamInfo.setType("String");
expectedParamInfo.setDocumentation(null);
expectedParamInfo.defaultValue("42");
assertThat(parameterInfoList, containsInAnyOrder(expectedParamInfo));
}
use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureReportBuilderTest method testBuilder.
@Test
public void testBuilder() {
String measureRef = "MEASURE REF";
String patientRef = "PATIENT REF";
MeasureReportStatus status = MeasureReportStatus.ERROR;
MeasureReportType type = MeasureReportType.INDIVIDUAL;
Date startDate = new Date();
Date endDate = new Date();
Interval interval = new Interval(DateTime.fromJavaDate(startDate), true, DateTime.fromJavaDate(endDate), true);
MeasureReport report = new MeasureReportBuilder().buildMeasureReference(measureRef).buildPatientReference(patientRef).buildPeriod(interval).buildStatus(status.toCode()).buildType(type).build();
assertEquals(measureRef, report.getMeasure());
assertEquals(patientRef, report.getSubject().getReference());
assertEquals(startDate, report.getPeriod().getStart());
assertEquals(endDate, report.getPeriod().getEnd());
assertEquals(status, report.getStatus());
assertEquals(type, report.getType());
TimeZone timeZoneUTC = TimeZone.getTimeZone("UTC");
assertEquals(timeZoneUTC, report.getPeriod().getStartElement().getTimeZone());
assertEquals(timeZoneUTC, report.getPeriod().getEndElement().getTimeZone());
}
use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class R4FhirBundleExtractorTest method extractAll.
@Test
public void extractAll() {
String firstVersion = "1.0.0";
String secondVersion = "2.0.0";
String thirdVersion = "3.0.0";
String fourthVersion = "4.0.0";
Library library1 = new Library().setVersion(firstVersion);
Library library2 = new Library().setVersion(secondVersion);
Measure measure = new Measure().setVersion(thirdVersion);
Library library3 = new Library().setVersion(fourthVersion);
Bundle bundle = new Bundle();
addToBundle(library1, bundle);
addToBundle(library2, bundle);
addToBundle(measure, bundle);
addToBundle(library3, bundle);
R4FhirBundleExtractor<Library> extractor = getExtractor();
List<Library> libraries = extractor.extractAll(bundle);
List<String> actual = libraries.stream().map(Library::getVersion).collect(Collectors.toList());
List<String> expected = Arrays.asList(firstVersion, secondVersion, fourthVersion);
Assert.assertEquals(expected, actual);
}
Aggregations