Search in sources :

Example 1 with RuleMapping

use of org.hl7.davinci.endpoint.database.RuleMapping in project CRD by HL7-DaVinci.

the class RuleFinder method findRules.

/**
 * Find and retern the relevant coverage rules in the database.
 * @param criteria The search criteria object
 * @return List of matching RuleMapping entries
 */
public List<RuleMapping> findRules(CoverageRequirementRuleCriteria criteria) {
    logger.info("RuleFinder::findRules(" + criteria.getQueryString() + ")");
    List<RuleMapping> ruleList = new ArrayList<>();
    if (ruleMappingRepository == null) {
        logger.warn("RuleFinder::findRules: the ruleMappingRepository is null");
        return ruleList;
    }
    for (RuleMapping rule : ruleMappingRepository.findRules(criteria)) {
        ruleList.add(rule);
    }
    if (ruleList.size() == 0) {
        logger.info("RuleFinder::findRules() returned no results for query: " + criteria.toString());
    }
    return ruleList;
}
Also used : ArrayList(java.util.ArrayList) RuleMapping(org.hl7.davinci.endpoint.database.RuleMapping)

Example 2 with RuleMapping

use of org.hl7.davinci.endpoint.database.RuleMapping in project CRD by HL7-DaVinci.

the class FhirBundleProcessor method buildExecutionContexts.

private void buildExecutionContexts(List<CoverageRequirementRuleCriteria> criteriaList, HashMap<String, Resource> cqlParams) {
    for (CoverageRequirementRuleCriteria criteria : criteriaList) {
        logger.info("FhirBundleProcessor::buildExecutionContexts() criteria: " + criteria.toString());
        List<RuleMapping> rules = fileStore.findRules(criteria);
        for (RuleMapping rule : rules) {
            CoverageRequirementRuleResult result = new CoverageRequirementRuleResult();
            result.setCriteria(criteria).setTopic(rule.getTopic());
            try {
                logger.info("FhirBundleProcessor::buildExecutionContexts() found rule topic: " + rule.getTopic());
                // get the CqlRule
                CqlRule cqlRule = fileStore.getCqlRule(rule.getTopic(), rule.getFhirVersion());
                result.setContext(CqlExecutionContextBuilder.getExecutionContext(cqlRule, cqlParams, baseUrl));
                results.add(result);
            } catch (Exception e) {
                logger.info("r4/FhirBundleProcessor::buildExecutionContexts: failed processing cql bundle: " + e.getMessage());
            }
        }
    }
}
Also used : CoverageRequirementRuleCriteria(org.hl7.davinci.endpoint.rules.CoverageRequirementRuleCriteria) CqlRule(org.hl7.davinci.endpoint.cql.CqlRule) CoverageRequirementRuleResult(org.hl7.davinci.endpoint.rules.CoverageRequirementRuleResult) RuleMapping(org.hl7.davinci.endpoint.database.RuleMapping) RequestIncompleteException(org.hl7.davinci.RequestIncompleteException)

Example 3 with RuleMapping

use of org.hl7.davinci.endpoint.database.RuleMapping in project CRD by HL7-DaVinci.

the class RuleFinder method findRules.

public List<RuleMapping> findRules(String topic, String fhirVersion) {
    logger.info("RuleFinder::findRules(" + topic + ", " + fhirVersion + ")");
    List<RuleMapping> ruleList = new ArrayList<>();
    if (ruleMappingRepository == null) {
        logger.warn("RuleFinder::findRules: the ruleMappingRepository is null");
        return ruleList;
    }
    for (RuleMapping rule : ruleMappingRepository.findRules(topic, fhirVersion)) {
        ruleList.add(rule);
    }
    if (ruleList.size() == 0) {
        logger.info("RuleFinder::findRules() returned no results for topic: " + topic + "(" + fhirVersion + ")");
    }
    return ruleList;
}
Also used : ArrayList(java.util.ArrayList) RuleMapping(org.hl7.davinci.endpoint.database.RuleMapping)

Example 4 with RuleMapping

use of org.hl7.davinci.endpoint.database.RuleMapping in project CRD by HL7-DaVinci.

the class RuleFinder method findAll.

/**
 * Find all of the lookup table rules in the database.
 * @return List of all RuleMapping entries
 */
public List<RuleMapping> findAll() {
    logger.info("RuleFinder::findAll()");
    List<RuleMapping> ruleList = new ArrayList<>();
    for (RuleMapping rule : ruleMappingRepository.findAll()) {
        ruleList.add(rule);
    }
    if (ruleList.size() == 0) {
        logger.debug("RuleFinder returned no results for find all");
    }
    return ruleList;
}
Also used : ArrayList(java.util.ArrayList) RuleMapping(org.hl7.davinci.endpoint.database.RuleMapping)

Aggregations

RuleMapping (org.hl7.davinci.endpoint.database.RuleMapping)4 ArrayList (java.util.ArrayList)3 RequestIncompleteException (org.hl7.davinci.RequestIncompleteException)1 CqlRule (org.hl7.davinci.endpoint.cql.CqlRule)1 CoverageRequirementRuleCriteria (org.hl7.davinci.endpoint.rules.CoverageRequirementRuleCriteria)1 CoverageRequirementRuleResult (org.hl7.davinci.endpoint.rules.CoverageRequirementRuleResult)1