Search in sources :

Example 1 with MeasureConfig

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

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

the class MipsQualityMeasureIdValidator method internalValidateSingleNode.

/**
 * Validates node of all criteria specified for MIPS
 * <ul>
 *     <li>Checks that existing performance rates are valid</li>
 * </ul>
 * @param node The node to validate.
 */
@Override
protected void internalValidateSingleNode(Node node) {
    super.internalValidateSingleNode(node);
    MeasureConfig measureConfig = MeasureConfigHelper.getMeasureConfig(node);
    if (measureConfig != null) {
        validateExistingPerformanceRates(node, measureConfig);
    }
}
Also used : MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig)

Example 3 with MeasureConfig

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

the class CpcQualityMeasureIdValidator method internalValidateSingleNode.

/**
 * Validates node of all criteria specified for CPC Plus
 * <ul>
 *     <li>checks that the node contains the correct number of performance rates</li>
 * </ul>
 * @param node The node to validate.
 */
@Override
protected void internalValidateSingleNode(Node node) {
    super.internalValidateSingleNode(node);
    MeasureConfig measureConfig = MeasureConfigHelper.getMeasureConfig(node);
    if (measureConfig != null) {
        int requiredPerformanceRateCount = measureConfig.getStrata().size();
        thoroughlyCheck(node).childExact(ErrorCode.CPC_QUALITY_MEASURE_ID_INVALID_PERFORMANCE_RATE_COUNT.format(requiredPerformanceRateCount), requiredPerformanceRateCount, TemplateId.PERFORMANCE_RATE_PROPORTION_MEASURE);
    }
}
Also used : MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig)

Example 4 with MeasureConfig

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

the class QualityMeasureIdEncoder method createSubPopulationGrouping.

/**
 * Creates a grouping of sub populations extracted from the measure configurations
 *
 * @param node object that holds the nodes to be grouped
 * @param measureConfig object that holds the groupings
 * @return List of decoded Nodes
 */
private List<Node> createSubPopulationGrouping(Node node, MeasureConfig measureConfig) {
    int subPopCount = measureConfig.getSubPopulation().size();
    List<Node> subPopNodes = initializeMeasureDataList(subPopCount);
    Map<String, Integer> mapPopulationIdToSubPopIndex = createSubPopulationIndexMap(measureConfig);
    node.getChildNodes().stream().filter(childNode -> TemplateId.MEASURE_DATA_CMS_V2 == childNode.getType()).forEach(childNode -> {
        String populationId = childNode.getValue(MeasureDataDecoder.MEASURE_POPULATION);
        Integer subPopIndex = mapPopulationIdToSubPopIndex.get(populationId.toUpperCase(Locale.ENGLISH));
        if (subPopIndex != null) {
            Node newParentNode = subPopNodes.get(subPopIndex);
            newParentNode.addChildNode(childNode);
        }
    });
    return subPopNodes;
}
Also used : Context(gov.cms.qpp.conversion.Context) IntStream(java.util.stream.IntStream) Encoder(gov.cms.qpp.conversion.model.Encoder) MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig) Node(gov.cms.qpp.conversion.model.Node) SubPopulationLabel(gov.cms.qpp.conversion.model.validation.SubPopulationLabel) Strata(gov.cms.qpp.conversion.model.validation.Strata) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) MeasureConfigHelper(gov.cms.qpp.conversion.util.MeasureConfigHelper) List(java.util.List) SubPopulation(gov.cms.qpp.conversion.model.validation.SubPopulation) Locale(java.util.Locale) Map(java.util.Map) Optional(java.util.Optional) TemplateId(gov.cms.qpp.conversion.model.TemplateId) MeasureDataDecoder(gov.cms.qpp.conversion.decode.MeasureDataDecoder) Node(gov.cms.qpp.conversion.model.Node)

Example 5 with MeasureConfig

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

the class JsonHelperTest method readJsonAtJsonPath.

@Test
void readJsonAtJsonPath() throws Exception {
    String measureDataFileName = "measures-data.json";
    List<MeasureConfig> configurations;
    InputStream measuresInput = ClasspathHelper.contextClassLoader().getResourceAsStream(measureDataFileName);
    configurations = JsonHelper.readJsonAtJsonPath(measuresInput, "$", List.class);
    assertWithMessage("Expect to get a List of measureConfigs").that(configurations).isNotEmpty();
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) List(java.util.List) MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig) Test(org.junit.jupiter.api.Test)

Aggregations

MeasureConfig (gov.cms.qpp.conversion.model.validation.MeasureConfig)9 Node (gov.cms.qpp.conversion.model.Node)3 Test (org.junit.jupiter.api.Test)3 SubPopulation (gov.cms.qpp.conversion.model.validation.SubPopulation)2 List (java.util.List)2 Context (gov.cms.qpp.conversion.Context)1 MeasureDataDecoder (gov.cms.qpp.conversion.decode.MeasureDataDecoder)1 Encoder (gov.cms.qpp.conversion.model.Encoder)1 TemplateId (gov.cms.qpp.conversion.model.TemplateId)1 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)1 Strata (gov.cms.qpp.conversion.model.validation.Strata)1 SubPopulationLabel (gov.cms.qpp.conversion.model.validation.SubPopulationLabel)1 SupplementalData (gov.cms.qpp.conversion.model.validation.SupplementalData)1 MeasureConfigHelper (gov.cms.qpp.conversion.util.MeasureConfigHelper)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Optional (java.util.Optional)1