use of org.opencds.cqf.cql.engine.fhir.terminology.Dstu3FhirTerminologyProvider in project cqf-ruler by DBCG.
the class CqlExecutionProvider method setupEngine.
private CqlEngine setupEngine(String subject, Parameters parameters, Endpoint dataEndpoint, Endpoint terminologyEndpoint, Bundle data, boolean useServerData, LibraryLoader libraryLoader, VersionedIdentifier libraryIdentifier, RequestDetails theRequestDetails) {
TerminologyProvider terminologyProvider;
if (terminologyEndpoint != null) {
IGenericClient client = Clients.forEndpoint(getFhirContext(), terminologyEndpoint);
terminologyProvider = new Dstu3FhirTerminologyProvider(client);
} else {
terminologyProvider = jpaTerminologyProviderFactory.create(theRequestDetails);
}
DataProvider dataProvider;
List<RetrieveProvider> retrieveProviderList = new ArrayList<>();
if (useServerData) {
JpaFhirRetrieveProvider jpaRetriever = new JpaFhirRetrieveProvider(getDaoRegistry(), new SearchParameterResolver(getFhirContext()));
jpaRetriever.setTerminologyProvider(terminologyProvider);
// Assume it's a different server, therefore need to expand.
if (terminologyEndpoint != null) {
jpaRetriever.setExpandValueSets(true);
}
retrieveProviderList.add(jpaRetriever);
}
if (dataEndpoint != null) {
IGenericClient client = Clients.forEndpoint(dataEndpoint);
RestFhirRetrieveProvider restRetriever = new RestFhirRetrieveProvider(new SearchParameterResolver(getFhirContext()), client);
restRetriever.setTerminologyProvider(terminologyProvider);
if (terminologyEndpoint == null || (terminologyEndpoint != null && !terminologyEndpoint.getAddress().equals(dataEndpoint.getAddress()))) {
restRetriever.setExpandValueSets(true);
}
retrieveProviderList.add(restRetriever);
}
if (data != null) {
BundleRetrieveProvider bundleRetriever = new BundleRetrieveProvider(getFhirContext(), data);
bundleRetriever.setTerminologyProvider(terminologyProvider);
retrieveProviderList.add(bundleRetriever);
}
PriorityRetrieveProvider priorityProvider = new PriorityRetrieveProvider(retrieveProviderList);
dataProvider = new CompositeDataProvider(myModelResolver, priorityProvider);
return new CqlEngine(libraryLoader, Collections.singletonMap("http://hl7.org/fhir", dataProvider), terminologyProvider);
}
use of org.opencds.cqf.cql.engine.fhir.terminology.Dstu3FhirTerminologyProvider 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;
}
Aggregations