Search in sources :

Example 1 with IBaseConformance

use of org.hl7.fhir.instance.model.api.IBaseConformance in project cqf-ruler by DBCG.

the class DataRequirements method getModuleDefinitionLibraryR4.

public static org.hl7.fhir.r4.model.Library getModuleDefinitionLibraryR4(LibraryManager libraryManager, TranslatedLibrary translatedLibrary, CqlTranslatorOptions options, SearchParameterResolver searchParameterResolver, TerminologyProvider terminologyProvider, ModelResolver modelResolver, IBaseConformance capStatement) {
    org.hl7.fhir.r5.model.Library libraryR5 = getModuleDefinitionLibraryR5(libraryManager, translatedLibrary, options);
    VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50());
    org.hl7.fhir.r4.model.Library libraryR4 = (org.hl7.fhir.r4.model.Library) versionConvertor_40_50.convertResource(libraryR5);
    libraryR4 = addDataRequirementFhirQueries(libraryR4, searchParameterResolver, terminologyProvider, modelResolver, capStatement);
    return libraryR4;
}
Also used : BaseAdvisor_40_50(org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50) VersionConvertor_40_50(org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50) TranslatedLibrary(org.cqframework.cql.cql2elm.model.TranslatedLibrary)

Example 2 with IBaseConformance

use of org.hl7.fhir.instance.model.api.IBaseConformance in project cqf-ruler by DBCG.

the class DataRequirements method getModuleDefinitionLibraryR4.

public static org.hl7.fhir.r4.model.Library getModuleDefinitionLibraryR4(org.hl7.fhir.r4.model.Measure measureToUse, LibraryManager libraryManager, TranslatedLibrary translatedLibrary, CqlTranslatorOptions options, SearchParameterResolver searchParameterResolver, TerminologyProvider terminologyProvider, ModelResolver modelResolver, IBaseConformance capStatement) {
    VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50());
    org.hl7.fhir.r5.model.Measure r5Measure = (org.hl7.fhir.r5.model.Measure) versionConvertor_40_50.convertResource(measureToUse);
    Set<String> expressionList = getExpressions(r5Measure);
    DataRequirementsProcessor dqReqTrans = new DataRequirementsProcessor();
    org.hl7.fhir.r5.model.Library effectiveDataRequirements = dqReqTrans.gatherDataRequirements(libraryManager, translatedLibrary, options, expressionList, true);
    org.hl7.fhir.r4.model.Library r4EffectiveDataRequirements = (org.hl7.fhir.r4.model.Library) versionConvertor_40_50.convertResource(effectiveDataRequirements);
    r4EffectiveDataRequirements = addDataRequirementFhirQueries(r4EffectiveDataRequirements, searchParameterResolver, terminologyProvider, modelResolver, capStatement);
    return r4EffectiveDataRequirements;
}
Also used : BaseAdvisor_40_50(org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50) VersionConvertor_40_50(org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50) Measure(org.hl7.fhir.r5.model.Measure) Measure(org.hl7.fhir.r5.model.Measure) DataRequirementsProcessor(org.cqframework.cql.elm.requirements.fhir.DataRequirementsProcessor) TranslatedLibrary(org.cqframework.cql.cql2elm.model.TranslatedLibrary)

Example 3 with IBaseConformance

use of org.hl7.fhir.instance.model.api.IBaseConformance in project cqf-ruler by DBCG.

the class Server method initialize.

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void initialize() throws ServletException {
    super.initialize();
    log.info("Loading metadata extenders from plugins");
    Map<String, MetadataExtender> extenders = myApplicationContext.getBeansOfType(MetadataExtender.class);
    for (MetadataExtender o : extenders.values()) {
        log.info("Found {} extender", o.getClass().getName());
    }
    FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion();
    String implementationDescription = myServerProperties.getImplementation_description();
    if (fhirVersion == FhirVersionEnum.DSTU2) {
        List<MetadataExtender<Conformance>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<Conformance>) x).collect(Collectors.toList());
        ExtensibleJpaConformanceProviderDstu2 confProvider = new ExtensibleJpaConformanceProviderDstu2(this, fhirSystemDao, daoConfig, extenderList);
        confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER DSTU2 Server"));
        setServerConformanceProvider(confProvider);
    } else {
        if (fhirVersion == FhirVersionEnum.DSTU3) {
            List<MetadataExtender<CapabilityStatement>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<CapabilityStatement>) x).collect(Collectors.toList());
            ExtensibleJpaConformanceProviderDstu3 confProvider = new ExtensibleJpaConformanceProviderDstu3(this, fhirSystemDao, daoConfig, searchParamRegistry, extenderList);
            confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER DSTU3 Server"));
            setServerConformanceProvider(confProvider);
        } else if (fhirVersion == FhirVersionEnum.R4) {
            List<MetadataExtender<IBaseConformance>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<IBaseConformance>) x).collect(Collectors.toList());
            ExtensibleJpaCapabilityStatementProvider confProvider = new ExtensibleJpaCapabilityStatementProvider(this, fhirSystemDao, daoConfig, searchParamRegistry, myValidationSupport, extenderList);
            confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER R4 Server"));
            setServerConformanceProvider(confProvider);
        } else if (fhirVersion == FhirVersionEnum.R5) {
            List<MetadataExtender<IBaseConformance>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<IBaseConformance>) x).collect(Collectors.toList());
            ExtensibleJpaCapabilityStatementProvider confProvider = new ExtensibleJpaCapabilityStatementProvider(this, fhirSystemDao, daoConfig, searchParamRegistry, myValidationSupport, extenderList);
            confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER R5 Server"));
            setServerConformanceProvider(confProvider);
        } else {
            throw new IllegalStateException();
        }
    }
    log.info("Loading operation providers from plugins");
    Map<String, OperationProvider> providers = myApplicationContext.getBeansOfType(OperationProvider.class);
    for (OperationProvider o : providers.values()) {
        log.info("Registering {}", o.getClass().getName());
        this.registerProvider(o);
    }
    log.info("Loading interceptors from plugins");
    Map<String, Interceptor> interceptors = myApplicationContext.getBeansOfType(Interceptor.class);
    for (Interceptor o : interceptors.values()) {
        log.info("Registering {} interceptor", o.getClass().getName());
        this.registerInterceptor(o);
    }
}
Also used : ExtensibleJpaConformanceProviderDstu2(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu2) DaoConfig(ca.uhn.fhir.jpa.api.config.DaoConfig) ExtensibleJpaConformanceProviderDstu3(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu3) IValidationSupport(ca.uhn.fhir.context.support.IValidationSupport) ServletException(javax.servlet.ServletException) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) Interceptor(org.opencds.cqf.ruler.api.Interceptor) OperationProvider(org.opencds.cqf.ruler.api.OperationProvider) BaseJpaRestfulServer(org.opencds.cqf.ruler.external.BaseJpaRestfulServer) ISearchParamRegistry(ca.uhn.fhir.rest.server.util.ISearchParamRegistry) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) Map(java.util.Map) Conformance(ca.uhn.fhir.model.dstu2.resource.Conformance) ServerProperties(org.opencds.cqf.ruler.config.ServerProperties) Logger(org.slf4j.Logger) IBaseConformance(org.hl7.fhir.instance.model.api.IBaseConformance) AppProperties(org.opencds.cqf.ruler.external.AppProperties) Collectors(java.util.stream.Collectors) ApplicationContext(org.springframework.context.ApplicationContext) List(java.util.List) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) IFhirSystemDao(ca.uhn.fhir.jpa.api.dao.IFhirSystemDao) MetadataExtender(org.opencds.cqf.ruler.api.MetadataExtender) MoreObjects.firstNonNull(com.google.common.base.MoreObjects.firstNonNull) ExtensibleJpaCapabilityStatementProvider(org.opencds.cqf.ruler.capability.ExtensibleJpaCapabilityStatementProvider) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) ExtensibleJpaConformanceProviderDstu3(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu3) ExtensibleJpaConformanceProviderDstu2(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu2) ExtensibleJpaCapabilityStatementProvider(org.opencds.cqf.ruler.capability.ExtensibleJpaCapabilityStatementProvider) OperationProvider(org.opencds.cqf.ruler.api.OperationProvider) List(java.util.List) IBaseConformance(org.hl7.fhir.instance.model.api.IBaseConformance) Interceptor(org.opencds.cqf.ruler.api.Interceptor) MetadataExtender(org.opencds.cqf.ruler.api.MetadataExtender)

Example 4 with IBaseConformance

use of org.hl7.fhir.instance.model.api.IBaseConformance in project ab2d by CMSgov.

the class BFDHealthCheck method checkBFDHealth.

void checkBFDHealth(HealthCheckData data) {
    boolean errorOccurred = false;
    IBaseConformance capabilityStatement = null;
    try {
        capabilityStatement = bfdClient.capabilityStatement(data.getVersion());
    } catch (Exception e) {
        errorOccurred = true;
        log.error("Exception occurred while trying to retrieve capability statement", e);
        markFailure(data);
    }
    try {
        if (!errorOccurred) {
            if (!data.getVersion().metaDataValid(capabilityStatement)) {
                markFailure(data);
            } else {
                data.incrementSuccesses();
                data.setConsecutiveFailures(0);
                log.debug("{} consecutive successes to connect to BFD for {}", data.getConsecutiveSuccesses(), data.getVersion());
            }
        }
    } catch (Exception ex) {
        errorOccurred = true;
        log.error("Exception occurred while trying to retrieve capability statement - Invalid version", ex);
        markFailure(data);
    }
    if (data.getConsecutiveSuccesses() >= consecutiveSuccessesToBringUp && data.getStatus() == Status.DOWN) {
        updateMaintenanceStatus(data, Status.UP, "false");
    } else if (data.getConsecutiveFailures() >= consecutiveFailuresToTakeDown && data.getStatus() == Status.UP) {
        updateMaintenanceStatus(data, Status.DOWN, "true");
    }
}
Also used : IBaseConformance(org.hl7.fhir.instance.model.api.IBaseConformance)

Aggregations

TranslatedLibrary (org.cqframework.cql.cql2elm.model.TranslatedLibrary)2 BaseAdvisor_40_50 (org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50)2 VersionConvertor_40_50 (org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50)2 IBaseConformance (org.hl7.fhir.instance.model.api.IBaseConformance)2 FhirVersionEnum (ca.uhn.fhir.context.FhirVersionEnum)1 IValidationSupport (ca.uhn.fhir.context.support.IValidationSupport)1 DaoConfig (ca.uhn.fhir.jpa.api.config.DaoConfig)1 IFhirSystemDao (ca.uhn.fhir.jpa.api.dao.IFhirSystemDao)1 Conformance (ca.uhn.fhir.model.dstu2.resource.Conformance)1 ISearchParamRegistry (ca.uhn.fhir.rest.server.util.ISearchParamRegistry)1 MoreObjects.firstNonNull (com.google.common.base.MoreObjects.firstNonNull)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ServletException (javax.servlet.ServletException)1 DataRequirementsProcessor (org.cqframework.cql.elm.requirements.fhir.DataRequirementsProcessor)1 CapabilityStatement (org.hl7.fhir.dstu3.model.CapabilityStatement)1 Measure (org.hl7.fhir.r5.model.Measure)1 Interceptor (org.opencds.cqf.ruler.api.Interceptor)1 MetadataExtender (org.opencds.cqf.ruler.api.MetadataExtender)1