Search in sources :

Example 76 with Context

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

the class IaSectionEncoderTest method testEncoderWithoutMeasureValue2.

@Test
void testEncoderWithoutMeasureValue2() {
    iaMeasurePerformedNode.putValue("measurePerformed", null);
    QppOutputEncoder encoder = new QppOutputEncoder(new Context());
    encoder.setNodes(nodes);
    StringWriter sw = new StringWriter();
    try {
        encoder.encode(new BufferedWriter(sw));
    } catch (EncodeException e) {
        Assertions.fail("Failure to encode: " + e.getMessage());
    }
    assertThat(sw.toString()).isEqualTo(EXPECTED_NO_MEASURE_VALUE_1);
}
Also used : Context(gov.cms.qpp.conversion.Context) StringWriter(java.io.StringWriter) BufferedWriter(java.io.BufferedWriter) Test(org.junit.jupiter.api.Test)

Example 77 with Context

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

the class MeasureDataEncoderTest method encode.

private JsonWrapper encode(Node measureDataNode) {
    JsonWrapper jsonWrapper = new JsonWrapper();
    QppOutputEncoder qppOutputEncoder = new QppOutputEncoder(new Context());
    qppOutputEncoder.internalEncode(jsonWrapper, measureDataNode);
    return jsonWrapper;
}
Also used : Context(gov.cms.qpp.conversion.Context)

Example 78 with Context

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

the class MeasurePerformedEncoderTest method testMeasurePerformedEncodesIntoWrapper.

@Test
void testMeasurePerformedEncodesIntoWrapper() throws EncodeException {
    Node measurePerformedNode = new Node(TemplateId.MEASURE_PERFORMED);
    measurePerformedNode.putValue("measurePerformed", "Y");
    JsonWrapper jsonWrapper = new JsonWrapper();
    QppOutputEncoder qppOutputEncoder = new QppOutputEncoder(new Context());
    qppOutputEncoder.internalEncode(jsonWrapper, measurePerformedNode);
    assertThat(jsonWrapper.getBoolean("value")).isTrue();
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 79 with Context

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

the class QualityMeasureIdMultiEncoderTest method setUp.

@BeforeEach
void setUp() {
    qualityMeasureId = new Node(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V2);
    qualityMeasureId.putValue(MEASURE_ID, "test1");
    Node aggregateCountNode = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    aggregateCountNode.putValue("aggregateCount", "600");
    eligiblePopulationNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    eligiblePopulationNode.putValue(TYPE, SubPopulationLabel.IPOP.name());
    eligiblePopulationNode.putValue(POPULATION_ID, "ipop1");
    eligiblePopulationNode.addChildNode(aggregateCountNode);
    eligiblePopulationNodeTwo = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    eligiblePopulationNodeTwo.putValue(TYPE, SubPopulationLabel.IPOP.name());
    eligiblePopulationNodeTwo.putValue(POPULATION_ID, "ipop2");
    eligiblePopulationNodeTwo.addChildNode(aggregateCountNode);
    eligiblePopulationExclusionNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    eligiblePopulationExclusionNode.putValue(TYPE, SubPopulationLabel.DENEX.name());
    eligiblePopulationExclusionNode.putValue(POPULATION_ID, "denex1");
    eligiblePopulationExclusionNode.addChildNode(aggregateCountNode);
    eligiblePopulationExclusionNodeTwo = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    eligiblePopulationExclusionNodeTwo.putValue(TYPE, SubPopulationLabel.DENEX.name());
    eligiblePopulationExclusionNodeTwo.putValue(POPULATION_ID, "denex2");
    eligiblePopulationExclusionNodeTwo.addChildNode(aggregateCountNode);
    eligiblePopulationExceptionNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    eligiblePopulationExceptionNode.putValue(TYPE, SubPopulationLabel.DENEXCEP.name());
    eligiblePopulationExceptionNode.putValue(POPULATION_ID, "denexcep1");
    eligiblePopulationExceptionNode.addChildNode(aggregateCountNode);
    eligiblePopulationExceptionNodeTwo = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    eligiblePopulationExceptionNodeTwo.putValue(TYPE, SubPopulationLabel.DENEXCEP.name());
    eligiblePopulationExceptionNodeTwo.putValue(POPULATION_ID, "denexcep2");
    eligiblePopulationExceptionNodeTwo.addChildNode(aggregateCountNode);
    numeratorNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    numeratorNode.putValue(TYPE, SubPopulationLabel.NUMER.name());
    numeratorNode.putValue(POPULATION_ID, "numer1");
    numeratorNode.addChildNode(aggregateCountNode);
    numeratorNodeTwo = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    numeratorNodeTwo.putValue(TYPE, SubPopulationLabel.NUMER.name());
    numeratorNodeTwo.putValue(POPULATION_ID, "numer2");
    numeratorNodeTwo.addChildNode(aggregateCountNode);
    denominatorNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    denominatorNode.putValue(TYPE, SubPopulationLabel.DENOM.name());
    denominatorNode.putValue(POPULATION_ID, "denom1");
    denominatorNode.addChildNode(aggregateCountNode);
    denominatorNodeTwo = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    denominatorNodeTwo.putValue(TYPE, SubPopulationLabel.DENOM.name());
    denominatorNodeTwo.putValue(POPULATION_ID, "denom2");
    denominatorNodeTwo.addChildNode(aggregateCountNode);
    encoder = new QualityMeasureIdEncoder(new Context());
    wrapper = new JsonWrapper();
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 80 with Context

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

the class ReportingParametersActEncoderTest method internalEncode.

@Test
void internalEncode() throws Exception {
    Node reportingParametersActNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT);
    reportingParametersActNode.putValue(ReportingParametersActEncoder.PERFORMANCE_START, "20170101");
    reportingParametersActNode.putValue(ReportingParametersActEncoder.PERFORMANCE_END, "20171231");
    JsonWrapper outputWrapper = new JsonWrapper();
    ReportingParametersActEncoder encoder = new ReportingParametersActEncoder(new Context());
    encoder.internalEncode(outputWrapper, reportingParametersActNode);
    String performanceStart = outputWrapper.getString(ReportingParametersActEncoder.PERFORMANCE_START);
    String performanceEnd = outputWrapper.getString(ReportingParametersActEncoder.PERFORMANCE_END);
    assertThat(performanceStart).isEqualTo("2017-01-01");
    assertThat(performanceEnd).isEqualTo("2017-12-31");
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Aggregations

Context (gov.cms.qpp.conversion.Context)114 Test (org.junit.jupiter.api.Test)92 Node (gov.cms.qpp.conversion.model.Node)63 BufferedWriter (java.io.BufferedWriter)17 StringWriter (java.io.StringWriter)17 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)14 Element (org.jdom2.Element)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 QppOutputEncoder (gov.cms.qpp.conversion.encode.QppOutputEncoder)8 ArrayList (java.util.ArrayList)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 TemplateId (gov.cms.qpp.conversion.model.TemplateId)4 Detail (gov.cms.qpp.conversion.model.error.Detail)4 InputStream (java.io.InputStream)4 Namespace (org.jdom2.Namespace)4 Map (java.util.Map)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 Converter (gov.cms.qpp.conversion.Converter)2 PathSource (gov.cms.qpp.conversion.PathSource)2 ComponentKey (gov.cms.qpp.conversion.model.ComponentKey)2