Search in sources :

Example 1 with Format

use of com.ibm.cohort.cql.library.Format in project quality-measure-and-cohort-service by Alvearie.

the class CohortCLI method toCqlLibraryMap.

private Map<CqlLibraryDescriptor, CqlLibrary> toCqlLibraryMap(List<Library> libraries) {
    Map<CqlLibraryDescriptor, CqlLibrary> retVal = new HashMap<>();
    for (Library library : libraries) {
        String libraryId = library.getName();
        String version = library.getVersion();
        for (Attachment attachment : library.getContent()) {
            Format libraryFormat = Format.lookupByName(attachment.getContentType());
            if (libraryFormat != null) {
                CqlLibraryDescriptor key = new CqlLibraryDescriptor().setLibraryId(libraryId).setVersion(version).setFormat(libraryFormat);
                CqlLibrary value = new CqlLibrary().setContent(new String(attachment.getData())).setDescriptor(key);
                retVal.put(key, value);
            }
        }
    }
    return retVal;
}
Also used : CqlLibrary(com.ibm.cohort.cql.library.CqlLibrary) Format(com.ibm.cohort.cql.library.Format) HashMap(java.util.HashMap) Attachment(org.hl7.fhir.r4.model.Attachment) Library(org.hl7.fhir.r4.model.Library) CqlLibrary(com.ibm.cohort.cql.library.CqlLibrary) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor)

Aggregations

CqlLibrary (com.ibm.cohort.cql.library.CqlLibrary)1 CqlLibraryDescriptor (com.ibm.cohort.cql.library.CqlLibraryDescriptor)1 Format (com.ibm.cohort.cql.library.Format)1 HashMap (java.util.HashMap)1 Attachment (org.hl7.fhir.r4.model.Attachment)1 Library (org.hl7.fhir.r4.model.Library)1