Search in sources :

Example 61 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project cqf-ruler by DBCG.

the class ReportProviderIT method testPatientSubjectNotFound.

@Test
public void testPatientSubjectNotFound() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("Patient/bad-patient"));
    assertThrows(ResourceNotFoundException.class, () -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 62 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project cqf-ruler by DBCG.

the class ReportProviderIT method testSubjectGroup.

// TODO: add the count of patients returned
@Test
public void testSubjectGroup() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("Group/ra-group01"));
    loadResource("Patient-ra-patient01.json");
    loadResource("Group-ra-group01.json");
    assertDoesNotThrow(() -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 63 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project cqf-ruler by DBCG.

the class ReportProviderIT method testSubjectPatientNotFoundInGroup.

// This test requires the following application setting:
// enforce_referential_integrity_on_write: false
@Disabled("Provider needs to be updated to use parameter validation and then this test should be re-enabled")
@Test
public void testSubjectPatientNotFoundInGroup() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("Group/ra-group00"));
    loadResource("Group-ra-group00.json");
    Group group = getClient().read().resource(Group.class).withId("ra-group00").execute();
    assertNotNull(group);
    assertThrows(ResourceNotFoundException.class, () -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Group(org.hl7.fhir.r4.model.Group) Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) 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 64 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testPeriodInvalid.

@SuppressWarnings("java:S5778")
@Test
public void testPeriodInvalid() throws Exception {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType(periodEndValid));
    params.addParameter().setName("periodEnd").setValue(new StringType(periodStartValid));
    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 65 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project cqf-ruler by DBCG.

the class CareGapsProviderIT method testStatusInvalid.

@SuppressWarnings("java:S5778")
@Test
public void testStatusInvalid() 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(statusInvalid));
    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)

Aggregations

Parameters (org.hl7.fhir.r4.model.Parameters)72 Test (org.junit.jupiter.api.Test)69 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)63 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)63 StringType (org.hl7.fhir.r4.model.StringType)62 ArrayList (java.util.ArrayList)60 IOException (java.io.IOException)54 List (java.util.List)54 Bundle (org.hl7.fhir.r4.model.Bundle)53 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)52 Collectors (java.util.stream.Collectors)51 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)50 RequestHeaders (gov.cms.bfd.server.war.commons.RequestHeaders)48 FileOutputStream (java.io.FileOutputStream)47 Collections (java.util.Collections)47 Optional (java.util.Optional)47 File (java.io.File)46 Arrays (java.util.Arrays)46 CommonHeaders (gov.cms.bfd.server.war.commons.CommonHeaders)45 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)45