Search in sources :

Example 46 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project cqf-ruler by DBCG.

the class MeasureEvaluateProviderIT method testMeasureEvaluate.

@Test
public void testMeasureEvaluate() throws Exception {
    String bundleAsText = stringFromResource("Exm105Fhir3Measure.json");
    Bundle bundle = (Bundle) getFhirContext().newJsonParser().parseResource(bundleAsText);
    getClient().transaction().withBundle(bundle).execute();
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2019-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2020-01-01"));
    params.addParameter().setName("reportType").setValue(new StringType("individual"));
    params.addParameter().setName("subject").setValue(new StringType("Patient/denom-EXM105-FHIR3"));
    params.addParameter().setName("lastReceivedOn").setValue(new StringType("2019-12-12"));
    MeasureReport returnMeasureReport = getClient().operation().onInstance(new IdType("Measure", "measure-EXM105-FHIR3-8.0.000")).named("$evaluate-measure").withParameters(params).returnResourceType(MeasureReport.class).execute();
    assertNotNull(returnMeasureReport);
// System.out.println("Resource:"+this.getFhirContext().newJsonParser().setPrettyPrint(true).encodeResourceToString(returnMeasureReport));
}
Also used : Parameters(org.hl7.fhir.dstu3.model.Parameters) StringType(org.hl7.fhir.dstu3.model.StringType) Bundle(org.hl7.fhir.dstu3.model.Bundle) MeasureReport(org.hl7.fhir.dstu3.model.MeasureReport) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 47 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project cqf-ruler by DBCG.

the class MeasureEvaluateProviderIT method testMeasureEvaluateWithAdditionalData.

@Test
public void testMeasureEvaluateWithAdditionalData() throws Exception {
    String mainBundleAsText = stringFromResource("Exm105FhirR3MeasurePartBundle.json");
    Bundle bundle = (Bundle) getFhirContext().newJsonParser().parseResource(mainBundleAsText);
    getClient().transaction().withBundle(bundle).execute();
    String additionalBundleAsText = stringFromResource("Exm105FhirR3MeasureAdditionalData.json");
    Bundle additionalData = (Bundle) getFhirContext().newJsonParser().parseResource(additionalBundleAsText);
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2019-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2020-01-01"));
    params.addParameter().setName("reportType").setValue(new StringType("individual"));
    params.addParameter().setName("subject").setValue(new StringType("Patient/denom-EXM105-FHIR3"));
    params.addParameter().setName("lastReceivedOn").setValue(new StringType("2019-12-12"));
    params.addParameter().setName("additionalData").setResource(additionalData);
    MeasureReport returnMeasureReport = getClient().operation().onInstance(new IdType("Measure", "measure-EXM105-FHIR3-8.0.000")).named("$evaluate-measure").withParameters(params).returnResourceType(MeasureReport.class).execute();
    assertNotNull(returnMeasureReport);
}
Also used : Parameters(org.hl7.fhir.dstu3.model.Parameters) StringType(org.hl7.fhir.dstu3.model.StringType) Bundle(org.hl7.fhir.dstu3.model.Bundle) MeasureReport(org.hl7.fhir.dstu3.model.MeasureReport) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 48 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testPractitionerAndOrganization.

@Test
public void testPractitionerAndOrganization() 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));
    params.addParameter().setName("practitioner").setValue(new StringType(practitionerValid));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(Measure.class).named("$care-gaps").withParameters(params).useHttpGet().returnResourceType(Parameters.class).execute();
    });
// TODO: implement practitioner and 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 49 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project cqf-ruler by DBCG.

the class DataOperationProviderIT method testDstu3MeasureDataRequirementsOperation.

@Disabled("Erroring because could not convert r5 Library to dstu3")
@Test
public void testDstu3MeasureDataRequirementsOperation() throws IOException {
    String bundleAsText = stringFromResource("Exm105Dstu3MeasureBundle.json");
    Bundle bundle = (Bundle) getFhirContext().newJsonParser().parseResource(bundleAsText);
    getClient().transaction().withBundle(bundle).execute();
    Parameters params = new Parameters();
    params.addParameter().setName("startPeriod").setValue(new StringType("2019-01-01"));
    params.addParameter().setName("endPeriod").setValue(new StringType("2020-01-01"));
    Library returnLibrary = getClient().operation().onInstance(new IdType("Measure", "measure-EXM105-FHIR3-8.0.000")).named("$data-requirements").withParameters(params).returnResourceType(Library.class).execute();
    assertNotNull(returnLibrary);
}
Also used : Parameters(org.hl7.fhir.dstu3.model.Parameters) StringType(org.hl7.fhir.dstu3.model.StringType) Bundle(org.hl7.fhir.dstu3.model.Bundle) Library(org.hl7.fhir.dstu3.model.Library) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Disabled(org.junit.jupiter.api.Disabled)

Example 50 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project cqf-ruler by DBCG.

the class CareGapsProvider method patientReports.

// warning for greater than 7 parameters
@SuppressWarnings("squid:S00107")
private Parameters.ParametersParameterComponent patientReports(RequestDetails requestDetails, String periodStart, String periodEnd, Patient patient, List<String> status, List<Measure> measures, String organization) {
    // TODO: add organization to report, if it exists.
    Composition composition = getComposition(patient);
    List<DetectedIssue> detectedIssues = new ArrayList<>();
    Map<String, Resource> evaluatedResources = new HashMap<>();
    List<MeasureReport> reports = getReports(requestDetails, periodStart, periodEnd, patient, status, measures, composition, detectedIssues, evaluatedResources);
    if (reports.isEmpty()) {
        return null;
    }
    return initializePatientParameter(patient).setResource(addBundleEntries(requestDetails.getFhirServerBase(), composition, detectedIssues, reports, evaluatedResources));
}
Also used : Composition(org.hl7.fhir.r4.model.Composition) DetectedIssue(org.hl7.fhir.r4.model.DetectedIssue) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Resource(org.hl7.fhir.r4.model.Resource) MeasureReport(org.hl7.fhir.r4.model.MeasureReport)

Aggregations

Parameters (org.hl7.fhir.r4.model.Parameters)105 Test (org.junit.jupiter.api.Test)96 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)71 StringType (org.hl7.fhir.r4.model.StringType)68 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)61 HashMap (java.util.HashMap)58 ArrayList (java.util.ArrayList)53 FHIRException (org.hl7.fhir.exceptions.FHIRException)48 IOException (java.io.IOException)44 Parameters (org.hl7.fhir.dstu3.model.Parameters)41 Bundle (org.hl7.fhir.r4.model.Bundle)34 Measure (org.hl7.fhir.r4.model.Measure)31 Path (javax.ws.rs.Path)25 Produces (javax.ws.rs.Produces)25 Patient (org.hl7.fhir.r4.model.Patient)25 FileNotFoundException (java.io.FileNotFoundException)24 List (java.util.List)24 JsonObject (javax.json.JsonObject)23 GET (javax.ws.rs.GET)23 ExtraParameters (org.apache.camel.component.fhir.api.ExtraParameters)23