Search in sources :

Example 31 with Measure

use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class CDMMeasureEvaluationTest method testSetReportMeasureToMeasureId__noMetaVersion__noHistoryInMeasureOnReport.

@Test
public void testSetReportMeasureToMeasureId__noMetaVersion__noHistoryInMeasureOnReport() {
    MeasureReport report = new MeasureReport();
    String measureInput = "{\"resourceType\":\"Measure\",\"id\":\"id1\"}";
    Measure measure = fhirParser.parseResource(Measure.class, measureInput);
    CDMMeasureEvaluation.setReportMeasureToMeasureId(report, measure);
    assertEquals("Measure/id1", report.getMeasure());
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Test(org.junit.Test)

Example 32 with Measure

use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class CDMMeasureEvaluationTest method testSetReportMeasureToMeasureId__includesMetaVersion__hasHistoryInMeasureOnReport.

@Test
public void testSetReportMeasureToMeasureId__includesMetaVersion__hasHistoryInMeasureOnReport() {
    MeasureReport report = new MeasureReport();
    String measureInput = "{\"resourceType\":\"Measure\",\"id\":\"id1\",\"meta\":{\"versionId\":\"2\"}}";
    Measure measure = fhirParser.parseResource(Measure.class, measureInput);
    CDMMeasureEvaluation.setReportMeasureToMeasureId(report, measure);
    assertEquals("Measure/id1/_history/2", report.getMeasure());
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Test(org.junit.Test)

Example 33 with Measure

use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class DefaultMeasurementPeriodStrategyTest method parameter_not_null_date___value_used.

@Test
public void parameter_not_null_date___value_used() {
    Measure measure = new Measure();
    Map<String, Parameter> parameterOverrides = Collections.singletonMap(DefaultMeasurementPeriodStrategy.DEFAULT_MEASUREMENT_PERIOD_PARAMETER, new IntervalParameter(new DateParameter("2020-03-14"), true, new DateParameter("2020-09-14"), true));
    Pair<String, String> result = new DefaultMeasurementPeriodStrategy().getMeasurementPeriod(measure, parameterOverrides);
    assertEquals("Unexpected start", "2020-03-14", result.getLeft());
    assertEquals("Unexpected end", "2020-09-14", result.getRight());
}
Also used : DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) Measure(org.hl7.fhir.r4.model.Measure) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Test(org.junit.Test)

Example 34 with Measure

use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class DefaultMeasurementPeriodStrategyTest method parameter_null_map_null__value_is_calulated.

@Test
public void parameter_null_map_null__value_is_calulated() throws Exception {
    Calendar c = Calendar.getInstance();
    c.clear();
    c.set(2020, Calendar.AUGUST, 15);
    Measure measure = new Measure();
    Map<String, Parameter> parameterOverrides = null;
    Pair<String, String> result = new DefaultMeasurementPeriodStrategy().setNow(c.getTime()).getMeasurementPeriod(measure, parameterOverrides);
    DateFormat sdf = new SimpleDateFormat(DefaultMeasurementPeriodStrategy.TARGET_DATE_FORMAT);
    assertEquals("Unexpected end", result.getRight(), sdf.format(c.getTime()));
}
Also used : Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Measure(org.hl7.fhir.r4.model.Measure) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 35 with Measure

use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class DefaultMeasurementPeriodStrategyTest method runGetMeasurementPeriodTest.

private void runGetMeasurementPeriodTest(String parameterName, String start, String end) {
    Measure measure = new Measure();
    Map<String, Parameter> parameterOverrides = Collections.singletonMap(parameterName, new IntervalParameter(new DateParameter(start), true, new DateParameter(end), true));
    Pair<String, String> result = new DefaultMeasurementPeriodStrategy().setMeasurementPeriodParameter(parameterName).getMeasurementPeriod(measure, parameterOverrides);
    assertEquals("Unexpected start", result.getLeft(), start);
    assertEquals("Unexpected end", result.getRight(), end);
}
Also used : DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) Measure(org.hl7.fhir.r4.model.Measure) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)

Aggregations

Measure (org.hl7.fhir.r4.model.Measure)119 Test (org.junit.Test)97 Library (org.hl7.fhir.r4.model.Library)61 Patient (org.hl7.fhir.r4.model.Patient)45 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)44 HashMap (java.util.HashMap)24 ArrayList (java.util.ArrayList)23 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)22 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)22 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)22 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)21 ByteArrayOutputStream (java.io.ByteArrayOutputStream)21 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)20 CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)20 Test (org.junit.jupiter.api.Test)18 Extension (org.hl7.fhir.r4.model.Extension)15 StringType (org.hl7.fhir.r4.model.StringType)15 DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)14 CanonicalType (org.hl7.fhir.r4.model.CanonicalType)14 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)14