use of com.ibm.cohort.engine.CqlEngineWrapper in project health-patterns by LinuxForHealth.
the class CohortService method initializeCQLEngine.
/**
* Initialized the CQL engine (using the instance's FHIR connection info) runnig over the {@value #CQL_DIRECTORY}.
*/
private void initializeCQLEngine() {
FhirClientBuilderFactory factory = FhirClientBuilderFactory.newInstance();
FhirContext fhirContext = FhirContext.forR4();
// Currently the socket connection may time out on a FHIR server
// with several dozen patients so increasing the timeout to avoid that
fhirContext.getRestfulClientFactory().setSocketTimeout(60 * 1000);
FhirClientBuilder fhirBuilder = factory.newFhirClientBuilder(fhirContext);
fhir = fhirBuilder.createFhirClient(fhirConnectionInfo);
System.out.println("Created FHIR connection to " + fhirConnectionInfo.getEndpoint());
cqlEngine = new CqlEngineWrapper(fhirBuilder);
cqlEngine.setDataServerClient(fhir);
cqlEngine.setMeasureServerClient(fhir);
cqlEngine.setTerminologyServerClient(fhir);
resetCQLDirectory();
}
Aggregations