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();
}
Aggregations