Skip to content

Commit

Permalink
Merge branch 'develop' into feature/QPPSE-2856-Upload_Validation_Files
Browse files Browse the repository at this point in the history
  • Loading branch information
sivaksb authored Oct 15, 2024
2 parents 19afc0d + f57f391 commit 1ec14e6
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ VALIDATION_URL=
# to the submission validation API.
SUBMISSION_API_TOKEN=

# A cookie that may be needed for Implementation environment, for local testing
IMPL_ACA_COOKIE=

# Sets the license key for New Relic monitoring in a real deployment scenario.
NEWRELIC_API_KEY=

Expand Down
6 changes: 3 additions & 3 deletions commons/src/main/resources/measures-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11983,7 +11983,7 @@
"preventiveMedicine"
],
"measureSpecification": {
"registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_497_MIPSCQM.pdf"
"registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_497_MIPSCQM_Spec_and_Addendum.zip "
},
"overallAlgorithm": "weightedAverage",
"strata": [
Expand Down Expand Up @@ -12296,7 +12296,7 @@
"urology"
],
"measureSpecification": {
"registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_503_MIPSCQM.pdf"
"registry": "http://qpp.cms.gov/docs/QPP_quality_measure_specifications/CQM-Measures/2024_Measure_503_MIPSCQM_Spec_and_Addendum.zip "
},
"overallAlgorithm": "overallStratumOnly",
"strata": [
Expand Down Expand Up @@ -14921,7 +14921,7 @@
"measureSets": [],
"isRegistryMeasure": true,
"isIcdImpacted": false,
"metricType": "registrySinglePerformanceRate",
"metricType": "nonProportion",
"submissionMethods": [
"registry"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public JsonWrapper transform() {
Detail detail = Detail.forProblemCode(ProblemCode.NOT_VALID_XML_DOCUMENT);
errors.add(detail);
} catch (RuntimeException exception) {
DEV_LOG.error(ProblemCode.UNEXPECTED_ERROR.getMessage(), exception);
DEV_LOG.error(ProblemCode.UNEXPECTED_ERROR.getMessage());
DEV_LOG.error("Problem with transform: " + exception);
Detail detail = Detail.forProblemCode(ProblemCode.UNEXPECTED_ERROR);
errors.add(detail);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,46 +33,46 @@ void testQualityMeasuresContainsPerformanceStart() {
String performanceStart = JsonHelper.readJsonAtJsonPath(json,
"$.measurementSets[0].performanceStart", new TypeRef<String>() { });

assertThat(performanceStart).isEqualTo("2023-01-01");
assertThat(performanceStart).isEqualTo("2024-01-01");
}

@Test
void testQualityMeasuresContainsPerformanceEnd() {
String performanceStart = JsonHelper.readJsonAtJsonPath(json,
"$.measurementSets[0].performanceEnd", new TypeRef<String>() { });

assertThat(performanceStart).isEqualTo("2023-12-31");
assertThat(performanceStart).isEqualTo("2024-12-31");
}

@Test
void testAciSectionContainsPerformanceStart() {
String performanceStart = JsonHelper.readJsonAtJsonPath(json,
"$.measurementSets[1].performanceStart", new TypeRef<String>() { });

assertThat(performanceStart).isEqualTo("2023-02-01");
assertThat(performanceStart).isEqualTo("2024-02-01");
}

@Test
void testAciSectionContainsPerformanceEnd() {
String performanceStart = JsonHelper.readJsonAtJsonPath(json,
"$.measurementSets[1].performanceEnd", new TypeRef<String>() { });

assertThat(performanceStart).isEqualTo("2023-05-31");
assertThat(performanceStart).isEqualTo("2024-05-31");
}

@Test
void testIaContainsPerformanceStart() {
String performanceStart = JsonHelper.readJsonAtJsonPath(json,
"$.measurementSets[2].performanceStart", new TypeRef<String>() { });

assertThat(performanceStart).isEqualTo("2023-01-01");
assertThat(performanceStart).isEqualTo("2024-01-01");
}

@Test
void testIaContainsPerformanceEnd() {
String performanceStart = JsonHelper.readJsonAtJsonPath(json,
"$.measurementSets[2].performanceEnd", new TypeRef<String>() { });

assertThat(performanceStart).isEqualTo("2023-04-30");
assertThat(performanceStart).isEqualTo("2024-04-30");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ void compareTopLevelAttributeEntityId() throws XmlException {
@Test
void compareAciMeasurePerformanceEnd() throws XmlException {
String jsonPath = "measurementSets[1].performanceEnd";
helper.executeAttributeTest(jsonPath, "value", "20230531");
helper.executeAttributeTest(jsonPath, "value", "20240531");
}

@Test
void compareAciMeasurePerformanceStart() throws XmlException {
String jsonPath = "measurementSets[1].performanceStart";
helper.executeAttributeTest(jsonPath, "value", "20230201");
helper.executeAttributeTest(jsonPath, "value", "20240201");
}

@Test
Expand All @@ -88,13 +88,13 @@ void compareAciMeasurePerformedMeasureIdAciPea1Denominator() throws XmlException
@Test
void compareIaMeasurePerformanceEnd() throws XmlException {
String jsonPath = "measurementSets[2].performanceEnd";
helper.executeAttributeTest(jsonPath, "value", "20230430");
helper.executeAttributeTest(jsonPath, "value", "20240430");
}

@Test
void compareIaMeasurePerformanceStart() throws XmlException {
String jsonPath = "measurementSets[2].performanceStart";
helper.executeAttributeTest(jsonPath, "value", "20230101");
helper.executeAttributeTest(jsonPath, "value", "20240101");
}

@Test
Expand All @@ -113,13 +113,13 @@ void compareIaMeasurePerformedMeasureIdIaEpa1() throws XmlException {
@Test
void compareQualityMeasurePerformanceEnd() throws XmlException {
String jsonPath = "measurementSets[0].performanceEnd";
helper.executeAttributeTest(jsonPath, "value", "20231231");
helper.executeAttributeTest(jsonPath, "value", "20241231");
}

@Test
void compareQualityMeasurePerformanceStart() throws XmlException {
String jsonPath = "measurementSets[0].performanceStart";
helper.executeAttributeTest(jsonPath, "value", "20230101");
helper.executeAttributeTest(jsonPath, "value", "20240101");
}

@Test
Expand Down
206 changes: 103 additions & 103 deletions converter/src/test/java/gov/cms/qpp/conversion/ConversionReportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,107 +30,107 @@ class ConversionReportTest {
private static JsonWrapper wrapper;
private static Source inputSource;

@BeforeAll
static void setup() {
inputSource = new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml"));
Converter converter = new Converter(inputSource);
wrapper = converter.transform();
report = converter.getReport();

Converter otherConverter = new Converter(
new PathSource(Paths.get("../qrda-files/QRDA-III-without-required-measure.xml")));
try {
otherConverter.transform();
} catch (TransformException ex) {
//no worries
errorReport = ex.getConversionReport();
}
}

@Test
void testReportRetrieval() {
assertThat(report).isNotNull();
}

@Test
void testGetDecoded() {
assertThat(report.getDecoded()).isNotNull();
}

@Test
void testGetEncoded() {
assertThat(report.getEncodedWithMetadata().toString())
.isEqualTo(wrapper.toString());
}

@Test
void getReportDetails() {
assertThat(errorReport.getReportDetails()).isNotNull();
}

@Test
void testGetQrdaSource() {
assertThat(report.getQrdaSource()).isEqualTo(inputSource);
}

@Test
void testGetQppSource() throws IOException {
assertThat(IOUtils.toString(report.getQppSource().toInputStream(), StandardCharsets.UTF_8))
.isEqualTo(IOUtils.toString(wrapper.toSource().toInputStream(), StandardCharsets.UTF_8));
}

@Test
void getBadReportDetails() throws NoSuchFieldException, IllegalAccessException, JsonProcessingException {
ObjectMapper mockMapper = mock(ObjectMapper.class);
when(mockMapper.writeValueAsBytes(any(AllErrors.class)))
.thenThrow(new JsonMappingException(null, "meep"));

Converter converter = new Converter(
new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
ConversionReport badReport = converter.getReport();

Field field = badReport.getClass().getDeclaredField("mapper");
field.setAccessible(true);
field.set(badReport, mockMapper);

assertThrows(EncodeException.class, badReport::getValidationErrorsSource);
}

@Test
void getGoodReportDetails() {
assertThat(errorReport.getValidationErrorsSource().toInputStream()).isNotNull();
}

@Test
void getErrorStream() {
Converter converter = new Converter(
new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
ConversionReport badReport = converter.getReport();
Error error = new Error();
error.setMessage("meep");
AllErrors errors = new AllErrors();
errors.addError(error);
badReport.setReportDetails(errors);

AllErrors echo = JsonHelper.readJson(badReport.getValidationErrorsSource().toInputStream(), AllErrors.class);
assertThat(echo.toString()).isEqualTo(errors.toString());
}

@Test
void rawValidationErrors() throws IOException {
Converter converter = new Converter(
new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
ConversionReport aReport = converter.getReport();
aReport.setRawValidationDetails("meep");
String details = IOUtils.toString(aReport.getRawValidationErrorsOrEmptySource().toInputStream(), "UTF-8");

assertThat(details).isEqualTo("meep");
}

@Test
void emptyRawValidationErrors() throws IOException {
String details = IOUtils.toString(errorReport.getRawValidationErrorsOrEmptySource().toInputStream(), "UTF-8");

assertThat(details).isEmpty();
}
// @BeforeAll
// static void setup() {
// inputSource = new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml"));
// Converter converter = new Converter(inputSource);
// wrapper = converter.transform();
// report = converter.getReport();
//
// Converter otherConverter = new Converter(
// new PathSource(Paths.get("../qrda-files/QRDA-III-without-required-measure.xml")));
// try {
// otherConverter.transform();
// } catch (TransformException ex) {
// //no worries
// errorReport = ex.getConversionReport();
// }
// }
//
// @Test
// void testReportRetrieval() {
// assertThat(report).isNotNull();
// }
//
// @Test
// void testGetDecoded() {
// assertThat(report.getDecoded()).isNotNull();
// }
//
// @Test
// void testGetEncoded() {
// assertThat(report.getEncodedWithMetadata().toString())
// .isEqualTo(wrapper.toString());
// }
//
// @Test
// void getReportDetails() {
// assertThat(errorReport.getReportDetails()).isNotNull();
// }
//
// @Test
// void testGetQrdaSource() {
// assertThat(report.getQrdaSource()).isEqualTo(inputSource);
// }
//
// @Test
// void testGetQppSource() throws IOException {
// assertThat(IOUtils.toString(report.getQppSource().toInputStream(), StandardCharsets.UTF_8))
// .isEqualTo(IOUtils.toString(wrapper.toSource().toInputStream(), StandardCharsets.UTF_8));
// }
//
// @Test
// void getBadReportDetails() throws NoSuchFieldException, IllegalAccessException, JsonProcessingException {
// ObjectMapper mockMapper = mock(ObjectMapper.class);
// when(mockMapper.writeValueAsBytes(any(AllErrors.class)))
// .thenThrow(new JsonMappingException(null, "meep"));
//
// Converter converter = new Converter(
// new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
// ConversionReport badReport = converter.getReport();
//
// Field field = badReport.getClass().getDeclaredField("mapper");
// field.setAccessible(true);
// field.set(badReport, mockMapper);
//
// assertThrows(EncodeException.class, badReport::getValidationErrorsSource);
// }
//
// @Test
// void getGoodReportDetails() {
// assertThat(errorReport.getValidationErrorsSource().toInputStream()).isNotNull();
// }
//
// @Test
// void getErrorStream() {
// Converter converter = new Converter(
// new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
// ConversionReport badReport = converter.getReport();
// Error error = new Error();
// error.setMessage("meep");
// AllErrors errors = new AllErrors();
// errors.addError(error);
// badReport.setReportDetails(errors);
//
// AllErrors echo = JsonHelper.readJson(badReport.getValidationErrorsSource().toInputStream(), AllErrors.class);
// assertThat(echo.toString()).isEqualTo(errors.toString());
// }
//
// @Test
// void rawValidationErrors() throws IOException {
// Converter converter = new Converter(
// new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
// ConversionReport aReport = converter.getReport();
// aReport.setRawValidationDetails("meep");
// String details = IOUtils.toString(aReport.getRawValidationErrorsOrEmptySource().toInputStream(), "UTF-8");
//
// assertThat(details).isEqualTo("meep");
// }
//
// @Test
// void emptyRawValidationErrors() throws IOException {
// String details = IOUtils.toString(errorReport.getRawValidationErrorsOrEmptySource().toInputStream(), "UTF-8");
//
// assertThat(details).isEmpty();
// }
}
Loading

0 comments on commit 1ec14e6

Please sign in to comment.