Search in sources :

Example 1 with MEASURE_POPULATION

use of gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION in project qpp-conversion-tool by CMSgov.

the class CpcQualityMeasureIdValidator method followUpHook.

/**
 * Validate measure strata
 *
 * @param node measure node
 * @param sub sub population constituent ids
 */
@Override
protected void followUpHook(Node node, SubPopulation sub) {
    List<Node> strataNodes = node.getChildNodes(TemplateId.REPORTING_STRATUM_CMS).collect(Collectors.toList());
    if (strataNodes.size() != sub.getStrata().size()) {
        LocalizedError error = ErrorCode.CPC_QUALITY_MEASURE_ID_STRATA_MISMATCH.format(strataNodes.size(), sub.getStrata().size(), node.getValue(MeasureDataDecoder.MEASURE_TYPE), node.getValue(MEASURE_POPULATION), sub.getStrata());
        addValidationError(Detail.forErrorAndNode(error, node));
    }
    sub.getStrata().forEach(stratum -> {
        Predicate<Node> seek = child -> child.getValue(StratifierDecoder.STRATIFIER_ID).equalsIgnoreCase(stratum);
        if (strataNodes.stream().noneMatch(seek)) {
            LocalizedError error = ErrorCode.CPC_QUALITY_MEASURE_ID_MISSING_STRATA.format(stratum, node.getValue(MeasureDataDecoder.MEASURE_TYPE), node.getValue(MEASURE_POPULATION));
            addValidationError(Detail.forErrorAndNode(error, node));
        }
    });
}
Also used : MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig) Arrays(java.util.Arrays) Node(gov.cms.qpp.conversion.model.Node) SubPopulationLabel(gov.cms.qpp.conversion.model.validation.SubPopulationLabel) Predicate(java.util.function.Predicate) MEASURE_POPULATION(gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION) Validator(gov.cms.qpp.conversion.model.Validator) Program(gov.cms.qpp.conversion.model.Program) StratifierDecoder(gov.cms.qpp.conversion.decode.StratifierDecoder) Supplier(java.util.function.Supplier) Collectors(java.util.stream.Collectors) MeasureConfigHelper(gov.cms.qpp.conversion.util.MeasureConfigHelper) Consumer(java.util.function.Consumer) Detail(gov.cms.qpp.conversion.model.error.Detail) List(java.util.List) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) SubPopulation(gov.cms.qpp.conversion.model.validation.SubPopulation) PERFORMANCE_RATE_ID(gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID) TemplateId(gov.cms.qpp.conversion.model.TemplateId) ErrorCode(gov.cms.qpp.conversion.model.error.ErrorCode) MeasureDataDecoder(gov.cms.qpp.conversion.decode.MeasureDataDecoder) Node(gov.cms.qpp.conversion.model.Node) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError)

Aggregations

MeasureDataDecoder (gov.cms.qpp.conversion.decode.MeasureDataDecoder)1 MEASURE_POPULATION (gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION)1 PERFORMANCE_RATE_ID (gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID)1 StratifierDecoder (gov.cms.qpp.conversion.decode.StratifierDecoder)1 Node (gov.cms.qpp.conversion.model.Node)1 Program (gov.cms.qpp.conversion.model.Program)1 TemplateId (gov.cms.qpp.conversion.model.TemplateId)1 Validator (gov.cms.qpp.conversion.model.Validator)1 Detail (gov.cms.qpp.conversion.model.error.Detail)1 ErrorCode (gov.cms.qpp.conversion.model.error.ErrorCode)1 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)1 MeasureConfig (gov.cms.qpp.conversion.model.validation.MeasureConfig)1 SubPopulation (gov.cms.qpp.conversion.model.validation.SubPopulation)1 SubPopulationLabel (gov.cms.qpp.conversion.model.validation.SubPopulationLabel)1 MeasureConfigHelper (gov.cms.qpp.conversion.util.MeasureConfigHelper)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 Predicate (java.util.function.Predicate)1 Supplier (java.util.function.Supplier)1