Search in sources :

Example 36 with StringType

use of org.hl7.fhir.r4b.model.StringType in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testPeriodEndInvalid.

@SuppressWarnings("java:S5778")
@Test
public void testPeriodEndInvalid() throws Exception {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
    params.addParameter().setName("periodEnd").setValue(new StringType(dateInvalid));
    params.addParameter().setName("subject").setValue(new StringType(subjectPatientValid));
    params.addParameter().setName("status").setValue(new StringType(statusValid));
    params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 37 with StringType

use of org.hl7.fhir.r4b.model.StringType in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testSubjectAndOrganization.

@SuppressWarnings("java:S5778")
@Test
public void testSubjectAndOrganization() throws Exception {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
    params.addParameter().setName("periodEnd").setValue(new StringType(periodEndValid));
    params.addParameter().setName("subject").setValue(new StringType(subjectPatientValid));
    params.addParameter().setName("status").setValue(new StringType(statusValid));
    params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
    params.addParameter().setName("organization").setValue(new StringType(organizationValid));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 38 with StringType

use of org.hl7.fhir.r4b.model.StringType in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testSubjectReferenceInvalid.

@SuppressWarnings("java:S5778")
@Test
public void testSubjectReferenceInvalid() throws Exception {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
    params.addParameter().setName("periodEnd").setValue(new StringType(periodEndValid));
    params.addParameter().setName("subject").setValue(new StringType(subjectReferenceInvalid));
    params.addParameter().setName("status").setValue(new StringType(statusValid));
    params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 39 with StringType

use of org.hl7.fhir.r4b.model.StringType in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testOrganizationOnly.

@Test
public void testOrganizationOnly() throws Exception {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType(periodStartValid));
    params.addParameter().setName("periodEnd").setValue(new StringType(periodEndValid));
    params.addParameter().setName("status").setValue(new StringType(statusValid));
    params.addParameter().setName("measureId").setValue(new StringType(measureIdValid));
    params.addParameter().setName("organization").setValue(new StringType(organizationValid));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
    });
// TODO: implement organization
// assertDoesNotThrow(() -> {
// getClient().operation().onType(Measure.class).named("$care-gaps")
// .withParameters(params)
// .useHttpGet()
// .returnResourceType(Parameters.class)
// .execute();
// });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 40 with StringType

use of org.hl7.fhir.r4b.model.StringType in project cqf-ruler by DBCG.

the class MeasureEvaluateProvider method evaluateMeasure.

/**
 * Implements the <a href=
 * "https://www.hl7.org/fhir/operation-measure-evaluate-measure.html">$evaluate-measure</a>
 * operation found in the
 * <a href="http://www.hl7.org/fhir/clinicalreasoning-module.html">FHIR Clinical
 * Reasoning Module</a>. This implementation aims to be compatible with the CQF
 * IG.
 *
 * @param requestDetails The details (such as tenant) of this request. Usually
 *                       auto-populated HAPI.
 * @param theId          the Id of the Measure to evaluate
 * @param periodStart    The start of the reporting period
 * @param periodEnd      The end of the reporting period
 * @param reportType     The type of MeasureReport to generate
 * @param subject        the subject to use for the evaluation
 * @param practitioner   the practitioner to use for the evaluation
 * @param lastReceivedOn the date the results of this measure were last
 *                       received.
 * @param productLine    the productLine (e.g. Medicare, Medicaid, etc) to use
 *                       for the evaluation. This is a non-standard parameter.
 * @param additionalData the data bundle containing additional data
 * @return the calculated MeasureReport
 */
// warning for greater than 7 parameters
@SuppressWarnings("squid:S00107")
@Description(shortDefinition = "$evaluate-measure", value = "Implements the <a href=\"https://www.hl7.org/fhir/operation-measure-evaluate-measure.html\">$evaluate-measure</a> operation found in the <a href=\"http://www.hl7.org/fhir/clinicalreasoning-module.html\">FHIR Clinical Reasoning Module</a>. This implementation aims to be compatible with the CQF IG.", example = "Measure/example/$evaluate-measure?subject=Patient/123&periodStart=2019&periodEnd=2020")
@Operation(name = "$evaluate-measure", idempotent = true, type = Measure.class)
public MeasureReport evaluateMeasure(RequestDetails requestDetails, @IdParam IdType theId, @OperationParam(name = "periodStart") String periodStart, @OperationParam(name = "periodEnd") String periodEnd, @OperationParam(name = "reportType") String reportType, @OperationParam(name = "subject") String subject, @OperationParam(name = "practitioner") String practitioner, @OperationParam(name = "lastReceivedOn") String lastReceivedOn, @OperationParam(name = "productLine") String productLine, @OperationParam(name = "additionalData") Bundle additionalData) {
    Measure measure = read(theId);
    TerminologyProvider terminologyProvider = this.jpaTerminologyProviderFactory.create(requestDetails);
    DataProvider dataProvider = this.jpaDataProviderFactory.create(requestDetails, terminologyProvider);
    LibraryContentProvider libraryContentProvider = this.libraryContentProviderFactory.create(requestDetails);
    FhirDal fhirDal = this.fhirDalFactory.create(requestDetails);
    org.opencds.cqf.cql.evaluator.measure.r4.R4MeasureProcessor measureProcessor = new org.opencds.cqf.cql.evaluator.measure.r4.R4MeasureProcessor(null, this.dataProviderFactory, null, null, null, terminologyProvider, libraryContentProvider, dataProvider, fhirDal, null, this.globalLibraryCache);
    MeasureReport report = measureProcessor.evaluateMeasure(measure.getUrl(), periodStart, periodEnd, reportType, subject, null, lastReceivedOn, null, null, null, additionalData);
    if (productLine != null) {
        Extension ext = new Extension();
        ext.setUrl("http://hl7.org/fhir/us/cqframework/cqfmeasures/StructureDefinition/cqfm-productLine");
        ext.setValue(new StringType(productLine));
        report.addExtension(ext);
    }
    return report;
}
Also used : LibraryContentProvider(org.opencds.cqf.cql.evaluator.cql2elm.content.LibraryContentProvider) StringType(org.hl7.fhir.r4.model.StringType) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) FhirDal(org.opencds.cqf.cql.evaluator.fhir.dal.FhirDal) DataProvider(org.opencds.cqf.cql.engine.data.DataProvider) Extension(org.hl7.fhir.r4.model.Extension) TerminologyProvider(org.opencds.cqf.cql.engine.terminology.TerminologyProvider) Measure(org.hl7.fhir.r4.model.Measure) Description(ca.uhn.fhir.model.api.annotation.Description) Operation(ca.uhn.fhir.rest.annotation.Operation)

Aggregations

StringType (org.hl7.fhir.r4.model.StringType)158 ArrayList (java.util.ArrayList)77 Test (org.junit.jupiter.api.Test)77 StringType (org.hl7.fhir.dstu3.model.StringType)65 Parameters (org.hl7.fhir.r4.model.Parameters)62 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)62 StringType (org.hl7.fhir.r5.model.StringType)61 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)58 StringType (org.hl7.fhir.r4b.model.StringType)45 FHIRException (org.hl7.fhir.exceptions.FHIRException)43 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)42 HashMap (java.util.HashMap)28 StringType (org.hl7.fhir.dstu2.model.StringType)27 StringType (org.hl7.fhir.dstu2016may.model.StringType)26 Coding (org.hl7.fhir.r4.model.Coding)26 Extension (org.hl7.fhir.r4.model.Extension)25 Measure (org.hl7.fhir.r4.model.Measure)23 Test (org.junit.Test)23 Base (org.hl7.fhir.r5.model.Base)20 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19