Search in sources :

Example 1 with LibrarySourceProvider

use of org.opencds.cqf.common.providers.LibrarySourceProvider in project quality-measure-and-cohort-service by Alvearie.

the class R4TranslatingLibraryLoader method translateLibrary.

private String translateLibrary(String content, VersionedIdentifier libraryIdentifier) {
    LibraryResolutionProvider<org.hl7.fhir.r4.model.Library> libraryResolutionProvider = new ResolverLibraryResolutionProvider<>(resolver);
    LibrarySourceProvider<org.hl7.fhir.r4.model.Library, Attachment> librarySourceProvider = new LibrarySourceProvider<>(libraryResolutionProvider, org.hl7.fhir.r4.model.Library::getContent, Attachment::getContentType, Attachment::getData);
    CqlLibrarySourceProvider cqlLibrarySourceProvider = new SourceProviderBasedCqlLibrarySourceProvider(librarySourceProvider);
    CqlLibraryDescriptor descriptor = new CqlLibraryDescriptor().setFormat(Format.CQL).setLibraryId(libraryIdentifier.getId()).setVersion(libraryIdentifier.getVersion());
    CqlLibrary library = new CqlLibrary().setDescriptor(descriptor).setContent(content);
    return translator.translate(library, cqlLibrarySourceProvider).getMainLibrary().getContent();
}
Also used : CqlLibrary(com.ibm.cohort.cql.library.CqlLibrary) CqlLibrarySourceProvider(com.ibm.cohort.cql.provider.CqlLibrarySourceProvider) LibrarySourceProvider(org.opencds.cqf.common.providers.LibrarySourceProvider) SourceProviderBasedCqlLibrarySourceProvider(com.ibm.cohort.cql.provider.SourceProviderBasedCqlLibrarySourceProvider) SourceProviderBasedCqlLibrarySourceProvider(com.ibm.cohort.cql.provider.SourceProviderBasedCqlLibrarySourceProvider) CqlLibrarySourceProvider(com.ibm.cohort.cql.provider.CqlLibrarySourceProvider) SourceProviderBasedCqlLibrarySourceProvider(com.ibm.cohort.cql.provider.SourceProviderBasedCqlLibrarySourceProvider) Attachment(org.hl7.fhir.r4.model.Attachment) CqlLibrary(com.ibm.cohort.cql.library.CqlLibrary) Library(org.cqframework.cql.elm.execution.Library) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor) ResolverLibraryResolutionProvider(com.ibm.cohort.cql.hapi.provider.ResolverLibraryResolutionProvider)

Aggregations

ResolverLibraryResolutionProvider (com.ibm.cohort.cql.hapi.provider.ResolverLibraryResolutionProvider)1 CqlLibrary (com.ibm.cohort.cql.library.CqlLibrary)1 CqlLibraryDescriptor (com.ibm.cohort.cql.library.CqlLibraryDescriptor)1 CqlLibrarySourceProvider (com.ibm.cohort.cql.provider.CqlLibrarySourceProvider)1 SourceProviderBasedCqlLibrarySourceProvider (com.ibm.cohort.cql.provider.SourceProviderBasedCqlLibrarySourceProvider)1 Library (org.cqframework.cql.elm.execution.Library)1 Attachment (org.hl7.fhir.r4.model.Attachment)1 LibrarySourceProvider (org.opencds.cqf.common.providers.LibrarySourceProvider)1