Search in sources :

Example 1 with SupplementalData

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

the class CpcMeasureDataValidator method validateAllSupplementalNodesOfSpecifiedType.

/**
 * Validates all of the nodes under one specified Supplemental Type
 *
 * @param node Parent node of the nodes to be validated
 * @param currSupplementalDataTemplateId Template Id of the nodes to be validated
 * @param supplementalDataType current data type to be validated
 */
private void validateAllSupplementalNodesOfSpecifiedType(Node node, TemplateId currSupplementalDataTemplateId, SupplementalType supplementalDataType) {
    Set<Node> supplementalDataNodes = node.getChildNodes(currSupplementalDataTemplateId).collect(Collectors.toSet());
    EnumSet<SupplementalData> codes = EnumSet.copyOf(SupplementalData.getSupplementalDataSetByType(supplementalDataType));
    MeasureConfig measureConfig = MeasureConfigHelper.getMeasureConfig(node.getParent());
    if (measureConfig != null) {
        String electronicMeasureId = measureConfig.getElectronicMeasureId();
        for (SupplementalData supplementalData : codes) {
            Node validatedSupplementalNode = filterCorrectNode(supplementalDataNodes, supplementalData);
            if (validatedSupplementalNode == null) {
                addSupplementalValidationError(node, supplementalData, electronicMeasureId);
            } else {
                LocalizedError error = makeIncorrectCountSizeLocalizedError(node, supplementalData.getCode(), electronicMeasureId);
                check(validatedSupplementalNode).childExact(error, 1, TemplateId.ACI_AGGREGATE_COUNT);
            }
        }
    }
}
Also used : SupplementalData(gov.cms.qpp.conversion.model.validation.SupplementalData) Node(gov.cms.qpp.conversion.model.Node) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) MeasureConfig(gov.cms.qpp.conversion.model.validation.MeasureConfig)

Aggregations

Node (gov.cms.qpp.conversion.model.Node)1 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)1 MeasureConfig (gov.cms.qpp.conversion.model.validation.MeasureConfig)1 SupplementalData (gov.cms.qpp.conversion.model.validation.SupplementalData)1