Search in sources :

Example 1 with CqlEngineWrapper

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();
}
Also used : FhirContext(ca.uhn.fhir.context.FhirContext) FhirClientBuilder(com.ibm.cohort.fhir.client.config.FhirClientBuilder) CqlEngineWrapper(com.ibm.cohort.engine.CqlEngineWrapper) FhirClientBuilderFactory(com.ibm.cohort.fhir.client.config.FhirClientBuilderFactory)

Aggregations

FhirContext (ca.uhn.fhir.context.FhirContext)1 CqlEngineWrapper (com.ibm.cohort.engine.CqlEngineWrapper)1 FhirClientBuilder (com.ibm.cohort.fhir.client.config.FhirClientBuilder)1 FhirClientBuilderFactory (com.ibm.cohort.fhir.client.config.FhirClientBuilderFactory)1