Search in sources :

Example 21 with LocalizedError

use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdValidatorTest method testPerformanceRateUuidFail.

@Test
void testPerformanceRateUuidFail() {
    Node measureReferenceResultsNode = createCorrectMeasureReference(REQUIRES_DENOM_EXCEPTION_GUID).replaceSubPopulationPerformanceRate(REQUIRES_DENOM_EXCEPTION_NUMER_GUID, "fail").build();
    Set<Detail> details = objectUnderTest.validateSingleNode(measureReferenceResultsNode);
    LocalizedError expectedErrorMessage = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format("CMS68v6", PERFORMANCE_RATE_ID, REQUIRES_DENOM_EXCEPTION_NUMER_GUID);
    assertWithMessage("Must contain the correct error message.").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(expectedErrorMessage);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 22 with LocalizedError

use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.

the class ConverterTest method checkup.

private void checkup(TransformException exception, LocalizedError error) {
    AllErrors allErrors = exception.getDetails();
    List<Error> errors = allErrors.getErrors();
    assertWithMessage("There must only be one error source.").that(errors).hasSize(1);
    List<Detail> details = errors.get(0).getDetails();
    assertWithMessage("There must be only one validation error.").that(details).hasSize(1);
    assertWithMessage("The validation error was incorrect").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(error);
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) Error(gov.cms.qpp.conversion.model.error.Error) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) Detail(gov.cms.qpp.conversion.model.error.Detail)

Example 23 with LocalizedError

use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdRoundTripTest method testMeasureCMS68v6PerformanceRateUuid.

@Test
void testMeasureCMS68v6PerformanceRateUuid() {
    Converter converter = new Converter(new PathSource(INVALID_PERFORMANCE_UUID_FILE));
    List<Detail> details = new ArrayList<>();
    try {
        converter.transform();
    } catch (TransformException exception) {
        AllErrors errors = exception.getDetails();
        details.addAll(errors.getErrors().get(0).getDetails());
    }
    String measureId = "CMS68v6";
    String correctId = MeasureConfigs.getConfigurationMap().get("40280381-52fc-3a32-0153-3d64af97147b").getSubPopulation().get(0).getNumeratorUuid();
    LocalizedError error = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format(measureId, PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID, correctId);
    assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(error);
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) ArrayList(java.util.ArrayList) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 24 with LocalizedError

use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.

the class CpcMeasureDataValidator method addSupplementalValidationError.

/**
 * Adds a Supplemental Validation Error upon failure
 *
 * @param node Object being validated
 * @param supplementalData Object holding the current code that was validated
 * @param measureId current electronic measure identification
 */
private void addSupplementalValidationError(Node node, SupplementalData supplementalData, String measureId) {
    LocalizedError error = ErrorCode.CPC_PLUS_MISSING_SUPPLEMENTAL_CODE.format(supplementalData.getType(), supplementalData, supplementalData.getCode(), measureId, node.getValue(MeasureDataDecoder.MEASURE_TYPE));
    addValidationError(Detail.forErrorAndNode(error, node));
}
Also used : LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError)

Example 25 with LocalizedError

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

LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)28 Test (org.junit.jupiter.api.Test)21 Node (gov.cms.qpp.conversion.model.Node)20 Detail (gov.cms.qpp.conversion.model.error.Detail)17 AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)3 Converter (gov.cms.qpp.conversion.Converter)2 PathSource (gov.cms.qpp.conversion.PathSource)2 TransformException (gov.cms.qpp.conversion.model.error.TransformException)2 MeasureConfig (gov.cms.qpp.conversion.model.validation.MeasureConfig)2 ArrayList (java.util.ArrayList)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 EqualsTester (com.google.common.testing.EqualsTester)1 Context (gov.cms.qpp.conversion.Context)1 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 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)1 StratifierDecoder (gov.cms.qpp.conversion.decode.StratifierDecoder)1 Program (gov.cms.qpp.conversion.model.Program)1 TemplateId (gov.cms.qpp.conversion.model.TemplateId)1