From 245b7dea7d009bc0a979ede4c5de6fc72f8b54b4 Mon Sep 17 00:00:00 2001 From: Sivakumar Srinivasulu Date: Fri, 1 Nov 2024 15:24:19 -0500 Subject: [PATCH] fixed error details duplication --- commons/src/main/resources/measures-data.json | 6 +++--- .../cms/qpp/conversion/model/error/AllErrors.java | 8 ++++++++ .../qpp/conversion/model/error/AllErrorsTest.java | 13 +++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/commons/src/main/resources/measures-data.json b/commons/src/main/resources/measures-data.json index db7795dca..965cb3988 100644 --- a/commons/src/main/resources/measures-data.json +++ b/commons/src/main/resources/measures-data.json @@ -9636,7 +9636,7 @@ "nqfEMeasureId": null, "nqfId": "0053", "measureId": "418", - "description": "The percentage of women 65–85 years of age who suffered a fracture and who had either a bone mineral density (BMD) test or prescription for a drug to treat osteoporosis in the six months after the fracture.", + "description": "The percentage of women 50-85 years of age who suffered a fracture and who had either a bone mineral density (BMD) test or prescription for a drug to treat osteoporosis in the six months after the fracture.", "measureType": "process", "isHighPriority": false, "primarySteward": "National Committee for Quality Assurance", @@ -11983,7 +11983,7 @@ "preventiveMedicine" ], "measureSpecification": { - "registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_497_MIPSCQM_Spec_and_Addendum.zip " + "registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_497_MIPSCQM_Spec_and_Addendum.zip" }, "overallAlgorithm": "weightedAverage", "strata": [ @@ -12296,7 +12296,7 @@ "urology" ], "measureSpecification": { - "registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_503_MIPSCQM_Spec_and_Addendum.zip " + "registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_503_MIPSCQM_Spec_and_Addendum.zip" }, "overallAlgorithm": "overallStratumOnly", "strata": [ diff --git a/converter/src/main/java/gov/cms/qpp/conversion/model/error/AllErrors.java b/converter/src/main/java/gov/cms/qpp/conversion/model/error/AllErrors.java index 923a6aba1..a81f8af01 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/model/error/AllErrors.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/model/error/AllErrors.java @@ -3,6 +3,7 @@ import com.google.common.base.MoreObjects; import java.io.Serializable; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; /** @@ -34,6 +35,13 @@ public AllErrors(List errors) { * @return All the {@code Error}s. */ public List getErrors() { + if (null == errors) return errors; + errors.forEach(error -> { + if (!error.getDetails().isEmpty()) { + List details = new ArrayList<>(new LinkedHashSet<>(error.getDetails())); + error.setDetails(details); + } + }); return errors; } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/model/error/AllErrorsTest.java b/converter/src/test/java/gov/cms/qpp/conversion/model/error/AllErrorsTest.java index 8387f2b7f..3d4c4a55e 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/model/error/AllErrorsTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/model/error/AllErrorsTest.java @@ -65,4 +65,17 @@ void testArgConstructor() { assertThat(new AllErrors(errors).getErrors()) .containsAtLeastElementsIn(errors); } + + @Test + void testGetErrorDuplicateDetails() { + AllErrors objectUnderTest = new AllErrors(); + List details = new ArrayList(); + details.add(new Detail("test")); + details.add(new Detail("test")); + Error error = new Error(); + error.setDetails(details); + objectUnderTest.addError(error); + assertWithMessage("The error details should be one") + .that(objectUnderTest.getErrors().get(0).getDetails()).hasSize(1); + } } \ No newline at end of file