Search in sources :

Example 1 with IBMFhirServerConfig

use of com.ibm.cohort.fhir.client.config.IBMFhirServerConfig in project quality-measure-and-cohort-service by Alvearie.

the class PatientTestBase method setupTestFor.

protected CqlEvaluator setupTestFor(Patient patient, String firstPackage, String... packages) {
    IBMFhirServerConfig fhirConfig = new IBMFhirServerConfig();
    fhirConfig.setEndpoint("http://localhost:" + HTTP_PORT);
    fhirConfig.setUser("fhiruser");
    fhirConfig.setPassword("change-password");
    fhirConfig.setTenantId("default");
    return setupTestFor(patient, fhirConfig, firstPackage, packages);
}
Also used : IBMFhirServerConfig(com.ibm.cohort.fhir.client.config.IBMFhirServerConfig)

Example 2 with IBMFhirServerConfig

use of com.ibm.cohort.fhir.client.config.IBMFhirServerConfig in project quality-measure-and-cohort-service by Alvearie.

the class FHIRRestUtils method getPartialFHIRConfig.

private static IBMFhirServerConfig getPartialFHIRConfig(String fhirEndpoint, String fhirTenantIdHeader, String fhirTenantId, String fhirDataSourceIdHeader, String fhirDataSourceId) {
    IBMFhirServerConfig config = new IBMFhirServerConfig();
    config.setEndpoint(fhirEndpoint);
    if (fhirTenantIdHeader == null || fhirTenantIdHeader.trim().isEmpty()) {
        fhirTenantIdHeader = IBMFhirServerConfig.DEFAULT_TENANT_ID_HEADER;
    }
    config.setTenantIdHeader(fhirTenantIdHeader);
    config.setTenantId(fhirTenantId);
    if (fhirDataSourceIdHeader == null || fhirDataSourceIdHeader.trim().isEmpty()) {
        fhirDataSourceIdHeader = IBMFhirServerConfig.DEFAULT_DATASOURCE_ID_HEADER;
    }
    config.setDataSourceIdHeader(fhirDataSourceIdHeader);
    config.setDataSourceId(fhirDataSourceId);
    return config;
}
Also used : IBMFhirServerConfig(com.ibm.cohort.fhir.client.config.IBMFhirServerConfig)

Example 3 with IBMFhirServerConfig

use of com.ibm.cohort.fhir.client.config.IBMFhirServerConfig in project quality-measure-and-cohort-service by Alvearie.

the class FHIRRestUtils method getFHIRClient.

/**
 * @param fhirEndpoint The REST endpoint for the FHIR server
 * @param bearerToken OAuth token value
 * @param fhirTenantIdHeader the header used by FHIR to identify the tenant
 * @param fhirTenantId the actual FHIR tenant id
 * @param fhirDataSourceIdHeader The header used by FHIR to identify the datasource
 * @param fhirDataSourceId the actual FHIR datasource name
 * @return IGenericClient A client that can be used to make calls to the FHIR server
 *
 * Convenience method to get a FHIR client
 */
public static IGenericClient getFHIRClient(String fhirEndpoint, String bearerToken, String fhirTenantIdHeader, String fhirTenantId, String fhirDataSourceIdHeader, String fhirDataSourceId) {
    IBMFhirServerConfig config = getPartialFHIRConfig(fhirEndpoint, fhirTenantIdHeader, fhirTenantId, fhirDataSourceIdHeader, fhirDataSourceId);
    config.setToken(bearerToken);
    FhirContext ctx = FhirContext.forR4();
    DefaultFhirClientBuilder builder = new DefaultFhirClientBuilder(ctx);
    return builder.createFhirClient(config);
}
Also used : IBMFhirServerConfig(com.ibm.cohort.fhir.client.config.IBMFhirServerConfig) FhirContext(ca.uhn.fhir.context.FhirContext) DefaultFhirClientBuilder(com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder)

Aggregations

IBMFhirServerConfig (com.ibm.cohort.fhir.client.config.IBMFhirServerConfig)3 FhirContext (ca.uhn.fhir.context.FhirContext)1 DefaultFhirClientBuilder (com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder)1