Search in sources :

Example 6 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class CpcTest method run.

private void run(String type) {
    Converter converter = new Converter(new PathSource(Paths.get(CPC_FILE)));
    converter.getContext().setHistorical(true);
    converter.getContext().setScope(Collections.singleton(QrdaScope.getInstanceByName(type)));
    converter.transform();
}
Also used : PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter)

Example 7 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class IaSectionRoundTripTest method testIaSectionConvertsIaMeasureId.

@Test
void testIaSectionConvertsIaMeasureId() {
    Converter converter = new Converter(new PathSource(file));
    JsonWrapper qpp = converter.transform();
    String iaMeasureId = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[2].measurements[0].measureId", String.class);
    assertWithMessage("Must contain measure id").that(iaMeasureId).isEqualTo("IA_EPA_3");
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Test(org.junit.jupiter.api.Test)

Example 8 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdMultiRoundTripTest method testRoundTripForQualityMeasureId.

@Test
void testRoundTripForQualityMeasureId() {
    Converter converter = new Converter(new PathSource(JUNK_QRDA3_FILE));
    JsonWrapper qpp = converter.transform();
    String json = qpp.toString();
    List<Map<String, ?>> qualityMeasures = JsonHelper.readJsonAtJsonPath(json, "$.measurementSets[?(@.category=='quality')].measurements[*]", List.class);
    List<Map<String, Integer>> subPopulation = JsonHelper.readJsonAtJsonPath(json, "$.measurementSets[?(@.category=='quality')].measurements[?(@.measureId=='160')].value.strata[*]", List.class);
    String message = "The measureId in the quality measure should still populate given the junk stuff in the measure.";
    assertWithMessage(message).that(qualityMeasures.get(0).get("measureId")).isEqualTo("160");
    assertFirstSubPopulation(subPopulation);
    assertSecondSubPopulation(subPopulation);
    assertThirdSubPopulation(subPopulation);
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 9 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdRoundTripTest method testRoundTripForQualityMeasureId.

@Test
void testRoundTripForQualityMeasureId() {
    Converter converter = new Converter(new PathSource(JUNK_QRDA3_FILE));
    JsonWrapper qpp = converter.transform();
    List<Map<String, ?>> qualityMeasures = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[?(@.category=='quality')].measurements[*]", List.class);
    assertThat(qualityMeasures).hasSize(1);
    assertWithMessage("The measureId in the quality measure should still populate given the junk stuff in the measure.").that(qualityMeasures.get(0).get("measureId")).isEqualTo("236");
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 10 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdRoundTripTest method testMeasureCMS52v5InsensitiveMeasureDataUuid.

@Test
void testMeasureCMS52v5InsensitiveMeasureDataUuid() {
    Converter converter = new Converter(new PathSource(INSENSITIVE_TEXT_FILE));
    List<Detail> details = new ArrayList<>();
    LocalizedError error = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format("CMS52v5", "DENOM", "04BF53CE-6993-4EA2-BFE5-66E36172B388");
    try {
        converter.transform();
    } catch (TransformException exception) {
        AllErrors errors = exception.getDetails();
        details.addAll(errors.getErrors().get(0).getDetails());
    }
    assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).doesNotContain(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)

Aggregations

Converter (gov.cms.qpp.conversion.Converter)28 PathSource (gov.cms.qpp.conversion.PathSource)28 Test (org.junit.jupiter.api.Test)18 TransformException (gov.cms.qpp.conversion.model.error.TransformException)13 AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)12 Path (java.nio.file.Path)9 JsonWrapper (gov.cms.qpp.conversion.encode.JsonWrapper)8 Detail (gov.cms.qpp.conversion.model.error.Detail)8 ArrayList (java.util.ArrayList)5 BeforeAll (org.junit.jupiter.api.BeforeAll)4 Map (java.util.Map)3 Context (gov.cms.qpp.conversion.Context)2 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1