Search in sources :

Example 1 with SubPopulation

use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.

the class MeasureDataTest method inspectMeasureData.

@Test
void inspectMeasureData() {
    glossaryMap.forEach((key, value) -> {
        MeasureConfig config = configMap.get(key);
        assertWithMessage("Missing measure configuration for: %s", key).that(config).isNotNull();
        assertWithMessage("Should have the same amount of sub populations").that(config.getStrata()).hasSize(value.getStrata().size());
        List<SubPopulation> pops = config.getStrata().stream().map(Strata::getElectronicMeasureUuids).collect(Collectors.toList());
        value.getStrata().forEach(stratum -> {
            assertWithMessage("Required sub population was not present within: %s", config.getElectronicMeasureId()).that(pops).contains(stratum.getElectronicMeasureUuids());
        });
    });
}
Also used : SubPopulation(gov.cms.qpp.conversion.model.validation.SubPopulation) MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig) Test(org.junit.jupiter.api.Test)

Example 2 with SubPopulation

use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdValidator method validateAllSubPopulations.

/**
 * Validates all the sub populations in the quality measure based on the measure configuration
 *
 * @param node The current parent node
 * @param measureConfig The measure configuration's sub population to use
 */
void validateAllSubPopulations(final Node node, final MeasureConfig measureConfig) {
    List<SubPopulation> subPopulations = measureConfig.getSubPopulation();
    if (subPopulations.isEmpty()) {
        return;
    }
    SubPopulations.getExclusiveKeys(subPopulationExclusions).forEach(subPopulationLabel -> validateChildTypeCount(subPopulations, subPopulationLabel, node));
    for (SubPopulation subPopulation : subPopulations) {
        validateSubPopulation(node, subPopulation);
    }
}
Also used : SubPopulation(gov.cms.qpp.conversion.model.validation.SubPopulation)

Example 3 with SubPopulation

use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdEncoder method createSubPopulationIndexMap.

/**
 * Creates a map of child guids to indexes for sub population grouping
 *
 * @param measureConfig configurations that group the sub populations
 * @return Map of Population UUID keys and index values
 */
private Map<String, Integer> createSubPopulationIndexMap(MeasureConfig measureConfig) {
    Map<String, Integer> supPopMap = new HashMap<>();
    int index = 0;
    for (SubPopulation subPopulation : measureConfig.getSubPopulation()) {
        supPopMap.put(subPopulation.getDenominatorUuid(), index);
        supPopMap.put(subPopulation.getDenominatorExceptionsUuid(), index);
        supPopMap.put(subPopulation.getDenominatorExclusionsUuid(), index);
        supPopMap.put(subPopulation.getNumeratorUuid(), index);
        supPopMap.put(subPopulation.getInitialPopulationUuid(), index);
        index++;
    }
    return supPopMap;
}
Also used : SubPopulation(gov.cms.qpp.conversion.model.validation.SubPopulation) HashMap(java.util.HashMap)

Example 4 with SubPopulation

use of gov.cms.qpp.conversion.model.validation.SubPopulation 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)

Example 5 with SubPopulation

use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.

the class MipsQualityMeasureIdValidator method validatePerformanceRateUuid.

/**
 * Validates an individual performance rate
 *
 * @param node The current parent node
 * @param measureConfig Holds the current sub population and electronic measure id
 * @param performanceRateNode The current performance rate node
 */
private void validatePerformanceRateUuid(Node node, MeasureConfig measureConfig, Node performanceRateNode) {
    List<SubPopulation> subPopulations = measureConfig.getSubPopulation();
    validatePerformanceRateUuidExists(performanceRateNode);
    String performanceUuid = performanceRateNode.getValue(PERFORMANCE_RATE_ID);
    if (performanceUuid != null) {
        SubPopulation subPopulation = subPopulations.stream().filter(makePerformanceRateUuidFinder(performanceUuid)).findFirst().orElse(null);
        if (subPopulation == null) {
            Set<String> expectedPerformanceUuids = subPopulations.stream().map(SubPopulation::getNumeratorUuid).collect(Collectors.toSet());
            String expectedUuidString = StringHelper.join(expectedPerformanceUuids, ",", "or");
            addPerformanceRateValidationMessage(node, measureConfig.getElectronicMeasureId(), expectedUuidString);
        }
    }
}
Also used : SubPopulation(gov.cms.qpp.conversion.model.validation.SubPopulation)

Aggregations

SubPopulation (gov.cms.qpp.conversion.model.validation.SubPopulation)5 MeasureConfig (gov.cms.qpp.conversion.model.validation.MeasureConfig)2 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 SubPopulationLabel (gov.cms.qpp.conversion.model.validation.SubPopulationLabel)1 MeasureConfigHelper (gov.cms.qpp.conversion.util.MeasureConfigHelper)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 Predicate (java.util.function.Predicate)1