Search in sources :

Example 1 with ModelResolver

use of org.opencds.cqf.cql.engine.model.ModelResolver in project cqf-ruler by DBCG.

the class EvaluationContext method getDataProvider.

private DataProvider getDataProvider() {
    if (remoteProvider == null) {
        ModelResolver resolver = modelResolver;
        TerminologyProvider terminologyProvider;
        switch(fhirVersion) {
            case DSTU2:
                terminologyProvider = new Dstu3FhirTerminologyProvider(this.getSystemFhirClient());
                break;
            case DSTU3:
                terminologyProvider = new Dstu3FhirTerminologyProvider(this.getSystemFhirClient());
                break;
            case R4:
                terminologyProvider = new R4FhirTerminologyProvider(this.getSystemFhirClient());
                break;
            default:
                throw new NotImplementedException("This CDS Hooks implementation is not configured for FHIR version: " + fhirVersion.getFhirVersionString());
        }
        RestFhirRetrieveProvider provider = new RestFhirRetrieveProvider(new SearchParameterResolver(this.fhirContext), this.getHookFhirClient());
        provider.setTerminologyProvider(terminologyProvider);
        provider.setExpandValueSets(this.providerConfiguration.getExpandValueSets());
        provider.setMaxCodesPerQuery(this.providerConfiguration.getMaxCodesPerQuery());
        provider.setSearchStyle(this.providerConfiguration.getSearchStyle());
        this.remoteProvider = new CompositeDataProvider(resolver, provider);
    }
    return remoteProvider;
}
Also used : SearchParameterResolver(org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver) TerminologyProvider(org.opencds.cqf.cql.engine.terminology.TerminologyProvider) R4FhirTerminologyProvider(org.opencds.cqf.cql.engine.fhir.terminology.R4FhirTerminologyProvider) Dstu3FhirTerminologyProvider(org.opencds.cqf.cql.engine.fhir.terminology.Dstu3FhirTerminologyProvider) RestFhirRetrieveProvider(org.opencds.cqf.cql.engine.fhir.retrieve.RestFhirRetrieveProvider) NotImplementedException(org.opencds.cqf.ruler.cdshooks.exceptions.NotImplementedException) Dstu3FhirTerminologyProvider(org.opencds.cqf.cql.engine.fhir.terminology.Dstu3FhirTerminologyProvider) CompositeDataProvider(org.opencds.cqf.cql.engine.data.CompositeDataProvider) R4FhirTerminologyProvider(org.opencds.cqf.cql.engine.fhir.terminology.R4FhirTerminologyProvider) ModelResolver(org.opencds.cqf.cql.engine.model.ModelResolver)

Example 2 with ModelResolver

use of org.opencds.cqf.cql.engine.model.ModelResolver in project quality-measure-and-cohort-service by Alvearie.

the class DefaultCqlDataProviderTest method resolveType_objectInput.

@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void resolveType_objectInput() {
    Object input = new Object();
    Class expected = this.getClass();
    ModelResolver resolver = Mockito.mock(ModelResolver.class);
    Mockito.when(resolver.resolveType(input)).thenReturn(expected);
    CqlDataProvider provider = new DefaultCqlDataProvider(resolver, null);
    Assert.assertEquals(expected, provider.resolveType(input));
}
Also used : ModelResolver(org.opencds.cqf.cql.engine.model.ModelResolver) Test(org.junit.Test)

Example 3 with ModelResolver

use of org.opencds.cqf.cql.engine.model.ModelResolver in project quality-measure-and-cohort-service by Alvearie.

the class DefaultCqlDataProviderTest method objectEqual.

@Test
public void objectEqual() {
    boolean expected = true;
    Object left = new Object();
    Object right = new Object();
    ModelResolver resolver = Mockito.mock(ModelResolver.class);
    Mockito.when(resolver.objectEqual(left, right)).thenReturn(expected);
    CqlDataProvider provider = new DefaultCqlDataProvider(resolver, null);
    Assert.assertEquals(expected, provider.objectEqual(left, right));
}
Also used : ModelResolver(org.opencds.cqf.cql.engine.model.ModelResolver) Test(org.junit.Test)

Example 4 with ModelResolver

use of org.opencds.cqf.cql.engine.model.ModelResolver in project quality-measure-and-cohort-service by Alvearie.

the class DefaultCqlDataProviderTest method resolveType_stringInput.

@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void resolveType_stringInput() {
    String typeName = "typeName";
    Class expected = this.getClass();
    ModelResolver resolver = Mockito.mock(ModelResolver.class);
    Mockito.when(resolver.resolveType(typeName)).thenReturn(expected);
    CqlDataProvider provider = new DefaultCqlDataProvider(resolver, null);
    Assert.assertEquals(expected, provider.resolveType(typeName));
}
Also used : ModelResolver(org.opencds.cqf.cql.engine.model.ModelResolver) Test(org.junit.Test)

Example 5 with ModelResolver

use of org.opencds.cqf.cql.engine.model.ModelResolver in project quality-measure-and-cohort-service by Alvearie.

the class DefaultCqlDataProviderTest method setPackageName.

@Test
public void setPackageName() {
    String value = "value";
    ModelResolver resolver = Mockito.mock(ModelResolver.class);
    CqlDataProvider provider = new DefaultCqlDataProvider(resolver, null);
    provider.setPackageName(value);
    Mockito.verify(resolver, Mockito.times(1)).setPackageName(value);
}
Also used : ModelResolver(org.opencds.cqf.cql.engine.model.ModelResolver) Test(org.junit.Test)

Aggregations

ModelResolver (org.opencds.cqf.cql.engine.model.ModelResolver)13 Test (org.junit.Test)12 CompositeDataProvider (org.opencds.cqf.cql.engine.data.CompositeDataProvider)1 RestFhirRetrieveProvider (org.opencds.cqf.cql.engine.fhir.retrieve.RestFhirRetrieveProvider)1 SearchParameterResolver (org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver)1 Dstu3FhirTerminologyProvider (org.opencds.cqf.cql.engine.fhir.terminology.Dstu3FhirTerminologyProvider)1 R4FhirTerminologyProvider (org.opencds.cqf.cql.engine.fhir.terminology.R4FhirTerminologyProvider)1 TerminologyProvider (org.opencds.cqf.cql.engine.terminology.TerminologyProvider)1 NotImplementedException (org.opencds.cqf.ruler.cdshooks.exceptions.NotImplementedException)1