From c4eb9cd6f32973ddaf913475d46f1048a27cfd2c Mon Sep 17 00:00:00 2001 From: Sivakumar Srinivasulu Date: Thu, 3 Oct 2024 17:07:06 -0500 Subject: [PATCH] refactored decocer/encoder constant static variables to common file --- commons/src/main/resources/measures-data.json | 6 +- .../decode/AggregateCountDecoder.java | 4 +- .../decode/ClinicalDocumentDecoder.java | 50 +---- .../conversion/decode/MeasureDataDecoder.java | 6 +- ...rformanceRateProportionMeasureDecoder.java | 6 +- .../decode/PiMeasurePerformedRnRDecoder.java | 4 +- .../decode/PiNumeratorDenominatorDecoder.java | 4 +- .../conversion/decode/QrdaDecoderEngine.java | 7 +- .../decode/QualityMeasureIdDecoder.java | 4 +- .../decode/QualitySectionDecoder.java | 5 +- .../decode/ReportingParametersActDecoder.java | 7 +- .../decode/SkeletalKeyValueDecoder.java | 9 +- .../decode/SkeletalSectionDecoder.java | 7 +- .../SkeletalSupplementalDataDecoder.java | 6 +- .../conversion/decode/StratifierDecoder.java | 3 +- .../encode/AggregateCountEncoder.java | 6 +- .../encode/ClinicalDocumentEncoder.java | 56 +++--- .../conversion/encode/IaMeasureEncoder.java | 1 + .../conversion/encode/MeasureDataEncoder.java | 12 +- .../encode/MeasurePerformedEncoder.java | 2 + .../encode/PiMeasurePerformedRnREncoder.java | 2 + .../encode/PiNumeratorDenominatorEncoder.java | 2 + .../PiProportionDenominatorEncoder.java | 1 + .../encode/PiProportionNumeratorEncoder.java | 2 + .../conversion/encode/PiSectionEncoder.java | 24 +-- .../conversion/encode/QppOutputEncoder.java | 1 - .../encode/QualityMeasureIdEncoder.java | 56 +++--- .../encode/ReportingParametersActEncoder.java | 5 +- .../cms/qpp/conversion/model/Constants.java | 87 ++++++++ .../gov/cms/qpp/conversion/model/Program.java | 6 +- .../conversion/util/MeasureConfigHelper.java | 4 +- .../validate/AggregateCountValidator.java | 9 +- .../validate/ClinicalDocumentValidator.java | 16 +- .../CommonNumeratorDenominatorValidator.java | 9 +- .../validate/MeasureDataValidator.java | 13 +- .../MipsQualityMeasureIdValidator.java | 2 +- .../PcfClinicalDocumentValidator.java | 41 ++-- .../validate/PcfMeasureDataValidator.java | 7 +- .../PcfPerformancePeriodValidation.java | 10 +- .../PcfQualityMeasureIdValidator.java | 33 ++- .../validate/PerformanceRateValidator.java | 12 +- .../validate/PiSectionValidator.java | 2 +- .../validate/QualityMeasureIdValidator.java | 20 +- .../QualityMeasureSectionValidator.java | 11 +- .../ReportingParametersActValidator.java | 16 +- .../gov/cms/qpp/SingularAttributeTest.java | 41 ++-- .../acceptance/MeasureDataRoundTripTest.java | 2 +- .../acceptance/NegativePcfRoundTripTest.java | 8 +- .../cms/qpp/acceptance/PcfRoundTripTest.java | 4 +- .../QualityMeasureIdRoundTripTest.java | 4 +- .../acceptance/helper/JsonPathAggregator.java | 11 +- .../correlation/PathCorrelatorTest.java | 6 +- .../decode/ClinicalDocumentDecoderTest.java | 189 +++++++++--------- .../decode/MeasureDataDecoderTest.java | 2 +- ...manceRateProportionMeasureDecoderTest.java | 7 +- .../decode/QualitySectionDecoderTest.java | 3 +- .../SupplementalDataEthnicityDecoderTest.java | 2 +- .../SupplementalDataPayerDecoderTest.java | 2 +- .../SupplementalDataRaceDecoderTest.java | 2 +- .../SupplementalDataSexDecoderTest.java | 2 +- .../encode/ClinicalDocumentEncoderTest.java | 89 ++++----- .../encode/IaSectionEncoderTest.java | 7 +- .../encode/MeasureDataEncoderTest.java | 4 +- .../PiSectionEncoderMultiMeasureTest.java | 13 +- .../encode/PiSectionEncoderTest.java | 15 +- .../encode/QualityMeasureIdEncoderTest.java | 3 +- .../encode/QualitySectionEncoderTest.java | 11 +- .../ReportingParametersActEncoderTest.java | 14 +- .../cms/qpp/conversion/model/ProgramTest.java | 20 +- .../util/DuplicationCheckHelperTest.java | 12 +- .../validate/AggregateCountValidatorTest.java | 6 +- .../ClinicalDocumentValidatorTest.java | 10 +- .../PcfClinicalDocumentValidatorTest.java | 32 +-- .../PcfPerformancePeriodValidationTest.java | 17 +- .../PcfQualityMeasureIdValidatorTest.java | 6 +- .../PerformanceRateValidatorTest.java | 16 +- .../QualityMeasureIdValidatorTest.java | 10 +- .../QualityMeasureSectionValidatorTest.java | 10 +- .../ReportingParametersActValidatorTest.java | 8 +- .../conversion/api/helper/MetadataHelper.java | 15 +- .../api/internal/pii/SpecPiiValidator.java | 23 ++- .../api/helper/MetadataHelperTest.java | 20 +- .../internal/pii/SpecPiiValidatorTest.java | 27 +-- 83 files changed, 654 insertions(+), 615 deletions(-) create mode 100644 converter/src/main/java/gov/cms/qpp/conversion/model/Constants.java diff --git a/commons/src/main/resources/measures-data.json b/commons/src/main/resources/measures-data.json index c666fc65f..7d5b5de8a 100644 --- a/commons/src/main/resources/measures-data.json +++ b/commons/src/main/resources/measures-data.json @@ -5508,9 +5508,11 @@ "category": "quality", "isRegistryMeasure": false, "isRiskAdjusted": false, - "icdImpacted": [], + "icdImpacted": [ + "registry" + ], "isClinicalGuidelineChanged": false, - "isIcdImpacted": false, + "isIcdImpacted": true, "clinicalGuidelineChanged": [], "metricType": "singlePerformanceRate", "companionMeasureId": [], diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/AggregateCountDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/AggregateCountDecoder.java index 697e2b23e..734869eda 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/AggregateCountDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/AggregateCountDecoder.java @@ -11,14 +11,14 @@ import java.util.function.Consumer; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; + /** * Decoder to parse an Aggregate Count value type. */ @Decoder(TemplateId.PI_AGGREGATE_COUNT) public class AggregateCountDecoder extends QrdaDecoder { - public static final String AGGREGATE_COUNT = "aggregateCount"; - public AggregateCountDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoder.java index 252e47679..12e401b40 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoder.java @@ -14,58 +14,16 @@ import java.util.List; import java.util.Locale; -import java.util.Set; import java.util.function.Consumer; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Decoder to parse the root element of the Document-Level Template: QRDA Category III Report (ClinicalDocument). */ @Decoder(TemplateId.CLINICAL_DOCUMENT) public class ClinicalDocumentDecoder extends QrdaDecoder { - /* Constants for lookups and tests */ - // Identifier constants for: Node(Identifier, Value) and xpathlocation - public static final String NATIONAL_PROVIDER_IDENTIFIER = "nationalProviderIdentifier"; - public static final String TAX_PAYER_IDENTIFICATION_NUMBER = "taxpayerIdentificationNumber"; - public static final String PROGRAM_NAME = "programName"; - public static final String ENTITY_TYPE = "entityType"; - public static final String RAW_PROGRAM_NAME = "rawProgramName"; - public static final String PRACTICE_SITE_ADDR = "practiceSiteAddr"; - public static final String PRACTICE_ID = "practiceId"; - public static final String ENTITY_ID = "entityId"; - public static final String PCF_ENTITY_ID = "pcfEntityId"; - public static final String APM_ENTITY_ID = "apmEntityId"; - public static final String VG_ID = "virtualGroupId"; - public static final String CEHRT = "cehrtId"; - public static final String MVP_ID = "mvpId"; - public static final String SUBGROUP_ID = "subgroupId"; - - //QPP Json value constants for: Node(Identifier, value) - public static final String MIPS_PROGRAM_NAME = "mips"; - public static final String PCF_PROGRAM_NAME = "pcf"; - public static final String CPCPLUS_PROGRAM_NAME = "cpcPlus"; - public static final String ENTITY_APM = "apm"; - static final String ENTITY_GROUP = "group"; - static final String ENTITY_INDIVIDUAL = "individual"; - public static final String ENTITY_SUBGROUP = "subgroup"; - public static final String ENTITY_VIRTUAL_GROUP = "virtualGroup"; - public static final String APP_PROGRAM_NAME = "app1"; - public static final String MIPS = "MIPS"; - public static final Set MVP_ENTITIES = Set.of(ENTITY_INDIVIDUAL, ENTITY_GROUP, ENTITY_SUBGROUP, ENTITY_APM); - - // Program names in XML format - public static final String PCF = "PCF"; - public static final String APP = "APP"; - public static final String CPCPLUS = "CPCPLUS"; - public static final String MIPS_GROUP = "MIPS_GROUP"; - public static final String MIPS_INDIVIDUAL = "MIPS_INDIV"; - public static final String MIPS_APM = "MIPS_APMENTITY"; - public static final String MIPS_VIRTUAL_GROUP = "MIPS_VIRTUALGROUP"; - public static final String MIPS_SUBGROUP = "MIPS_SUBGROUP"; - private static final String APP_GROUP = "MIPS_APP1_GROUP"; - private static final String APP_INDIVIDUAL = "MIPS_APP1_INDIV"; - public static final String APP_APM = "MIPS_APP1_APMENTITY"; - public ClinicalDocumentDecoder(Context context) { super(context); } @@ -99,7 +57,7 @@ protected DecodeResult decode(Element element, Node thisNode) { setNationalProviderIdOnNode(element, thisNode); } if (ENTITY_VIRTUAL_GROUP.equals(entityType)) { - setEntityIdOnNode(element, thisNode, ClinicalDocumentDecoder.VG_ID); + setEntityIdOnNode(element, thisNode, VG_ID); } } @@ -119,7 +77,7 @@ private void setEntityIdOnNode(Element element, Node thisNode) { thisNode.putValue(PCF_ENTITY_ID, id.getValue(), false); setOnNode(element, getXpath(PCF_ENTITY_ID), consumer, Filters.attribute(), false); } else { - setEntityIdOnNode(element, thisNode, ClinicalDocumentDecoder.APM_ENTITY_ID); + setEntityIdOnNode(element, thisNode, APM_ENTITY_ID); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/MeasureDataDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/MeasureDataDecoder.java index 8b94d289d..fff6147ec 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/MeasureDataDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/MeasureDataDecoder.java @@ -14,6 +14,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_POPULATION; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_TYPE; + /** * Decoder for CMS V2 Measure Data eCQM */ @@ -23,9 +26,6 @@ public class MeasureDataDecoder extends QrdaDecoder { static final Set MEASURES = Stream.of("IPP", "IPOP", "DENEX", "DENOM", "DENEXCEP", "NUMER", "NUMEX") .collect(Collectors.toSet()); - public static final String MEASURE_TYPE = "type"; - public static final String MEASURE_POPULATION = "populationId"; - public MeasureDataDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoder.java index c263fb27e..6414b9758 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoder.java @@ -11,16 +11,14 @@ import java.util.function.Consumer; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Decodes the Performance Rate Proportion Measure from the Measure Section */ @Decoder(TemplateId.PERFORMANCE_RATE_PROPORTION_MEASURE) public class PerformanceRateProportionMeasureDecoder extends QrdaDecoder { - public static final String PERFORMANCE_RATE = "rate"; - public static final String NULL_PERFORMANCE_RATE = "nullRate"; - public static final String PERFORMANCE_RATE_ID = "performanceRateUuid"; - public PerformanceRateProportionMeasureDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/PiMeasurePerformedRnRDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/PiMeasurePerformedRnRDecoder.java index 7ad4a1f65..98f3d12f4 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/PiMeasurePerformedRnRDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/PiMeasurePerformedRnRDecoder.java @@ -11,14 +11,14 @@ import java.util.function.Consumer; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_ID; + /** * Decoder to parse an PI Measure Performed Reference and Results. */ @Decoder(TemplateId.PI_MEASURE_PERFORMED_REFERENCE_AND_RESULTS) public class PiMeasurePerformedRnRDecoder extends QrdaDecoder { - public static final String MEASURE_ID = "measureId"; - public PiMeasurePerformedRnRDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/PiNumeratorDenominatorDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/PiNumeratorDenominatorDecoder.java index fe898896f..f60cd13d5 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/PiNumeratorDenominatorDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/PiNumeratorDenominatorDecoder.java @@ -11,14 +11,14 @@ import java.util.function.Consumer; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_ID; + /** * Decoder to parse PI Numerator Denominator Type Measure reference and results. */ @Decoder(TemplateId.PI_NUMERATOR_DENOMINATOR) public class PiNumeratorDenominatorDecoder extends QrdaDecoder { - public static final String MEASURE_ID = "measureId"; - public PiNumeratorDenominatorDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/QrdaDecoderEngine.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/QrdaDecoderEngine.java index a3100b0a7..f2b6f8a6a 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/QrdaDecoderEngine.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/QrdaDecoderEngine.java @@ -19,17 +19,14 @@ import java.util.Set; import java.util.stream.Collectors; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * The engine for parsing XML into QPP format. */ public class QrdaDecoderEngine extends XmlDecoderEngine { private static final Logger DEV_LOG = LoggerFactory.getLogger(QrdaDecoderEngine.class); - private static final String TEMPLATE_ID = "templateId"; - private static final String NOT_VALID_QRDA_III_FORMAT = "The file is not a QRDA-III XML document"; - private static final String ROOT_STRING = "root"; - private static final String EXTENSION_STRING = "extension"; - protected final Context context; private final Registry decoders; diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/QualityMeasureIdDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/QualityMeasureIdDecoder.java index a5ae1632f..4a0dc18b6 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/QualityMeasureIdDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/QualityMeasureIdDecoder.java @@ -15,14 +15,14 @@ import java.util.Locale; import java.util.stream.Collectors; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_ID; + /** * Decoder to read XML Data for an Quality Measure Identifier (eCQM). */ @Decoder(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5) public class QualityMeasureIdDecoder extends QrdaDecoder { - public static final String MEASURE_ID = "measureId"; - public QualityMeasureIdDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/QualitySectionDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/QualitySectionDecoder.java index bea1e0b18..cd46e78d5 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/QualitySectionDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/QualitySectionDecoder.java @@ -4,15 +4,14 @@ import gov.cms.qpp.conversion.model.Decoder; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.QUALITY_SECTION; + /** * Decoder to read XML Data for an Quality Section (eCQM). */ @Decoder(TemplateId.MEASURE_SECTION_V5) public class QualitySectionDecoder extends SkeletalSectionDecoder { - protected static final String QUALITY_SECTION = "quality"; - public static final String CATEGORY_SECTION_V5 = "clinicalDocumentV5"; - public QualitySectionDecoder(Context context) { super(context, QUALITY_SECTION); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/ReportingParametersActDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/ReportingParametersActDecoder.java index 0753239ed..f3fbd4a87 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/ReportingParametersActDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/ReportingParametersActDecoder.java @@ -11,17 +11,14 @@ import java.util.function.Consumer; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Decoder to parse Reporting Parameters Act - CMS (V2). */ @Decoder(TemplateId.REPORTING_PARAMETERS_ACT) public class ReportingParametersActDecoder extends QrdaDecoder { - public static final String PERFORMANCE_START = "performanceStart"; - public static final String PERFORMANCE_END = "performanceEnd"; - public static final String PERFORMANCE_YEAR = "performanceYear"; - private static final int YEAR_LAST_INDEX = 4; - public ReportingParametersActDecoder(Context context) { super(context); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalKeyValueDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalKeyValueDecoder.java index 604659fe1..9b5a0a09f 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalKeyValueDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalKeyValueDecoder.java @@ -10,6 +10,9 @@ import org.jdom2.Element; import org.jdom2.filter.Filters; +import static gov.cms.qpp.conversion.model.Constants.CATEGORY_SECTION_V5; +import static gov.cms.qpp.conversion.model.Constants.QUALITY_SECTION; + /** * {@link QrdaDecoder} that adds a {@link String} key/value pair to the {@link Node} */ @@ -39,7 +42,7 @@ public SkeletalKeyValueDecoder(Context context, String key, String value) { @Override protected DecodeResult decode(Element element, Node thisNode) { thisNode.putValue(key, value); - if (QualitySectionDecoder.QUALITY_SECTION.equalsIgnoreCase(value)){ + if (QUALITY_SECTION.equalsIgnoreCase(value)){ setCategorySectionOnNode(element, thisNode); } return DecodeResult.TREE_CONTINUE; @@ -47,8 +50,8 @@ protected DecodeResult decode(Element element, Node thisNode) { private void setCategorySectionOnNode(Element element, Node thisNode) { Consumer consumer = p -> - thisNode.putValue(QualitySectionDecoder.CATEGORY_SECTION_V5, p.getValue()); - setOnNode(element, getXpath(QualitySectionDecoder.CATEGORY_SECTION_V5), + thisNode.putValue(CATEGORY_SECTION_V5, p.getValue()); + setOnNode(element, getXpath(CATEGORY_SECTION_V5), consumer, Filters.attribute(), true); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSectionDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSectionDecoder.java index 566b3e3fd..be8b0486a 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSectionDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSectionDecoder.java @@ -2,16 +2,13 @@ import gov.cms.qpp.conversion.Context; +import static gov.cms.qpp.conversion.model.Constants.CATEGORY; + /** * {@link SkeletalSectionDecoder} that uses the key {@code category} */ public abstract class SkeletalSectionDecoder extends SkeletalKeyValueDecoder { - /** - * {@code category} the key used by the {@link SkeletalSectionDecoder} - */ - public static final String CATEGORY = "category"; - /** * @param context * @param category the value for the {@code category} key diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSupplementalDataDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSupplementalDataDecoder.java index 6837c1125..bcc24d226 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSupplementalDataDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/SkeletalSupplementalDataDecoder.java @@ -12,15 +12,13 @@ import org.jdom2.Element; import org.jdom2.filter.Filters; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * {@link QrdaDecoder} abstraction for decoding supplemental data */ public abstract class SkeletalSupplementalDataDecoder extends QrdaDecoder { - public static final String SUPPLEMENTAL_DATA_CODE = "code"; - public static final String SUPPLEMENTAL_DATA_KEY = "supplementalData"; - public static final String SUPPLEMENTAL_DATA_PAYER_CODE = "payerCode"; - private final SupplementalType type; /** diff --git a/converter/src/main/java/gov/cms/qpp/conversion/decode/StratifierDecoder.java b/converter/src/main/java/gov/cms/qpp/conversion/decode/StratifierDecoder.java index 342250e1c..ac840e0d4 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/decode/StratifierDecoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/decode/StratifierDecoder.java @@ -1,6 +1,7 @@ package gov.cms.qpp.conversion.decode; +import gov.cms.qpp.conversion.model.Constants; import org.jdom2.Attribute; import org.jdom2.Element; import org.jdom2.filter.Filters; @@ -18,7 +19,7 @@ @Decoder(TemplateId.REPORTING_STRATUM_CMS) public class StratifierDecoder extends QrdaDecoder { - public static final String STRATIFIER_ID = "populationId"; + public static final String STRATIFIER_ID = Constants.MEASURE_POPULATION; public StratifierDecoder(Context context) { super(context); diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/AggregateCountEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/AggregateCountEncoder.java index aa2848970..4ec123433 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/AggregateCountEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/AggregateCountEncoder.java @@ -1,11 +1,13 @@ package gov.cms.qpp.conversion.encode; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.VALUE; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; + /** * Encoder to serialize an Aggregate Count value type. * @@ -27,6 +29,6 @@ public AggregateCountEncoder(Context context) { @Override protected void internalEncode(JsonWrapper wrapper, Node node) { // simply writes the value in the Node - wrapper.putInteger(VALUE, node.getValue(AggregateCountDecoder.AGGREGATE_COUNT)); + wrapper.putInteger(VALUE, node.getValue(AGGREGATE_COUNT)); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoder.java index d57c9b977..402ec434b 100755 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoder.java @@ -5,12 +5,12 @@ import org.slf4j.LoggerFactory; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.Program; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.*; import java.util.LinkedHashMap; import java.util.Locale; @@ -26,8 +26,6 @@ public class ClinicalDocumentEncoder extends QppOutputEncoder { private static final Logger DEV_LOG = LoggerFactory.getLogger(ClinicalDocumentEncoder.class); - private static final String MEASUREMENT_SETS = "measurementSets"; - private static final String SUBMISSION = "submission"; public ClinicalDocumentEncoder(Context context) { super(context); @@ -56,32 +54,32 @@ public void internalEncode(JsonWrapper wrapper, Node thisNode) { * @param thisNode holds the decoded node sections of clinical document */ private void encodeToplevel(JsonWrapper wrapper, Node thisNode) { - String entityType = thisNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE); + String entityType = thisNode.getValue(ENTITY_TYPE); encodePerformanceYear(wrapper, thisNode); - wrapper.put(ClinicalDocumentDecoder.ENTITY_TYPE, entityType); - if (!ClinicalDocumentDecoder.ENTITY_APM.equals(entityType) - && !ClinicalDocumentDecoder.ENTITY_SUBGROUP.equalsIgnoreCase(entityType)) { - wrapper.put(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, - thisNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)); - wrapper.put(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, - thisNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)); + wrapper.put(ENTITY_TYPE, entityType); + if (!ENTITY_APM.equals(entityType) + && !ENTITY_SUBGROUP.equalsIgnoreCase(entityType)) { + wrapper.put(NATIONAL_PROVIDER_IDENTIFIER, + thisNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)); + wrapper.put(TAX_PAYER_IDENTIFICATION_NUMBER, + thisNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)); } if (Program.isPcf(thisNode)) { - wrapper.put(ClinicalDocumentDecoder.ENTITY_ID, thisNode.getValue(ClinicalDocumentDecoder.PCF_ENTITY_ID)); + wrapper.put(ENTITY_ID, thisNode.getValue(PCF_ENTITY_ID)); } - if (ClinicalDocumentDecoder.ENTITY_VIRTUAL_GROUP.equals(entityType)) { - wrapper.put(ClinicalDocumentDecoder.ENTITY_ID, thisNode.getValue(ClinicalDocumentDecoder.ENTITY_ID)); + if (ENTITY_VIRTUAL_GROUP.equals(entityType)) { + wrapper.put(ENTITY_ID, thisNode.getValue(ENTITY_ID)); } if ((Program.isApp(thisNode) || Program.isMips(thisNode) && - ClinicalDocumentDecoder.ENTITY_APM.equalsIgnoreCase(entityType))) { - wrapper.put(ClinicalDocumentDecoder.ENTITY_ID, thisNode.getValue(ClinicalDocumentDecoder.ENTITY_ID)); + ENTITY_APM.equalsIgnoreCase(entityType))) { + wrapper.put(ENTITY_ID, thisNode.getValue(ENTITY_ID)); } - if (ClinicalDocumentDecoder.ENTITY_SUBGROUP.equalsIgnoreCase(entityType)) { - wrapper.put(ClinicalDocumentDecoder.ENTITY_ID, thisNode.getValue(ClinicalDocumentDecoder.SUBGROUP_ID)); + if (ENTITY_SUBGROUP.equalsIgnoreCase(entityType)) { + wrapper.put(ENTITY_ID, thisNode.getValue(SUBGROUP_ID)); } } @@ -97,9 +95,9 @@ private void encodePerformanceYear(JsonWrapper wrapper, Node node) { DEV_LOG.error("Missing Reporting Parameters in node hierarchy"); return; } - String start = reportingDescendant.getValue(ReportingParametersActDecoder.PERFORMANCE_YEAR); - wrapper.putInteger(ReportingParametersActDecoder.PERFORMANCE_YEAR, start); - maintainContinuity(wrapper, reportingDescendant, ReportingParametersActDecoder.PERFORMANCE_YEAR); + String start = reportingDescendant.getValue(PERFORMANCE_YEAR); + wrapper.putInteger(PERFORMANCE_YEAR, start); + maintainContinuity(wrapper, reportingDescendant, PERFORMANCE_YEAR); } /** @@ -125,19 +123,19 @@ private JsonWrapper encodeMeasurementSets(Map childMapByTempla sectionEncoder.encode(childWrapper, child); childWrapper.put("source", "qrda3"); - String mvpId = currentNode.getValue(ClinicalDocumentDecoder.MVP_ID); + String mvpId = currentNode.getValue(MVP_ID); if (TemplateId.MEASURE_SECTION_V5.getRoot().equalsIgnoreCase(childType.getRoot()) && !StringUtils.isEmpty(mvpId)) { - childWrapper.put(ClinicalDocumentDecoder.PROGRAM_NAME, mvpId); + childWrapper.put(PROGRAM_NAME, mvpId); } else if (TemplateId.MEASURE_SECTION_V5.getRoot().equalsIgnoreCase(childType.getRoot()) - && ClinicalDocumentDecoder.MIPS_APM.equalsIgnoreCase( - currentNode.getValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME))) { - childWrapper.put(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.MIPS.toLowerCase(Locale.getDefault())); + && MIPS_APM.equalsIgnoreCase( + currentNode.getValue(RAW_PROGRAM_NAME))) { + childWrapper.put(PROGRAM_NAME, MIPS.toLowerCase(Locale.getDefault())); } else if (TemplateId.MEASURE_SECTION_V5.getRoot().equalsIgnoreCase(childType.getRoot()) - && ClinicalDocumentDecoder.APP_APM.equalsIgnoreCase( - currentNode.getValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME))) { - childWrapper.put(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.APP_PROGRAM_NAME.toLowerCase(Locale.getDefault())); + && APP_APM.equalsIgnoreCase( + currentNode.getValue(RAW_PROGRAM_NAME))) { + childWrapper.put(PROGRAM_NAME, APP_PROGRAM_NAME.toLowerCase(Locale.getDefault())); } measurementSetsWrapper.put(childWrapper); diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/IaMeasureEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/IaMeasureEncoder.java index 4ba0932af..60f18b1c7 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/IaMeasureEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/IaMeasureEncoder.java @@ -4,6 +4,7 @@ import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.VALUE; /** * Encoder to serialize Improvement Activity Performed Measure Reference and Results diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasureDataEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasureDataEncoder.java index 1b828f90d..cf063adbe 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasureDataEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasureDataEncoder.java @@ -1,15 +1,13 @@ package gov.cms.qpp.conversion.encode; import gov.cms.qpp.conversion.Context; +import gov.cms.qpp.conversion.model.Constants; import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.validation.SubPopulationLabel; import gov.cms.qpp.conversion.util.SubPopulationHelper; -import static gov.cms.qpp.conversion.decode.AggregateCountDecoder.AGGREGATE_COUNT; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_TYPE; - /** * Encoder for CMS V2 Measure Data */ @@ -29,13 +27,13 @@ public MeasureDataEncoder(Context context) { */ @Override protected void internalEncode(JsonWrapper wrapper, Node node) { - if (!SubPopulationLabel.IPOP.hasAlias(node.getValue(MEASURE_TYPE)) && - !SubPopulationLabel.NUMEX.hasAlias(node.getValue(MEASURE_TYPE))) { - String measureType = node.getValue(MEASURE_TYPE); + if (!SubPopulationLabel.IPOP.hasAlias(node.getValue(Constants.MEASURE_TYPE)) && + !SubPopulationLabel.NUMEX.hasAlias(node.getValue(Constants.MEASURE_TYPE))) { + String measureType = node.getValue(Constants.MEASURE_TYPE); Node aggCount = node.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); String encodeLabel = SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.findPopulation(measureType)); - wrapper.putInteger(encodeLabel, aggCount.getValue(AGGREGATE_COUNT)); + wrapper.putInteger(encodeLabel, aggCount.getValue(Constants.AGGREGATE_COUNT)); maintainContinuity(wrapper, aggCount, encodeLabel); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasurePerformedEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasurePerformedEncoder.java index 669229401..c195575ea 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasurePerformedEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/MeasurePerformedEncoder.java @@ -5,6 +5,8 @@ import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.VALUE; + /** * Encoder to serialize IA Section measures performed. */ diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiMeasurePerformedRnREncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiMeasurePerformedRnREncoder.java index 43c94f4a2..d2a8ac493 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiMeasurePerformedRnREncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiMeasurePerformedRnREncoder.java @@ -5,6 +5,8 @@ import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.VALUE; + @Encoder(TemplateId.PI_MEASURE_PERFORMED_REFERENCE_AND_RESULTS) public class PiMeasurePerformedRnREncoder extends QppOutputEncoder { diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiNumeratorDenominatorEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiNumeratorDenominatorEncoder.java index 4e948bce0..f6210e67f 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiNumeratorDenominatorEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiNumeratorDenominatorEncoder.java @@ -12,6 +12,8 @@ import java.util.function.Function; import java.util.stream.Collectors; +import static gov.cms.qpp.conversion.model.Constants.VALUE; + /** * Encoder to serialize PI Numerator Denominator Type Measure. */ diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionDenominatorEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionDenominatorEncoder.java index 95d79cf79..64ac789a4 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionDenominatorEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionDenominatorEncoder.java @@ -1,6 +1,7 @@ package gov.cms.qpp.conversion.encode; import gov.cms.qpp.conversion.Context; +import static gov.cms.qpp.conversion.model.Constants.VALUE; import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionNumeratorEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionNumeratorEncoder.java index 78934ba52..ee7da1ac3 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionNumeratorEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiProportionNumeratorEncoder.java @@ -5,6 +5,8 @@ import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; +import static gov.cms.qpp.conversion.model.Constants.VALUE; + /** * Encoder to serialize numerator data from a Numerator/Denominator Type Measure. */ diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiSectionEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiSectionEncoder.java index 473834bbd..dd4d8026a 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/PiSectionEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/PiSectionEncoder.java @@ -5,7 +5,6 @@ import org.slf4j.LoggerFactory; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; @@ -17,6 +16,8 @@ import java.util.List; import java.util.Optional; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Encoder to serialize PI Section and it's measures */ @@ -24,7 +25,6 @@ public class PiSectionEncoder extends QppOutputEncoder { private static final Logger DEV_LOG = LoggerFactory.getLogger(PiSectionEncoder.class); - public static final String SUBMISSION_METHOD = "submissionMethod"; public PiSectionEncoder(Context context) { super(context); @@ -56,7 +56,7 @@ private void encodeTopLevelValues(JsonWrapper wrapper, Node node) { wrapper.put(SUBMISSION_METHOD, "electronicHealthRecord"); Node topLevelParent = node.getParent(); if (TemplateId.PI_SECTION_V3 == node.getType() && (Program.isMips(topLevelParent) || Program.isApp(topLevelParent))) { - wrapper.put(ClinicalDocumentDecoder.CEHRT, node.getParent().getValue(ClinicalDocumentDecoder.CEHRT)); + wrapper.put(CEHRT, node.getParent().getValue(CEHRT)); } } @@ -91,15 +91,15 @@ private void encodeChildren(List children, JsonWrapper measurementsWrapper * @param parent the clinical document node */ private void pilferParent(JsonWrapper wrapper, Node parent) { - String mvpId = parent.getValue(ClinicalDocumentDecoder.MVP_ID); + String mvpId = parent.getValue(MVP_ID); if (StringUtils.isEmpty(mvpId)) { - wrapper.put(ClinicalDocumentDecoder.PROGRAM_NAME, - parent.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)); - maintainContinuity(wrapper, parent, ClinicalDocumentDecoder.PROGRAM_NAME); + wrapper.put(PROGRAM_NAME, + parent.getValue(PROGRAM_NAME)); + maintainContinuity(wrapper, parent, PROGRAM_NAME); } else { - wrapper.put(ClinicalDocumentDecoder.PROGRAM_NAME, - parent.getValue(ClinicalDocumentDecoder.MVP_ID)); - maintainContinuity(wrapper, parent, ClinicalDocumentDecoder.MVP_ID); + wrapper.put(PROGRAM_NAME, + parent.getValue(MVP_ID)); + maintainContinuity(wrapper, parent, MVP_ID); } } @@ -117,7 +117,7 @@ private void encodeReportingParameter(JsonWrapper wrapper, Node node) { return; } reportingParamEncoder.encode(wrapper, reportingChild, false); - maintainContinuity(wrapper, reportingChild, ReportingParametersActDecoder.PERFORMANCE_END); - maintainContinuity(wrapper, reportingChild, ReportingParametersActDecoder.PERFORMANCE_START); + maintainContinuity(wrapper, reportingChild, PERFORMANCE_END); + maintainContinuity(wrapper, reportingChild, PERFORMANCE_START); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/QppOutputEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/QppOutputEncoder.java index f36e0363f..936f1abeb 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/QppOutputEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/QppOutputEncoder.java @@ -12,7 +12,6 @@ */ public class QppOutputEncoder extends JsonOutputEncoder { private static final Logger DEV_LOG = LoggerFactory.getLogger(QppOutputEncoder.class); - public static final String VALUE = "value"; protected final Registry encoders; protected final Context context; diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoder.java index 6b6af3bf1..5676ece0b 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoder.java @@ -1,8 +1,6 @@ package gov.cms.qpp.conversion.encode; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; -import gov.cms.qpp.conversion.decode.MeasureDataDecoder; import gov.cms.qpp.conversion.model.Encoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; @@ -11,29 +9,29 @@ import gov.cms.qpp.conversion.model.validation.SubPopulationLabel; import gov.cms.qpp.conversion.util.MeasureConfigHelper; import gov.cms.qpp.conversion.util.SubPopulationHelper; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_ID; +import static gov.cms.qpp.conversion.model.Constants.SINGLE_PERFORMANCE_RATE; +import static gov.cms.qpp.conversion.model.Constants.TRUE; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_NOT_MET; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_POPULATION; +import static gov.cms.qpp.conversion.model.Constants.STRATUM_FIELD_NAME; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_TYPE; +import static gov.cms.qpp.conversion.model.Constants.IS_END_TO_END_REPORTED; +import static gov.cms.qpp.conversion.model.Constants.DEFAULT_INT_VALUE; +import static gov.cms.qpp.conversion.model.Constants.VALUE; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; + import java.util.List; import java.util.Locale; import java.util.Optional; -import static gov.cms.qpp.conversion.decode.AggregateCountDecoder.AGGREGATE_COUNT; - /** * Encoder to serialize Quality Measure Identifier and Measure Sections */ @Encoder(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5) public class QualityMeasureIdEncoder extends QppOutputEncoder { - private static final String MEASURE_ID = "measureId"; - private static final String SINGLE_PERFORMANCE_RATE = "singlePerformanceRate"; - private static final String TRUE = "true"; - private static final String PERFORMANCE_NOT_MET = "performanceNotMet"; - protected static final String STRATUM_FIELD_NAME = "stratum"; - - public static final String TYPE = "type"; - public static final String IS_END_TO_END_REPORTED = "isEndToEndReported"; - public static final String DEFAULT_INT_VALUE = "0"; - public QualityMeasureIdEncoder(Context context) { super(context); } @@ -121,7 +119,7 @@ private void encodePerformanceNotMetSubPopulationSum(JsonWrapper childWrapper, N private int calculateSubPopulationSum(Node measureReferenceNode, SubPopulationLabel label) { return measureReferenceNode.getChildNodes(TemplateId.MEASURE_DATA_CMS_V4) .filter(childNode -> - label.hasAlias(childNode.getValue(MeasureDataDecoder.MEASURE_TYPE))) + label.hasAlias(childNode.getValue(MEASURE_TYPE))) .mapToInt(ipopNode -> Integer.parseInt(ipopNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AGGREGATE_COUNT))).sum(); } @@ -249,13 +247,13 @@ private void encodeSubPopulation(Node parentNode, JsonWrapper childWrapper, bool * @param parentNode holder of the the numerator node */ private void encodePerformanceMet(JsonWrapper wrapper, Node parentNode) { - Node numeratorNode = parentNode.findChildNode(n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(TYPE))); + Node numeratorNode = parentNode.findChildNode(n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(MEASURE_TYPE))); Optional.ofNullable(numeratorNode).ifPresent( node -> { Node aggCount = node.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); maintainContinuity(wrapper, aggCount, SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.NUMER)); wrapper.putInteger(SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.NUMER), - aggCount.getValue(AggregateCountDecoder.AGGREGATE_COUNT)); + aggCount.getValue(AGGREGATE_COUNT)); }); } @@ -268,12 +266,12 @@ private void encodePerformanceMet(JsonWrapper wrapper, Node parentNode) { * @param measureConfig The measure configuration for the current measure. */ private void encodeStratum(JsonWrapper wrapper, Node parentNode, final MeasureConfig measureConfig) { - Node numeratorNode = parentNode.findChildNode(n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(TYPE))); + Node numeratorNode = parentNode.findChildNode(n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(MEASURE_TYPE))); Optional.ofNullable(numeratorNode).ifPresent( node -> { maintainContinuity(wrapper, node, "stratum"); String numeratorPopulationId = - node.getValue(MeasureDataDecoder.MEASURE_POPULATION).toUpperCase(Locale.ENGLISH); + node.getValue(MEASURE_POPULATION).toUpperCase(Locale.ENGLISH); String stratum = stratumForNumeratorUuid(numeratorPopulationId, measureConfig); wrapper.put(STRATUM_FIELD_NAME, stratum); }); @@ -303,16 +301,16 @@ private String stratumForNumeratorUuid(String numeratorUuid, MeasureConfig measu * @param parentNode holder of the denominator and denominator exclusion nodes */ private void encodePerformanceNotMet(JsonWrapper wrapper, Node parentNode) { - Node numeratorNode = parentNode.findChildNode(n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(TYPE))); - Node denominatorNode = parentNode.findChildNode(n -> SubPopulationLabel.DENOM.hasAlias(n.getValue(TYPE))); - Node denomExclusionNode = parentNode.findChildNode(n -> SubPopulationLabel.DENEX.hasAlias(n.getValue(TYPE))); - Node denomExceptionNode = parentNode.findChildNode(n -> SubPopulationLabel.DENEXCEP.hasAlias(n.getValue(TYPE))); + Node numeratorNode = parentNode.findChildNode(n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(MEASURE_TYPE))); + Node denominatorNode = parentNode.findChildNode(n -> SubPopulationLabel.DENOM.hasAlias(n.getValue(MEASURE_TYPE))); + Node denomExclusionNode = parentNode.findChildNode(n -> SubPopulationLabel.DENEX.hasAlias(n.getValue(MEASURE_TYPE))); + Node denomExceptionNode = parentNode.findChildNode(n -> SubPopulationLabel.DENEXCEP.hasAlias(n.getValue(MEASURE_TYPE))); Optional.ofNullable(denomExclusionNode).ifPresent( node -> { Node aggCount = node.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); maintainContinuity(wrapper, aggCount, SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.DENEX)); - String value = aggCount.getValue(AggregateCountDecoder.AGGREGATE_COUNT); + String value = aggCount.getValue(AGGREGATE_COUNT); wrapper.putInteger(SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.DENEX), value); }); @@ -320,7 +318,7 @@ private void encodePerformanceNotMet(JsonWrapper wrapper, Node parentNode) { node -> { Node aggCount = node.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); maintainContinuity(wrapper, aggCount, SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.DENEXCEP)); - String value = aggCount.getValue(AggregateCountDecoder.AGGREGATE_COUNT); + String value = aggCount.getValue(AGGREGATE_COUNT); wrapper.putInteger(SubPopulationHelper.measureTypeMap.get(SubPopulationLabel.DENEXCEP), value); }); @@ -347,13 +345,13 @@ private String calculatePerformanceNotMet(Node numeratorNode, Node denominatorNo Node denomExclusionNode, Node denomExceptionNode) { String denominatorValue = denominatorNode == null ? "0" : - denominatorNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AggregateCountDecoder.AGGREGATE_COUNT); + denominatorNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AGGREGATE_COUNT); String denomExclusionValue = denomExclusionNode == null ? "0" : - denomExclusionNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AggregateCountDecoder.AGGREGATE_COUNT); + denomExclusionNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AGGREGATE_COUNT); String numeratorValue = numeratorNode == null ? "0" : - numeratorNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AggregateCountDecoder.AGGREGATE_COUNT); + numeratorNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AGGREGATE_COUNT); String denomExceptionValue = denomExceptionNode == null ? "0" : - denomExceptionNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AggregateCountDecoder.AGGREGATE_COUNT); + denomExceptionNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT).getValue(AGGREGATE_COUNT); // for eCQMs, will be equal to denominator - numerator - denominator exclusion - denominator exception return Integer.toString(Integer.parseInt(denominatorValue) diff --git a/converter/src/main/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoder.java b/converter/src/main/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoder.java index d0371edcd..0a8674409 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoder.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoder.java @@ -7,14 +7,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_END; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_START; + /** * Encoder to serialize reporting paramters */ @Encoder(TemplateId.REPORTING_PARAMETERS_ACT) public class ReportingParametersActEncoder extends QppOutputEncoder { - public static final String PERFORMANCE_START = "performanceStart"; - public static final String PERFORMANCE_END = "performanceEnd"; private static final Logger DEV_LOG = LoggerFactory.getLogger(ReportingParametersActEncoder.class); public ReportingParametersActEncoder(Context context) { diff --git a/converter/src/main/java/gov/cms/qpp/conversion/model/Constants.java b/converter/src/main/java/gov/cms/qpp/conversion/model/Constants.java new file mode 100644 index 000000000..5f0864691 --- /dev/null +++ b/converter/src/main/java/gov/cms/qpp/conversion/model/Constants.java @@ -0,0 +1,87 @@ +package gov.cms.qpp.conversion.model; + +import java.util.Set; + +/** + * Constants library for use within the Validate/Encode/Decode packages. + */ +public class Constants { + + public static final String AGGREGATE_COUNT = "aggregateCount"; + public static final String MEASURE_TYPE = "type"; + public static final String MEASURE_ID = "measureId"; + public static final String TEMPLATE_ID = "templateId"; + public static final String PERFORMANCE_NOT_MET = "performanceNotMet"; + public static final String MEASURE_POPULATION = "populationId"; + public static final String STRATUM_FIELD_NAME = "stratum"; + public static final String IS_END_TO_END_REPORTED = "isEndToEndReported"; + public static final String DEFAULT_INT_VALUE = "0"; + public static final String VALUE = "value"; + public static final String CATEGORY_SECTION_V5 = "clinicalDocumentV5"; + public static final String MEASUREMENT_SETS = "measurementSets"; + public static final String QUALITY_SECTION = "quality"; + public static final String SUBMISSION = "submission"; + public static final String SUBMISSION_METHOD = "submissionMethod"; + public static final String PERFORMANCE_START = "performanceStart"; + public static final String PERFORMANCE_END = "performanceEnd"; + public static final String PERFORMANCE_YEAR = "performanceYear"; + public static final String PERFORMANCE_RATE = "rate"; + public static final String NULL_PERFORMANCE_RATE = "nullRate"; + public static final String PERFORMANCE_RATE_ID = "performanceRateUuid"; + public static final String SINGLE_PERFORMANCE_RATE = "singlePerformanceRate"; + public static final String ROOT_STRING = "root"; + public static final String EXTENSION_STRING = "extension"; + public static final String SUPPLEMENTAL_DATA_CODE = "code"; + public static final String SUPPLEMENTAL_DATA_KEY = "supplementalData"; + public static final String SUPPLEMENTAL_DATA_PAYER_CODE = "payerCode"; + public static final String CATEGORY = "category"; + public static final String TRUE = "true"; + public static final int YEAR_LAST_INDEX = 4; + public static final String NOT_VALID_QRDA_III_FORMAT = "The file is not a QRDA-III XML document"; + + /* Constants for lookups and tests */ + // Identifier constants for: Node(Identifier, Value) and xpathlocation + public static final String NATIONAL_PROVIDER_IDENTIFIER = "nationalProviderIdentifier"; + public static final String TAX_PAYER_IDENTIFICATION_NUMBER = "taxpayerIdentificationNumber"; + public static final String PROGRAM_NAME = "programName"; + public static final String ENTITY_TYPE = "entityType"; + public static final String RAW_PROGRAM_NAME = "rawProgramName"; + public static final String PRACTICE_SITE_ADDR = "practiceSiteAddr"; + public static final String PRACTICE_ID = "practiceId"; + public static final String ENTITY_ID = "entityId"; + public static final String PCF_ENTITY_ID = "pcfEntityId"; + public static final String APM_ENTITY_ID = "apmEntityId"; + public static final String VG_ID = "virtualGroupId"; + public static final String CEHRT = "cehrtId"; + public static final String MVP_ID = "mvpId"; + public static final String SUBGROUP_ID = "subgroupId"; + + //QPP Json value constants for: Node(Identifier, value) + public static final String MIPS_PROGRAM_NAME = "mips"; + public static final String PCF_PROGRAM_NAME = "pcf"; + public static final String CPCPLUS_PROGRAM_NAME = "cpcPlus"; + public static final String ENTITY_APM = "apm"; + public static final String ENTITY_GROUP = "group"; + public static final String ENTITY_INDIVIDUAL = "individual"; + public static final String ENTITY_SUBGROUP = "subgroup"; + public static final String ENTITY_VIRTUAL_GROUP = "virtualGroup"; + public static final String APP_PROGRAM_NAME = "app1"; + public static final String MIPS = "MIPS"; + public static final Set MVP_ENTITIES = Set.of(ENTITY_INDIVIDUAL, ENTITY_GROUP, ENTITY_SUBGROUP, ENTITY_APM); + + // Program names in XML format + public static final String PCF = "PCF"; + public static final String APP = "APP"; + public static final String CPCPLUS = "CPCPLUS"; + public static final String MIPS_GROUP = "MIPS_GROUP"; + public static final String MIPS_INDIVIDUAL = "MIPS_INDIV"; + public static final String MIPS_APM = "MIPS_APMENTITY"; + public static final String MIPS_VIRTUAL_GROUP = "MIPS_VIRTUALGROUP"; + public static final String MIPS_SUBGROUP = "MIPS_SUBGROUP"; + public static final String APP_GROUP = "MIPS_APP1_GROUP"; + public static final String APP_INDIVIDUAL = "MIPS_APP1_INDIV"; + public static final String APP_APM = "MIPS_APP1_APMENTITY"; + + // Library utility class so the constructor is private and empty. + private Constants() {} +} diff --git a/converter/src/main/java/gov/cms/qpp/conversion/model/Program.java b/converter/src/main/java/gov/cms/qpp/conversion/model/Program.java index 3e7adf54c..417a39aff 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/model/Program.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/model/Program.java @@ -1,14 +1,14 @@ package gov.cms.qpp.conversion.model; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; - import java.util.Arrays; import java.util.HashSet; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import static gov.cms.qpp.conversion.model.Constants.RAW_PROGRAM_NAME; + /** * Construct that helps categorize submissions by program name. */ @@ -66,7 +66,7 @@ public static boolean isApp(Node node) { * @return program with which node is affiliated */ public static Program extractProgram(Node node) { - return Program.getInstance(node.getValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME)); + return Program.getInstance(node.getValue(RAW_PROGRAM_NAME)); } /** diff --git a/converter/src/main/java/gov/cms/qpp/conversion/util/MeasureConfigHelper.java b/converter/src/main/java/gov/cms/qpp/conversion/util/MeasureConfigHelper.java index 55e00b262..a19df0c13 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/util/MeasureConfigHelper.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/util/MeasureConfigHelper.java @@ -17,6 +17,8 @@ import java.util.stream.IntStream; import java.util.stream.Stream; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_POPULATION; + public class MeasureConfigHelper { public static final String MEASURE_ID = "measureId"; @@ -91,7 +93,7 @@ public static List createSubPopulationGrouping(Node node, MeasureConfig me node.getChildNodes().stream() .filter(childNode -> TemplateId.MEASURE_DATA_CMS_V4 == childNode.getType()) .forEach(childNode -> { - String populationId = childNode.getValue(MeasureDataDecoder.MEASURE_POPULATION); + String populationId = childNode.getValue(MEASURE_POPULATION); Integer subPopIndex = mapPopulationIdToSubPopIndex.get(populationId.toUpperCase(Locale.ENGLISH)); if (subPopIndex != null) { Node newParentNode = subPopNodes.get(subPopIndex); diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/AggregateCountValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/AggregateCountValidator.java index f6315cd52..4df8793e1 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/AggregateCountValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/AggregateCountValidator.java @@ -1,12 +1,13 @@ package gov.cms.qpp.conversion.validate; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.Validator; import gov.cms.qpp.conversion.model.error.ProblemCode; import gov.cms.qpp.conversion.util.DuplicationCheckHelper; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; + /** * Validates Aggregate Count */ @@ -28,9 +29,9 @@ protected void performValidation(Node node) { checkErrors(node) .singleValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_SINGULAR .format(node.getParent().getType().name(), - DuplicationCheckHelper.calculateDuplications(node, AggregateCountDecoder.AGGREGATE_COUNT)), - AggregateCountDecoder.AGGREGATE_COUNT) - .intValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, AggregateCountDecoder.AGGREGATE_COUNT); + DuplicationCheckHelper.calculateDuplications(node, AGGREGATE_COUNT)), + AGGREGATE_COUNT) + .intValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, AGGREGATE_COUNT); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidator.java index 36701bf78..a8d1c2e49 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidator.java @@ -2,7 +2,6 @@ import java.util.Optional; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.Program; import gov.cms.qpp.conversion.model.TemplateId; @@ -11,6 +10,8 @@ import gov.cms.qpp.conversion.model.error.ProblemCode; import gov.cms.qpp.conversion.util.StringHelper; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Validates the Clinical Document. */ @@ -45,18 +46,17 @@ protected void performValidation(final Node node) { .childMaximum(ProblemCode.CLINICAL_DOCUMENT_CONTAINS_DUPLICATE_IA_SECTIONS, 1, TemplateId.MEASURE_SECTION_V5) .singleValue(ProblemCode.CLINICAL_DOCUMENT_MISSING_PROGRAM_NAME.format(VALID_PROGRAM_NAMES), - ClinicalDocumentDecoder.PROGRAM_NAME); + PROGRAM_NAME); if (!containsError(Detail.forProblemAndNode(ProblemCode.CLINICAL_DOCUMENT_MISSING_PROGRAM_NAME.format(VALID_PROGRAM_NAMES), node))) { - String programName = Optional.ofNullable(node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)).orElse(""); - String entityType = Optional.ofNullable(node.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)).orElse(""); + String programName = Optional.ofNullable(node.getValue(PROGRAM_NAME)).orElse(""); + String entityType = Optional.ofNullable(node.getValue(ENTITY_TYPE)).orElse(""); forceCheckErrors(node).valueIn(ProblemCode.CLINICAL_DOCUMENT_INCORRECT_PROGRAM_NAME.format(programName, VALID_PROGRAM_NAMES), - ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.MIPS_PROGRAM_NAME, ClinicalDocumentDecoder.PCF, - ClinicalDocumentDecoder.APP_PROGRAM_NAME); + PROGRAM_NAME, MIPS_PROGRAM_NAME, PCF, APP_PROGRAM_NAME); - if (ClinicalDocumentDecoder.ENTITY_VIRTUAL_GROUP.equals(entityType)) { - forceCheckErrors(node).value(ProblemCode.VIRTUAL_GROUP_ID_REQUIRED, ClinicalDocumentDecoder.ENTITY_ID); + if (ENTITY_VIRTUAL_GROUP.equals(entityType)) { + forceCheckErrors(node).value(ProblemCode.VIRTUAL_GROUP_ID_REQUIRED, ENTITY_ID); } } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/CommonNumeratorDenominatorValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/CommonNumeratorDenominatorValidator.java index e023c8890..b3f594cc2 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/CommonNumeratorDenominatorValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/CommonNumeratorDenominatorValidator.java @@ -1,11 +1,12 @@ package gov.cms.qpp.conversion.validate; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.ProblemCode; import gov.cms.qpp.conversion.model.error.LocalizedProblem; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; + /** * Super class for AciNumeratorValidator and AciDenominatorValidator classes * Factored out common functionality @@ -40,15 +41,15 @@ protected void performValidation(Node node) { * @param aggregateCountNode aggregate count node */ private void validateAggregateCount(Node aggregateCountNode) { - String aggregateCountValue = aggregateCountNode.getValue(AggregateCountDecoder.AGGREGATE_COUNT); + String aggregateCountValue = aggregateCountNode.getValue(AGGREGATE_COUNT); if (aggregateCountValue == null) { aggregateCountValue = "empty"; } checkErrors(aggregateCountNode) .singleValue(format(ProblemCode.NUMERATOR_DENOMINATOR_INVALID_VALUE, aggregateCountValue), - AggregateCountDecoder.AGGREGATE_COUNT) + AGGREGATE_COUNT) .intValue(format(ProblemCode.NUMERATOR_DENOMINATOR_MUST_BE_INTEGER, aggregateCountValue), - AggregateCountDecoder.AGGREGATE_COUNT) + AGGREGATE_COUNT) .greaterThan(format(ProblemCode.NUMERATOR_DENOMINATOR_INVALID_VALUE, aggregateCountValue), -1); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/MeasureDataValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/MeasureDataValidator.java index 9c54f798f..7616c5124 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/MeasureDataValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/MeasureDataValidator.java @@ -1,14 +1,15 @@ package gov.cms.qpp.conversion.validate; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; -import gov.cms.qpp.conversion.decode.MeasureDataDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.Validator; import gov.cms.qpp.conversion.model.error.ProblemCode; import gov.cms.qpp.conversion.util.DuplicationCheckHelper; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_POPULATION; + /** * Validates Measure Data - an Aggregate Count child @@ -30,7 +31,7 @@ public class MeasureDataValidator extends NodeValidator { */ @Override protected void performValidation(Node node) { - String populationId = node.getValue(MeasureDataDecoder.MEASURE_POPULATION); + String populationId = node.getValue(MEASURE_POPULATION); if (populationId == null) { populationId = EMPTY_POPULATION_ID; } @@ -44,9 +45,9 @@ protected void performValidation(Node node) { Node child = node.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); checkErrors(child) .singleValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_SINGULAR.format(node.getType().name(), - DuplicationCheckHelper.calculateDuplications(child, AggregateCountDecoder.AGGREGATE_COUNT)), - AggregateCountDecoder.AGGREGATE_COUNT) - .intValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, AggregateCountDecoder.AGGREGATE_COUNT) + DuplicationCheckHelper.calculateDuplications(child, AGGREGATE_COUNT)), + AGGREGATE_COUNT) + .intValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, AGGREGATE_COUNT) .greaterThan(ProblemCode.MEASURE_DATA_VALUE_NOT_INTEGER.format(populationId, Context.REPORTING_YEAR), -1); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/MipsQualityMeasureIdValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/MipsQualityMeasureIdValidator.java index de511a7ab..ff5940d61 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/MipsQualityMeasureIdValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/MipsQualityMeasureIdValidator.java @@ -22,7 +22,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import static gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_RATE_ID; /** * Validates a Measure Reference Results node. diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidator.java index 4b479e28f..907a3d5cf 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidator.java @@ -2,7 +2,6 @@ import gov.cms.qpp.conversion.Context; import gov.cms.qpp.conversion.correlation.PathCorrelator; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.Program; import gov.cms.qpp.conversion.model.TemplateId; @@ -31,6 +30,8 @@ import java.util.function.Predicate; import java.util.stream.Collectors; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Validates the Clinical Document level node for the given program: PCF @@ -83,32 +84,32 @@ public PcfClinicalDocumentValidator(Context context) { @Override protected void performValidation(Node node) { validateSubmissionDate(node); - String programName = node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME).toUpperCase(Locale.ROOT); + String programName = node.getValue(PROGRAM_NAME).toUpperCase(Locale.ROOT); LocalizedProblem addressError = ProblemCode.PCF_CLINICAL_DOCUMENT_MISSING_PRACTICE_SITE_ADDRESS .format(Context.REPORTING_YEAR); checkErrors(node) .valueIsNotEmpty(ProblemCode.PCF_TIN_REQUIRED.format(programName), - ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER) + TAX_PAYER_IDENTIFICATION_NUMBER) .listValuesAreValid( ProblemCode.PCF_INVALID_TIN.format(programName), - ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, 9) + TAX_PAYER_IDENTIFICATION_NUMBER, 9) .valueIsNotEmpty(ProblemCode.PCF_NPI_REQUIRED.format(programName), - ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER) + NATIONAL_PROVIDER_IDENTIFIER) .listValuesAreValid( ProblemCode.PCF_INVALID_NPI.format(programName), - ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, 10) - .value(addressError, ClinicalDocumentDecoder.PRACTICE_SITE_ADDR) + NATIONAL_PROVIDER_IDENTIFIER, 10) + .value(addressError, PRACTICE_SITE_ADDR) .childMinimum(ProblemCode.PCF_CLINICAL_DOCUMENT_ONE_MEASURE_SECTION_REQUIRED, 1, TemplateId.MEASURE_SECTION_V5) - .singleValue(ProblemCode.PCF_CLINICAL_DOCUMENT_ONLY_ONE_APM_ALLOWED, ClinicalDocumentDecoder.PCF_ENTITY_ID) - .valueIsNotEmpty(ProblemCode.PCF_CLINICAL_DOCUMENT_EMPTY_APM, ClinicalDocumentDecoder.PCF_ENTITY_ID) + .singleValue(ProblemCode.PCF_CLINICAL_DOCUMENT_ONLY_ONE_APM_ALLOWED, PCF_ENTITY_ID) + .valueIsNotEmpty(ProblemCode.PCF_CLINICAL_DOCUMENT_EMPTY_APM, PCF_ENTITY_ID) .childExact(ProblemCode.PCF_NO_PI, 0, TemplateId.PI_SECTION_V3) - .listValuesAreInts(ProblemCode.PCF_INVALID_NPI.format(node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)), - ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER); + .listValuesAreInts(ProblemCode.PCF_INVALID_NPI.format(node.getValue(PROGRAM_NAME)), + NATIONAL_PROVIDER_IDENTIFIER); - validateApmEntityId(node, ClinicalDocumentDecoder.PCF_ENTITY_ID, false); + validateApmEntityId(node, PCF_ENTITY_ID, false); checkWarnings(node) .doesNotHaveChildren(ProblemCode.PCF_NO_IA_OR_PI.format(programName), TemplateId.IA_SECTION_V3, TemplateId.PI_SECTION_V3); @@ -153,8 +154,8 @@ protected void validateApmEntityId(Node node, String key, boolean cpcPlus) { * @return */ private boolean hasTinAndNpi(final Node node) { - return null != node.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER) && - null != node.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER); + return null != node.getValue(NATIONAL_PROVIDER_IDENTIFIER) && + null != node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER); } /** @@ -164,14 +165,14 @@ private boolean hasTinAndNpi(final Node node) { */ private void validateNumberOfTinsAndNpis(final Node node, final String programName) { int numOfTins = Arrays.asList( - node.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER).split(",")).size(); + node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(",")).size(); int numOfNpis = Arrays.asList( - node.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER).split(",")).size(); + node.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(",")).size(); if (numOfTins > numOfNpis) { addError(Detail.forProblemAndNode(ProblemCode.PCF_MISSING_NPI.format(programName), node)); } else if (numOfNpis > numOfTins) { addError(Detail.forProblemAndNode(ProblemCode.PCF_MISSING_TIN - .format(node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)), node)); + .format(node.getValue(PROGRAM_NAME)), node)); } } @@ -180,11 +181,11 @@ private void validateApmNpiCombination(Node node) { } private void validateCehrtId(Node node, String programName) { - String cehrtId = node.getValue(ClinicalDocumentDecoder.CEHRT); + String cehrtId = node.getValue(CEHRT); if(cehrtId == null || cehrtId.length() != 15 || !cehrtFormat(cehrtId.substring(2, 5))) { addError(Detail.forProblemAndNode(ProblemCode.PCF_MISSING_CEHRT_ID.format(programName), node)); } - List duplicateCehrts = node.getDuplicateValues(ClinicalDocumentDecoder.CEHRT); + List duplicateCehrts = node.getDuplicateValues(CEHRT); if (duplicateCehrts != null && duplicateCehrts.size() > 0) { addError(Detail.forProblemAndNode(ProblemCode.PCF_DUPLICATE_CEHRT, node)); } @@ -203,7 +204,7 @@ private void validateSubmissionDate(Node node) { ZonedDateTime endDate = endDate(); if (now().isAfter(endDate)) { String formatted = endDate.format(OUTPUT_END_DATE_FORMAT); - String program = node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME); + String program = node.getValue(PROGRAM_NAME); addError(Detail.forProblemAndNode( ProblemCode.PCF_SUBMISSION_ENDED.format(program, program, formatted, program, program, EnvironmentHelper.getOrDefault(CPC_PLUS_CONTACT_EMAIL, DEFAULT_CPC_PLUS_CONTACT_EMAIL)), diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfMeasureDataValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfMeasureDataValidator.java index 231055f02..ba6d52a11 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfMeasureDataValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfMeasureDataValidator.java @@ -18,7 +18,8 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import static gov.cms.qpp.conversion.decode.SkeletalSupplementalDataDecoder.SUPPLEMENTAL_DATA_KEY; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_TYPE; +import static gov.cms.qpp.conversion.model.Constants.SUPPLEMENTAL_DATA_KEY; @Validator(value = TemplateId.MEASURE_DATA_CMS_V4, program = Program.PCF) public class PcfMeasureDataValidator extends NodeValidator { @@ -113,7 +114,7 @@ private void addSupplementalValidationError(Node node, SupplementalData suppleme LocalizedProblem error = ProblemCode.PCF_MISSING_SUPPLEMENTAL_CODE.format( supplementalData.getType(), supplementalData, supplementalData.getCode(), - measureId, node.getValue(MeasureDataDecoder.MEASURE_TYPE)); + measureId, node.getValue(MEASURE_TYPE)); addError(Detail.forProblemAndNode(error, node)); } @@ -127,7 +128,7 @@ private void addSupplementalValidationError(Node node, SupplementalData suppleme */ private LocalizedProblem makeIncorrectCountSizeLocalizedError(Node node, String supplementalCode, String measureId) { return ProblemCode.PCF_SUPPLEMENTAL_DATA_MISSING_COUNT.format( - supplementalCode, node.getValue(MeasureDataDecoder.MEASURE_TYPE), + supplementalCode, node.getValue(MEASURE_TYPE), measureId); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidation.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidation.java index 3ce83bef6..65a2e6068 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidation.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidation.java @@ -1,8 +1,6 @@ package gov.cms.qpp.conversion.validate; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.Program; import gov.cms.qpp.conversion.model.TemplateId; @@ -12,6 +10,8 @@ import java.util.Locale; +import static gov.cms.qpp.conversion.model.Constants.*; + @Validator(value = TemplateId.REPORTING_PARAMETERS_ACT, program = Program.PCF) public class PcfPerformancePeriodValidation extends NodeValidator { @@ -26,12 +26,12 @@ public class PcfPerformancePeriodValidation extends NodeValidator { @Override protected void performValidation(Node node) { Node clinicalDocument = NodeHelper.findParent(node, TemplateId.CLINICAL_DOCUMENT); - String programName = clinicalDocument.getValue(ClinicalDocumentDecoder.PROGRAM_NAME).toUpperCase(Locale.ROOT); + String programName = clinicalDocument.getValue(PROGRAM_NAME).toUpperCase(Locale.ROOT); checkErrors(node) .valueIs(ProblemCode.PCF_PERFORMANCE_PERIOD_START.format(programName), - ReportingParametersActDecoder.PERFORMANCE_START, REPORTING_PERIOD_START) + PERFORMANCE_START, REPORTING_PERIOD_START) .valueIs(ProblemCode.PCF_PERFORMANCE_PERIOD_END.format(programName), - ReportingParametersActDecoder.PERFORMANCE_END, REPORTING_PERIOD_END); + PERFORMANCE_END, REPORTING_PERIOD_END); } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidator.java index c3c3d4f5d..a17b8aac4 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidator.java @@ -1,14 +1,8 @@ package gov.cms.qpp.conversion.validate; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; -import gov.cms.qpp.conversion.decode.MeasureDataDecoder; import gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder; import gov.cms.qpp.conversion.decode.StratifierDecoder; -import gov.cms.qpp.conversion.encode.QualityMeasureIdEncoder; -import gov.cms.qpp.conversion.model.Node; -import gov.cms.qpp.conversion.model.Program; -import gov.cms.qpp.conversion.model.TemplateId; -import gov.cms.qpp.conversion.model.Validator; +import gov.cms.qpp.conversion.model.*; import gov.cms.qpp.conversion.model.error.Detail; import gov.cms.qpp.conversion.model.error.LocalizedProblem; import gov.cms.qpp.conversion.model.error.ProblemCode; @@ -25,8 +19,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION; -import static gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID; +import static gov.cms.qpp.conversion.model.Constants.*; @Validator(value = TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5, program = Program.PCF) public class PcfQualityMeasureIdValidator extends QualityMeasureIdValidator { @@ -61,17 +54,17 @@ protected void performValidation(Node node) { List subPopNodes = MeasureConfigHelper.createSubPopulationGrouping(node, measureConfig); for (Node subpopulationNode: subPopNodes) { Node numeratorNode = subpopulationNode.findChildNode( - n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(QualityMeasureIdEncoder.TYPE))); + n -> SubPopulationLabel.NUMER.hasAlias(n.getValue(MEASURE_TYPE))); Node denominatorNode = subpopulationNode.findChildNode( - n -> SubPopulationLabel.DENOM.hasAlias(n.getValue(QualityMeasureIdEncoder.TYPE))); + n -> SubPopulationLabel.DENOM.hasAlias(n.getValue(MEASURE_TYPE))); Node denomExclusionNode = subpopulationNode.findChildNode( - n -> SubPopulationLabel.DENEX.hasAlias(n.getValue(QualityMeasureIdEncoder.TYPE))); + n -> SubPopulationLabel.DENEX.hasAlias(n.getValue(MEASURE_TYPE))); Node denomExceptionNode = subpopulationNode.findChildNode( - n -> SubPopulationLabel.DENEXCEP.hasAlias(n.getValue(QualityMeasureIdEncoder.TYPE))); + n -> SubPopulationLabel.DENEXCEP.hasAlias(n.getValue(MEASURE_TYPE))); Node performanceRateNode = node.getChildNodes(n -> TemplateId.PERFORMANCE_RATE_PROPORTION_MEASURE.equals(n.getType())) .filter(n -> numeratorNode.getValue(MEASURE_POPULATION).equalsIgnoreCase - (n.getValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID))) + (n.getValue(PERFORMANCE_RATE_ID))) .findFirst() .orElse(null); @@ -100,14 +93,14 @@ protected void performValidation(Node node) { //skip if performance rate is missing if (null != performanceRateNode) { String performanceRateValue = - performanceRateNode.getValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE); + performanceRateNode.getValue(PERFORMANCE_RATE); if (PerformanceRateValidator.NULL_ATTRIBUTE.equals( - performanceRateNode.getValue(PerformanceRateProportionMeasureDecoder.NULL_PERFORMANCE_RATE))) { + performanceRateNode.getValue(NULL_PERFORMANCE_RATE))) { if (performanceDenominator != 0) { addError(Detail.forProblemAndNode( ProblemCode.PCF_INVALID_NULL_PERFORMANCE_RATE .format(performanceRateNode - .getValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID), + .getValue(PERFORMANCE_RATE_ID), measureConfig.getElectronicMeasureId()) , node)); } @@ -177,7 +170,7 @@ protected void followUpHook(Node node, SubPopulation sub) { if (strataNodes.size() != sub.getStrata().size()) { LocalizedProblem error = ProblemCode.PCF_QUALITY_MEASURE_ID_STRATA_MISMATCH.format(strataNodes.size(), sub.getStrata().size(), - node.getValue(MeasureDataDecoder.MEASURE_TYPE), + node.getValue(MEASURE_TYPE), node.getValue(MEASURE_POPULATION), sub.getStrata()); addError(Detail.forProblemAndNode(error, node)); @@ -189,7 +182,7 @@ protected void followUpHook(Node node, SubPopulation sub) { if (strataNodes.stream().noneMatch(seek)) { LocalizedProblem error = ProblemCode.PCF_QUALITY_MEASURE_ID_MISSING_STRATA.format(stratum, - node.getValue(MeasureDataDecoder.MEASURE_TYPE), + node.getValue(MEASURE_TYPE), node.getValue(MEASURE_POPULATION)); addError(Detail.forProblemAndNode(error, node)); } @@ -208,7 +201,7 @@ private Integer extractAggregateValue(Node node) { Node aggregate = node.getChildNodes(n -> TemplateId.PI_AGGREGATE_COUNT.equals(n.getType())).findFirst().orElse(null); if (null != aggregate) { - String value = aggregate.getValue(AggregateCountDecoder.AGGREGATE_COUNT); + String value = aggregate.getValue(AGGREGATE_COUNT); if (NumberHelper.isNumeric(value)){ extractedValue = Integer.valueOf(value); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/PerformanceRateValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/PerformanceRateValidator.java index 60b7e4ff6..b7a03cc3f 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/PerformanceRateValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/PerformanceRateValidator.java @@ -1,11 +1,13 @@ package gov.cms.qpp.conversion.validate; -import gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.Validator; import gov.cms.qpp.conversion.model.error.ProblemCode; +import static gov.cms.qpp.conversion.model.Constants.NULL_PERFORMANCE_RATE; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_RATE; + /** * Validates the QRDA Category III Performance Rate Proportion Measure for the cpc+ program */ @@ -21,17 +23,17 @@ public class PerformanceRateValidator extends NodeValidator { */ @Override protected void performValidation(Node node) { - if (!NULL_ATTRIBUTE.equals(node.getValue(PerformanceRateProportionMeasureDecoder.NULL_PERFORMANCE_RATE))) { + if (!NULL_ATTRIBUTE.equals(node.getValue(NULL_PERFORMANCE_RATE))) { Checker checker = checkErrors(node) - .valueIsNotEmpty(ProblemCode.PERFORMANCE_RATE_MISSING, PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE); + .valueIsNotEmpty(ProblemCode.PERFORMANCE_RATE_MISSING, PERFORMANCE_RATE); if (!checker.shouldShortcut()) { - String performanceRate = node.getValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE); + String performanceRate = node.getValue(PERFORMANCE_RATE); checkErrors(node) .inDecimalRangeOf(ProblemCode.PERFORMANCE_RATE_INVALID_VALUE.format(performanceRate), - PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, 0F, 1F); + PERFORMANCE_RATE, 0F, 1F); } } } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/PiSectionValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/PiSectionValidator.java index 3d4dd0be3..37e0ff266 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/PiSectionValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/PiSectionValidator.java @@ -12,7 +12,7 @@ import java.util.Collections; import java.util.Set; -import static gov.cms.qpp.conversion.decode.PiNumeratorDenominatorDecoder.MEASURE_ID; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_ID; /** * Validate the ACI Section. diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidator.java index 861d068a5..fc5d02ee6 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidator.java @@ -5,7 +5,6 @@ import gov.cms.qpp.conversion.Context; import gov.cms.qpp.conversion.decode.AggregateCountDecoder; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -30,8 +29,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_TYPE; +import static gov.cms.qpp.conversion.model.Constants.*; /** * Validates a Measure Reference Results node. @@ -177,15 +175,15 @@ private void validateSubPopulation(Node node, SubPopulation subPopulation, Strin protected void validateDenomCountToIpopCount(Node node, SubPopulation subPopulation, String measureId) { Node denomNode = getDenominatorNodeFromCurrentSubPopulation(node, subPopulation); Node ipopNode = getIpopNodeFromCurrentSubPopulation(node, subPopulation); - String program = node.getParent().getParent().getValue(ClinicalDocumentDecoder.PROGRAM_NAME); + String program = node.getParent().getParent().getValue(PROGRAM_NAME); if (denomNode != null && ipopNode != null) { Node denomCount = denomNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); Node ipopCount = ipopNode.findFirstNode(TemplateId.PI_AGGREGATE_COUNT); - if ((ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME.equalsIgnoreCase(program) + if ((CPCPLUS_PROGRAM_NAME.equalsIgnoreCase(program) && MeasureConfigHelper.CPC_PLUS_MEASURES.contains(measureId)) - || ClinicalDocumentDecoder.PCF_PROGRAM_NAME.equalsIgnoreCase(program)) { + || PCF_PROGRAM_NAME.equalsIgnoreCase(program)) { validateCpcDenominatorCount(denomCount, ipopCount, subPopulation.getDenominatorUuid(), program); } else { validateDenominatorCount(denomCount, ipopCount, subPopulation.getDenominatorUuid()); @@ -231,9 +229,9 @@ private void validateDenominatorCount(Node denomCount, Node ipopCount, String de forceCheckErrors(denomCount) .incompleteValidation() .intValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, - AggregateCountDecoder.AGGREGATE_COUNT) + AGGREGATE_COUNT) .lessThanOrEqualTo(ProblemCode.DENOMINATOR_COUNT_INVALID.format(denominatorUuid, Context.REPORTING_YEAR), - Integer.parseInt(ipopCount.getValue(AggregateCountDecoder.AGGREGATE_COUNT))); + Integer.parseInt(ipopCount.getValue(AGGREGATE_COUNT))); } /** @@ -246,9 +244,9 @@ private void validateCpcDenominatorCount(Node denomCount, Node ipopCount, String forceCheckErrors(denomCount) .incompleteValidation() .intValue(ProblemCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, - AggregateCountDecoder.AGGREGATE_COUNT) - .valueIn(ProblemCode.PCF_DENOMINATOR_COUNT_INVALID.format(program, denominatorUuid, Context.REPORTING_YEAR), AggregateCountDecoder.AGGREGATE_COUNT, - ipopCount.getValue(AggregateCountDecoder.AGGREGATE_COUNT)); + AGGREGATE_COUNT) + .valueIn(ProblemCode.PCF_DENOMINATOR_COUNT_INVALID.format(program, denominatorUuid, Context.REPORTING_YEAR), AGGREGATE_COUNT, + ipopCount.getValue(AGGREGATE_COUNT)); } /** diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidator.java index dfab4e63a..073b31145 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidator.java @@ -1,12 +1,13 @@ package gov.cms.qpp.conversion.validate; -import gov.cms.qpp.conversion.decode.QualityMeasureIdDecoder; -import gov.cms.qpp.conversion.decode.QualitySectionDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.Validator; import gov.cms.qpp.conversion.model.error.ProblemCode; +import static gov.cms.qpp.conversion.model.Constants.CATEGORY_SECTION_V5; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_ID; + /** * Validates a Quality Measure Section node. */ @@ -25,9 +26,9 @@ protected void performValidation(Node node) { TemplateId.REPORTING_PARAMETERS_ACT) .childMinimum(ProblemCode.MEASURE_SECTION_MISSING_MEASURE, 1, TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5) .oneChildPolicy(ProblemCode.MEASURES_RNR_WITH_DUPLICATED_MEASURE_GUID, TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5, - childNode -> childNode.getValue(QualityMeasureIdDecoder.MEASURE_ID)) - .singleValue(ProblemCode.MEASURE_SECTION_V5_REQUIRES_CATEGORY_SECTION, QualitySectionDecoder.CATEGORY_SECTION_V5) - .valueIs(ProblemCode.MEASURE_SECTION_V5_REQUIRES_CATEGORY_SECTION, QualitySectionDecoder.CATEGORY_SECTION_V5, + childNode -> childNode.getValue(MEASURE_ID)) + .singleValue(ProblemCode.MEASURE_SECTION_V5_REQUIRES_CATEGORY_SECTION, CATEGORY_SECTION_V5) + .valueIs(ProblemCode.MEASURE_SECTION_V5_REQUIRES_CATEGORY_SECTION, CATEGORY_SECTION_V5, TemplateId.CATEGORY_REPORT_V5.getExtension()); } diff --git a/converter/src/main/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidator.java b/converter/src/main/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidator.java index dd21e3ef1..0b624272b 100644 --- a/converter/src/main/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidator.java +++ b/converter/src/main/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidator.java @@ -1,10 +1,10 @@ package gov.cms.qpp.conversion.validate; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.Validator; import gov.cms.qpp.conversion.model.error.ProblemCode; +import static gov.cms.qpp.conversion.model.Constants.*; /** * Validates REPORTING_PARAMETERS_ACT nodes. @@ -26,21 +26,21 @@ public class ReportingParametersActValidator extends NodeValidator { */ @Override protected void performValidation(Node node) { - String performanceStart = node.getValueOrDefault(ReportingParametersActDecoder.PERFORMANCE_START, ""); + String performanceStart = node.getValueOrDefault(PERFORMANCE_START, ""); - String performanceEnd = node.getValueOrDefault(ReportingParametersActDecoder.PERFORMANCE_END,""); + String performanceEnd = node.getValueOrDefault(PERFORMANCE_END,""); checkErrors(node) .singleValue(ProblemCode.REPORTING_PARAMETERS_MUST_CONTAIN_SINGLE_PERFORMANCE_START, - ReportingParametersActDecoder.PERFORMANCE_START) + PERFORMANCE_START) .singleValue(ProblemCode.REPORTING_PARAMETERS_MUST_CONTAIN_SINGLE_PERFORMANCE_END, - ReportingParametersActDecoder.PERFORMANCE_END) + PERFORMANCE_END) .value(ProblemCode.REPORTING_PARAMETERS_MISSING_PERFORMANCE_YEAR, - ReportingParametersActDecoder.PERFORMANCE_YEAR) + PERFORMANCE_YEAR) .isValidDate(ProblemCode.INVALID_PERFORMANCE_PERIOD_FORMAT.format( performanceStart), - ReportingParametersActDecoder.PERFORMANCE_START) + PERFORMANCE_START) .isValidDate(ProblemCode.INVALID_PERFORMANCE_PERIOD_FORMAT.format(performanceEnd), - ReportingParametersActDecoder.PERFORMANCE_END); + PERFORMANCE_END); } } diff --git a/converter/src/test/java/gov/cms/qpp/SingularAttributeTest.java b/converter/src/test/java/gov/cms/qpp/SingularAttributeTest.java index 8c44db19e..a9550a0ec 100644 --- a/converter/src/test/java/gov/cms/qpp/SingularAttributeTest.java +++ b/converter/src/test/java/gov/cms/qpp/SingularAttributeTest.java @@ -5,12 +5,6 @@ import gov.cms.qpp.conversion.correlation.PathCorrelator; import gov.cms.qpp.conversion.correlation.model.Goods; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder; -import gov.cms.qpp.conversion.decode.QualitySectionDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; -import gov.cms.qpp.conversion.decode.SupplementalDataEthnicityDecoder; -import gov.cms.qpp.conversion.decode.SupplementalDataPayerDecoder; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; import gov.cms.qpp.conversion.model.error.ProblemCode; @@ -25,6 +19,7 @@ import java.util.Set; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.*; class SingularAttributeTest{ @@ -46,25 +41,25 @@ static void before() throws NoSuchFieldException, IllegalAccessException { exclusions = new HashSet<>( Arrays.asList( //MultipleTinsDecoder maps multiple tin/npi combination - ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, - ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, - ClinicalDocumentDecoder.ENTITY_ID, + TAX_PAYER_IDENTIFICATION_NUMBER, + NATIONAL_PROVIDER_IDENTIFIER, + ENTITY_ID, //There are no validations currently for entity type - ClinicalDocumentDecoder.PRACTICE_ID, - ClinicalDocumentDecoder.PRACTICE_SITE_ADDR, + PRACTICE_ID, + PRACTICE_SITE_ADDR, //We have validations implemented - ClinicalDocumentDecoder.PCF_ENTITY_ID, - ClinicalDocumentDecoder.VG_ID, - ClinicalDocumentDecoder.APM_ENTITY_ID, - ClinicalDocumentDecoder.MVP_ID, - ClinicalDocumentDecoder.SUBGROUP_ID, - PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, - PerformanceRateProportionMeasureDecoder.NULL_PERFORMANCE_RATE, + PCF_ENTITY_ID, + VG_ID, + APM_ENTITY_ID, + MVP_ID, + SUBGROUP_ID, + PERFORMANCE_RATE, + NULL_PERFORMANCE_RATE, //There are no validations for performanceYear - ReportingParametersActDecoder.PERFORMANCE_YEAR, - SupplementalDataEthnicityDecoder.SUPPLEMENTAL_DATA_CODE, - SupplementalDataPayerDecoder.SUPPLEMENTAL_DATA_PAYER_CODE, - QualitySectionDecoder.CATEGORY_SECTION_V5, + PERFORMANCE_YEAR, + SUPPLEMENTAL_DATA_CODE, + SUPPLEMENTAL_DATA_PAYER_CODE, + CATEGORY_SECTION_V5, //stratum is not currently mapped "stratum", "cehrtId", @@ -120,7 +115,7 @@ private int blanketCheck(boolean remove) { @Test void noProgramName() { List details = manipulationHandler.executeScenario(TemplateId.CLINICAL_DOCUMENT.name(), - ClinicalDocumentDecoder.PROGRAM_NAME, true); + PROGRAM_NAME, true); assertWithMessage("error should be about missing program name").that(details) .comparingElementsUsing(DetailsErrorEquals.INSTANCE) diff --git a/converter/src/test/java/gov/cms/qpp/acceptance/MeasureDataRoundTripTest.java b/converter/src/test/java/gov/cms/qpp/acceptance/MeasureDataRoundTripTest.java index 806dda7bf..a3ea968d1 100644 --- a/converter/src/test/java/gov/cms/qpp/acceptance/MeasureDataRoundTripTest.java +++ b/converter/src/test/java/gov/cms/qpp/acceptance/MeasureDataRoundTripTest.java @@ -1,7 +1,7 @@ package gov.cms.qpp.acceptance; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_TYPE; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_TYPE; import java.io.BufferedWriter; import java.io.IOException; diff --git a/converter/src/test/java/gov/cms/qpp/acceptance/NegativePcfRoundTripTest.java b/converter/src/test/java/gov/cms/qpp/acceptance/NegativePcfRoundTripTest.java index 4f0e70a1c..a8559d90a 100644 --- a/converter/src/test/java/gov/cms/qpp/acceptance/NegativePcfRoundTripTest.java +++ b/converter/src/test/java/gov/cms/qpp/acceptance/NegativePcfRoundTripTest.java @@ -9,7 +9,6 @@ import gov.cms.qpp.conversion.Context; import gov.cms.qpp.conversion.Converter; import gov.cms.qpp.conversion.PathSource; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.error.AllErrors; import gov.cms.qpp.conversion.model.error.Detail; import gov.cms.qpp.conversion.model.error.LocalizedProblem; @@ -26,6 +25,7 @@ import java.util.Locale; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.PCF_PROGRAM_NAME; /** @@ -77,7 +77,7 @@ void testPcfInvalidCehrtId() { assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE) .contains(ProblemCode.PCF_MISSING_CEHRT_ID. - format(ClinicalDocumentDecoder.PCF_PROGRAM_NAME.toUpperCase())); + format(PCF_PROGRAM_NAME.toUpperCase())); } @Test @@ -85,10 +85,10 @@ void testPcfInvalidPerformancePeriod() { List details = conversionError(Y5_NEGATIVE_PCF); assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE) - .contains(ProblemCode.PCF_PERFORMANCE_PERIOD_START.format(ClinicalDocumentDecoder.PCF_PROGRAM_NAME.toUpperCase(Locale.ROOT))); + .contains(ProblemCode.PCF_PERFORMANCE_PERIOD_START.format(PCF_PROGRAM_NAME.toUpperCase(Locale.ROOT))); assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE) - .contains(ProblemCode.PCF_PERFORMANCE_PERIOD_END.format(ClinicalDocumentDecoder.PCF_PROGRAM_NAME.toUpperCase(Locale.ROOT))); + .contains(ProblemCode.PCF_PERFORMANCE_PERIOD_END.format(PCF_PROGRAM_NAME.toUpperCase(Locale.ROOT))); } List conversionError(Path path) { diff --git a/converter/src/test/java/gov/cms/qpp/acceptance/PcfRoundTripTest.java b/converter/src/test/java/gov/cms/qpp/acceptance/PcfRoundTripTest.java index a2d9e6e09..b2ba0d47d 100644 --- a/converter/src/test/java/gov/cms/qpp/acceptance/PcfRoundTripTest.java +++ b/converter/src/test/java/gov/cms/qpp/acceptance/PcfRoundTripTest.java @@ -11,7 +11,6 @@ import gov.cms.qpp.acceptance.helper.JsonPathToXpathHelper; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.encode.JsonWrapper; import gov.cms.qpp.conversion.model.validation.ApmEntityIds; import gov.cms.qpp.conversion.model.validation.MeasureConfigs; @@ -24,6 +23,7 @@ import java.util.HashMap; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.ENTITY_APM; /** * Positive Testing Scenarios to check PCF for valid top level attributes and validations @@ -72,6 +72,6 @@ void testEntityId() { @Test void testEntityType() { String entityId = (String) json.get("entityType"); - assertThat(entityId).isEqualTo(ClinicalDocumentDecoder.ENTITY_APM); + assertThat(entityId).isEqualTo(ENTITY_APM); } } diff --git a/converter/src/test/java/gov/cms/qpp/acceptance/QualityMeasureIdRoundTripTest.java b/converter/src/test/java/gov/cms/qpp/acceptance/QualityMeasureIdRoundTripTest.java index 26fd2f6a5..641d901e6 100644 --- a/converter/src/test/java/gov/cms/qpp/acceptance/QualityMeasureIdRoundTripTest.java +++ b/converter/src/test/java/gov/cms/qpp/acceptance/QualityMeasureIdRoundTripTest.java @@ -10,7 +10,6 @@ import gov.cms.qpp.conversion.Context; import gov.cms.qpp.conversion.Converter; import gov.cms.qpp.conversion.PathSource; -import gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder; import gov.cms.qpp.conversion.encode.JsonWrapper; import gov.cms.qpp.conversion.model.error.AllErrors; import gov.cms.qpp.conversion.model.error.Detail; @@ -31,6 +30,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_RATE_ID; class QualityMeasureIdRoundTripTest { static final Path JUNK_QRDA3_FILE = Paths.get("src/test/resources/negative/junk_in_quality_measure.xml"); @@ -106,7 +106,7 @@ void testMeasureCMS68v8PerformanceRateUuid() { .get("40280382-5fa6-fe85-0160-0ea3e0012376").getSubPopulation().get(0).getNumeratorUuid(); LocalizedProblem error = ProblemCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format(measureId, - PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID, correctId); + PERFORMANCE_RATE_ID, correctId); assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE) .contains(error); } diff --git a/converter/src/test/java/gov/cms/qpp/acceptance/helper/JsonPathAggregator.java b/converter/src/test/java/gov/cms/qpp/acceptance/helper/JsonPathAggregator.java index 67823a58d..c951a8535 100644 --- a/converter/src/test/java/gov/cms/qpp/acceptance/helper/JsonPathAggregator.java +++ b/converter/src/test/java/gov/cms/qpp/acceptance/helper/JsonPathAggregator.java @@ -1,8 +1,6 @@ package gov.cms.qpp.acceptance.helper; import gov.cms.qpp.conversion.decode.SkeletalSectionDecoder; -import gov.cms.qpp.conversion.encode.PiSectionEncoder; -import gov.cms.qpp.conversion.encode.QualityMeasureIdEncoder; import java.util.HashMap; import java.util.Map; @@ -10,12 +8,15 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.Sets; +import gov.cms.qpp.conversion.model.Constants; + +import static gov.cms.qpp.conversion.model.Constants.SUBMISSION_METHOD; public class JsonPathAggregator { private Set excluded = Sets.newHashSet( - QualityMeasureIdEncoder.IS_END_TO_END_REPORTED, - SkeletalSectionDecoder.CATEGORY, - PiSectionEncoder.SUBMISSION_METHOD + Constants.IS_END_TO_END_REPORTED, + Constants.CATEGORY, + SUBMISSION_METHOD ); Map jsonPaths = new HashMap<>(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/correlation/PathCorrelatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/correlation/PathCorrelatorTest.java index 9f9820004..68c6134ae 100755 --- a/converter/src/test/java/gov/cms/qpp/conversion/correlation/PathCorrelatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/correlation/PathCorrelatorTest.java @@ -2,12 +2,12 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.PROGRAM_NAME; import java.lang.reflect.Constructor; import org.junit.jupiter.api.Test; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.encode.JsonWrapper; import gov.cms.qpp.conversion.model.TemplateId; @@ -23,7 +23,7 @@ void testPrivateConstructor() throws Exception { @Test void pathCorrelatorInitilization() { String xpath = PathCorrelator.getXpath(TemplateId.CLINICAL_DOCUMENT.name(), - ClinicalDocumentDecoder.PROGRAM_NAME, "meep"); + PROGRAM_NAME, "meep"); assertThat(xpath).isNotNull(); } @@ -31,7 +31,7 @@ void pathCorrelatorInitilization() { void verifyXpathNsSubstitution() { String meep = "meep"; String path = PathCorrelator.getXpath( - TemplateId.CLINICAL_DOCUMENT.name(), ClinicalDocumentDecoder.PROGRAM_NAME, meep); + TemplateId.CLINICAL_DOCUMENT.name(), PROGRAM_NAME, meep); int meepCount = (path.length() - path.replace(meep, "").length()) / meep.length(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoderTest.java index 931ffd76e..fa77af3c9 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/ClinicalDocumentDecoderTest.java @@ -22,6 +22,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.*; class ClinicalDocumentDecoderTest { @@ -57,25 +58,25 @@ void testRootId() { @Test void testRootProgramName() { - assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); + assertThat(clinicalDocument.getValue(PROGRAM_NAME)) + .isEqualTo(MIPS_PROGRAM_NAME); } @Test void testRootNationalProviderIdentifier() { - assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + assertThat(clinicalDocument.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo(TEST_NPI); } @Test void testRootTaxpayerIdentificationNumber() { - assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + assertThat(clinicalDocument.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo(TEST_TIN); } @Test void testRootMvpId() { - assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.MVP_ID)) + assertThat(clinicalDocument.getValue(MVP_ID)) .isEqualTo(TEST_MVP_ID); } @@ -131,10 +132,10 @@ void testClinicalDocumentIgnoresGarbage() throws IOException, XmlException { Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlWithGarbage)); clinicalDocument = root.findFirstNode(TemplateId.CLINICAL_DOCUMENT); - assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); + assertThat(clinicalDocument.getValue(PROGRAM_NAME)) + .isEqualTo(MIPS_PROGRAM_NAME); - assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + assertThat(clinicalDocument.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -156,16 +157,16 @@ void decodeClinicalDocumentInternalDecode() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(MIPS_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_INDIVIDUAL); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_INDIVIDUAL); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo("2567891421"); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -178,16 +179,16 @@ void decodeAppClinicalDocumentInternalDecode() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.APP_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(APP_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_INDIVIDUAL); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_INDIVIDUAL); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo("2567891421"); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -200,16 +201,16 @@ void decodeClinicalDocumentInternalDecodeMIPSIndividual() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(MIPS_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_INDIVIDUAL); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_INDIVIDUAL); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo("2567891421"); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -222,16 +223,16 @@ void decodeClinicalDocumentInternalDecodeMIPSAPPIndividual() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.APP_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(APP_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_INDIVIDUAL); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_INDIVIDUAL); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo("2567891421"); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -244,16 +245,16 @@ void decodeClinicalDocumentInternalDecodeMIPSGroup() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(MIPS_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_GROUP); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_GROUP); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isNull(); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -266,16 +267,16 @@ void decodeClinicalDocumentInternalDecodeMIPSAPPGroup() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.APP_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(APP_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_GROUP); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_GROUP); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isNull(); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @@ -288,131 +289,131 @@ void decodeClinicalDocumentInternalDecodeUnknown() { objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) + .that(testParentNode.getValue(PROGRAM_NAME)) .isEqualTo("unknown"); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) + .that(testParentNode.getValue(ENTITY_TYPE)) .isEqualTo("individual"); assertWithMessage("Clinical Document doesn't contain national provider") - .that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + .that(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo("2567891421"); assertWithMessage("Clinical Document doesn't contain taxpayer id number") - .that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + .that(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); } @Test void decodePcfPracticeSiteAddressTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.PCF_PROGRAM_NAME, false, false); + Element clinicalDocument = makeClinicalDocument(PCF_PROGRAM_NAME, false, false); clinicalDocument.addContent(prepareParticipant(clinicalDocument.getNamespace(), CPC_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document contains the Entity Id") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PRACTICE_SITE_ADDR)) + .that(testParentNode.getValue(PRACTICE_SITE_ADDR)) .isEqualTo("testing123"); } @Test void decodePcfTinTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME, false, false); + Element clinicalDocument = makeClinicalDocument(CPCPLUS_PROGRAM_NAME, false, false); clinicalDocument.addContent( prepareParticipant(clinicalDocument.getNamespace(), CPC_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); List tinNumbers = - Arrays.asList(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); + Arrays.asList(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); tinNumbers.forEach(tinNumber -> assertThat(tinNumber).isNotEmpty()); } @Test void testClinicalDocumentDecodeProgramPcf() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.PCF, false, false); + Element clinicalDocument = makeClinicalDocument(PCF, false, false); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document doesn't contain program name") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)) - .isEqualTo(ClinicalDocumentDecoder.PCF_PROGRAM_NAME); + .that(testParentNode.getValue(PROGRAM_NAME)) + .isEqualTo(PCF_PROGRAM_NAME); assertWithMessage("Clinical Document doesn't contain entity type") - .that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_APM); + .that(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_APM); } @Test void testClinicalDocumentDecodePcfTin() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.PCF, false, false); + Element clinicalDocument = makeClinicalDocument(PCF, false, false); clinicalDocument.addContent( prepareParticipant(clinicalDocument.getNamespace(), CPC_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); List tinNumbers = - Arrays.asList(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); + Arrays.asList(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); tinNumbers.forEach(tinNumber -> assertThat(tinNumber).isNotEmpty()); } @Test void testClinicalDocumentDecodePcfNpi() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.PCF, false, false); + Element clinicalDocument = makeClinicalDocument(PCF, false, false); clinicalDocument.addContent(prepareParticipant(clinicalDocument.getNamespace(), PCF_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); List npiNumbers = - Arrays.asList(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER).split(",")); + Arrays.asList(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(",")); npiNumbers.forEach(npiNumber -> assertThat(npiNumber).isNotEmpty()); } @Test void testClinicalDocumentDecodePcfEntityId() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.PCF, false, false); + Element clinicalDocument = makeClinicalDocument(PCF, false, false); clinicalDocument.addContent(prepareParticipant(clinicalDocument.getNamespace(), PCF_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document contains the Entity Id") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PCF_ENTITY_ID)) + .that(testParentNode.getValue(PCF_ENTITY_ID)) .isEqualTo(ENTITY_ID_VALUE); } @Test void testClinicalDocumentDecodePcfPracticeSiteAddress() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.PCF, false, false); + Element clinicalDocument = makeClinicalDocument(PCF, false, false); clinicalDocument.addContent(prepareParticipant(clinicalDocument.getNamespace(), PCF_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); assertWithMessage("Clinical Document contains the Entity Id") - .that(testParentNode.getValue(ClinicalDocumentDecoder.PRACTICE_SITE_ADDR)) + .that(testParentNode.getValue(PRACTICE_SITE_ADDR)) .isEqualTo("testing123"); } @Test void decodeMipsVirtualGroup() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.MIPS_VIRTUAL_GROUP, false, false); + Element clinicalDocument = makeClinicalDocument(MIPS_VIRTUAL_GROUP, false, false); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_VIRTUAL_GROUP); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_VIRTUAL_GROUP); + assertThat(testParentNode.getValue(ENTITY_ID)) .isEqualTo("x12345"); } @Test void decodeMipsApmTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.MIPS_APM, false, false); + Element clinicalDocument = makeClinicalDocument(MIPS_APM, false, false); clinicalDocument.addContent(prepareParticipant(clinicalDocument.getNamespace(), CPC_PRACTICE_ROOT, ENTITY_ID_VALUE)); Node testParentNode = new Node(); @@ -420,90 +421,90 @@ void decodeMipsApmTest() { objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_APM); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_APM); + assertThat(testParentNode.getValue(ENTITY_ID)) .isEqualTo("TEST_APM"); } @Test void decodeMipsAppApmTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.APP_APM, false, false); + Element clinicalDocument = makeClinicalDocument(APP_APM, false, false); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_APM); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_APM); + assertThat(testParentNode.getValue(ENTITY_ID)) .isEqualTo("TEST_APM"); } @Test void decodeMvpMipsAppApmTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.MIPS_APM, false, true); + Element clinicalDocument = makeClinicalDocument(MIPS_APM, false, true); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_APM); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_APM); + assertThat(testParentNode.getValue(ENTITY_ID)) .isEqualTo("TEST_APM"); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.MVP_ID)) + assertThat(testParentNode.getValue(MVP_ID)) .isEqualTo(TEST_MVP_ID); } @Test void decodeMvpMipsIndividualTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.MIPS_INDIVIDUAL, false, true); + Element clinicalDocument = makeClinicalDocument(MIPS_INDIVIDUAL, false, true); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + assertThat(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo(TEST_TIN); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + assertThat(testParentNode.getValue(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo(TEST_NPI); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.MVP_ID)) + assertThat(testParentNode.getValue(MVP_ID)) .isEqualTo(TEST_MVP_ID); } @Test void decodeMvpMipsGroupTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.MIPS_GROUP, false, true); + Element clinicalDocument = makeClinicalDocument(MIPS_GROUP, false, true); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + assertThat(testParentNode.getValue(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo(TEST_TIN); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.MVP_ID)) + assertThat(testParentNode.getValue(MVP_ID)) .isEqualTo(TEST_MVP_ID); } @Test void decodeMvpMipsSubgroupTest() { - Element clinicalDocument = makeClinicalDocument(ClinicalDocumentDecoder.MIPS_SUBGROUP, true, true); + Element clinicalDocument = makeClinicalDocument(MIPS_SUBGROUP, true, true); Node testParentNode = new Node(); ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context()); objectUnderTest.setNamespace(clinicalDocument.getNamespace()); objectUnderTest.decode(clinicalDocument, testParentNode); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)) - .isEqualTo(ClinicalDocumentDecoder.ENTITY_SUBGROUP); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.SUBGROUP_ID)) + assertThat(testParentNode.getValue(ENTITY_TYPE)) + .isEqualTo(ENTITY_SUBGROUP); + assertThat(testParentNode.getValue(SUBGROUP_ID)) .isEqualTo(TEST_SUBGROUP_ID); - assertThat(testParentNode.getValue(ClinicalDocumentDecoder.MVP_ID)) + assertThat(testParentNode.getValue(MVP_ID)) .isEqualTo(TEST_MVP_ID); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/MeasureDataDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/MeasureDataDecoderTest.java index b7f490e1e..3da11be40 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/MeasureDataDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/MeasureDataDecoderTest.java @@ -15,7 +15,7 @@ import java.io.IOException; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_TYPE; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_TYPE; class MeasureDataDecoderTest { diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoderTest.java index 505e6fafe..21f3c585c 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/PerformanceRateProportionMeasureDecoderTest.java @@ -14,6 +14,7 @@ import java.io.IOException; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; class PerformanceRateProportionMeasureDecoderTest { private static String happy; @@ -38,14 +39,14 @@ void before() throws XmlException { @Test void testPerformanceRateValueSuccess() { - assertThat(performanceRateNode.getValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE)) + assertThat(performanceRateNode.getValue(PERFORMANCE_RATE)) .isEqualTo("0.947368"); } @Test void testPerformanceRateUuidSuccess() { final String performanceRateId = "6D01A564-58CC-4CF5-929F-B83583701BFE"; - assertThat(performanceRateNode.getValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID)) + assertThat(performanceRateNode.getValue(PERFORMANCE_RATE_ID)) .isEqualTo(performanceRateId); } @@ -53,7 +54,7 @@ void testPerformanceRateUuidSuccess() { void testSuccessfulNullPerformanceRate() throws XmlException { decodeNodeFromFile(nullHappy); performanceRateNode = getNode(); - assertThat(performanceRateNode.getValue(PerformanceRateProportionMeasureDecoder.NULL_PERFORMANCE_RATE)) + assertThat(performanceRateNode.getValue(NULL_PERFORMANCE_RATE)) .isEqualTo("NA"); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/QualitySectionDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/QualitySectionDecoderTest.java index f98ea1451..6f511b6bc 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/QualitySectionDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/QualitySectionDecoderTest.java @@ -17,6 +17,7 @@ import java.nio.charset.StandardCharsets; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.CATEGORY_SECTION_V5; class QualitySectionDecoderTest { @@ -55,7 +56,7 @@ void testMeasureSectionV4Decoding() throws XmlException, IOException{ Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment)); Node measureSection = root.findFirstNode(TemplateId.MEASURE_SECTION_V5); - assertThat(measureSection.getValue(QualitySectionDecoder.CATEGORY_SECTION_V5)) + assertThat(measureSection.getValue(CATEGORY_SECTION_V5)) .isEqualTo(TemplateId.CATEGORY_REPORT_V5.getExtension()); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataEthnicityDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataEthnicityDecoderTest.java index 94cb1e856..eab4f8eca 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataEthnicityDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataEthnicityDecoderTest.java @@ -17,7 +17,7 @@ import java.util.stream.Collectors; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.SupplementalDataEthnicityDecoder.SUPPLEMENTAL_DATA_KEY; +import static gov.cms.qpp.conversion.model.Constants.SUPPLEMENTAL_DATA_KEY; public class SupplementalDataEthnicityDecoderTest { diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataPayerDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataPayerDecoderTest.java index 05d200ef1..8f5eaaf5f 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataPayerDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataPayerDecoderTest.java @@ -17,7 +17,7 @@ import java.util.stream.Collectors; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.SupplementalDataEthnicityDecoder.SUPPLEMENTAL_DATA_KEY; +import static gov.cms.qpp.conversion.model.Constants.SUPPLEMENTAL_DATA_KEY; public class SupplementalDataPayerDecoderTest { private static String successFile; diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataRaceDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataRaceDecoderTest.java index e8a262f61..b48318218 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataRaceDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataRaceDecoderTest.java @@ -17,7 +17,7 @@ import java.util.stream.Collectors; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.SupplementalDataEthnicityDecoder.SUPPLEMENTAL_DATA_KEY; +import static gov.cms.qpp.conversion.model.Constants.SUPPLEMENTAL_DATA_KEY; public class SupplementalDataRaceDecoderTest { diff --git a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataSexDecoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataSexDecoderTest.java index f1f53ef69..c173877e9 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataSexDecoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/decode/SupplementalDataSexDecoderTest.java @@ -17,7 +17,7 @@ import java.util.stream.Collectors; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.SupplementalDataEthnicityDecoder.SUPPLEMENTAL_DATA_KEY; +import static gov.cms.qpp.conversion.model.Constants.SUPPLEMENTAL_DATA_KEY; public class SupplementalDataSexDecoderTest { diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoderTest.java index 0eee6199c..fe9e95a11 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/ClinicalDocumentEncoderTest.java @@ -4,8 +4,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; @@ -14,6 +12,7 @@ import java.util.Map; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; class ClinicalDocumentEncoderTest { @@ -103,20 +102,20 @@ void createNode() { aciSectionNode.addChildNode(aciProportionMeasureNode3); aciReportingPerformanceNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - aciReportingPerformanceNode.putValue(ReportingParametersActDecoder.PERFORMANCE_YEAR, "2017"); - aciReportingPerformanceNode.putValue(ReportingParametersActDecoder.PERFORMANCE_START, "20170101"); - aciReportingPerformanceNode.putValue(ReportingParametersActDecoder.PERFORMANCE_END, "20171231"); + aciReportingPerformanceNode.putValue(PERFORMANCE_YEAR, "2017"); + aciReportingPerformanceNode.putValue(PERFORMANCE_START, "20170101"); + aciReportingPerformanceNode.putValue(PERFORMANCE_END, "20171231"); aciSectionNode.addChildNode(aciReportingPerformanceNode); clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, "mips"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, "individual"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, "123456789"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, "2567891421"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PRACTICE_ID, "AR000000" ); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_ID, "x12345" ); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.VG_ID, "x12345" ); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.CEHRT, "xxxxxxxxxx12345"); + clinicalDocumentNode.putValue(PROGRAM_NAME, "mips"); + clinicalDocumentNode.putValue(ENTITY_TYPE, "individual"); + clinicalDocumentNode.putValue(TAX_PAYER_IDENTIFICATION_NUMBER, "123456789"); + clinicalDocumentNode.putValue(NATIONAL_PROVIDER_IDENTIFIER, "2567891421"); + clinicalDocumentNode.putValue(PRACTICE_ID, "AR000000" ); + clinicalDocumentNode.putValue(ENTITY_ID, "x12345" ); + clinicalDocumentNode.putValue(VG_ID, "x12345" ); + clinicalDocumentNode.putValue(CEHRT, "xxxxxxxxxx12345"); clinicalDocumentNode.addChildNode(aciSectionNode); aciSectionNode.setParent(clinicalDocumentNode); @@ -130,7 +129,7 @@ void testPerformanceYear() { JsonWrapper testJsonWrapper = new JsonWrapper(); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); - Object performanceYear = testJsonWrapper.getInteger(ReportingParametersActDecoder.PERFORMANCE_YEAR); + Object performanceYear = testJsonWrapper.getInteger(PERFORMANCE_YEAR); assertThat(performanceYear).isEqualTo(2017); } @@ -142,11 +141,11 @@ void testInternalEncode() throws EncodeException { ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); - assertThat(testJsonWrapper.getString(ClinicalDocumentDecoder.ENTITY_TYPE)) + assertThat(testJsonWrapper.getString(ENTITY_TYPE)) .isEqualTo("individual"); - assertThat(testJsonWrapper.getString(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)) + assertThat(testJsonWrapper.getString(TAX_PAYER_IDENTIFICATION_NUMBER)) .isEqualTo("123456789"); - assertThat(testJsonWrapper.getString(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + assertThat(testJsonWrapper.getString(NATIONAL_PROVIDER_IDENTIFIER)) .isEqualTo("2567891421"); } @@ -167,7 +166,7 @@ void testInternalEncodeWithoutMeasures() throws EncodeException { @Test void testInternalEncodeEmptyEntityId() throws EncodeException { clinicalDocumentNode.getChildNodes().remove(aciSectionNode); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PRACTICE_ID,""); + clinicalDocumentNode.putValue(PRACTICE_ID,""); JsonWrapper testJsonWrapper = new JsonWrapper(); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); @@ -175,14 +174,14 @@ void testInternalEncodeEmptyEntityId() throws EncodeException { Map clinicalDocMap = ((Map) testJsonWrapper.toObject()); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.PRACTICE_ID)) + assertThat(clinicalDocMap.get(PRACTICE_ID)) .isNull(); } @Test void testInternalEncodeNullEntityId() throws EncodeException { clinicalDocumentNode.getChildNodes().remove(aciSectionNode); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PRACTICE_ID,null); + clinicalDocumentNode.putValue(PRACTICE_ID,null); JsonWrapper testJsonWrapper = new JsonWrapper(); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); @@ -190,15 +189,15 @@ void testInternalEncodeNullEntityId() throws EncodeException { Map clinicalDocMap = ((Map) testJsonWrapper.toObject()); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.PRACTICE_ID)) + assertThat(clinicalDocMap.get(PRACTICE_ID)) .isNull(); } @Test void testClinicalDocumentEncoderIgnoresInvalidMeasurementSection() { Node reportingParamNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT, clinicalDocumentNode); - reportingParamNode.putValue(ReportingParametersActEncoder.PERFORMANCE_START,"20170101"); - reportingParamNode.putValue(ReportingParametersActEncoder.PERFORMANCE_END,"20171231"); + reportingParamNode.putValue(PERFORMANCE_START,"20170101"); + reportingParamNode.putValue(PERFORMANCE_END,"20171231"); JsonWrapper testJsonWrapper = new JsonWrapper(); String expectedSection = "aci"; @@ -214,48 +213,48 @@ void testClinicalDocumentEncoderIgnoresInvalidMeasurementSection() { @Test void testVirtualGroupIdEncode() { - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, ClinicalDocumentDecoder.ENTITY_VIRTUAL_GROUP); + clinicalDocumentNode.putValue(ENTITY_TYPE, ENTITY_VIRTUAL_GROUP); JsonWrapper testJsonWrapper = new JsonWrapper(); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); - assertThat(testJsonWrapper.getString(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(testJsonWrapper.getString(ENTITY_ID)) .isEqualTo("x12345"); // TODO asdf refactor equals to toObject maybe if not comparing to JsW } @Test void testApmExcludeNpiEncoding() throws EncodeException { JsonWrapper testJsonWrapper = new JsonWrapper(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, "apm"); + clinicalDocumentNode.putValue(ENTITY_TYPE, "apm"); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); Map clinicalDocMap = ((Map) testJsonWrapper.toObject()); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + assertThat(clinicalDocMap.get(NATIONAL_PROVIDER_IDENTIFIER)) .isNull(); } @Test void testApmIncludesEntityID() throws EncodeException { JsonWrapper testJsonWrapper = new JsonWrapper(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.APM_ENTITY_ID, "apm"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, "apm"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_APP1_APMENTITY"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, "app1"); + clinicalDocumentNode.putValue(APM_ENTITY_ID, "apm"); + clinicalDocumentNode.putValue(ENTITY_TYPE, "apm"); + clinicalDocumentNode.putValue(RAW_PROGRAM_NAME, "MIPS_APP1_APMENTITY"); + clinicalDocumentNode.putValue(PROGRAM_NAME, "app1"); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); Map clinicalDocMap = ((Map) testJsonWrapper.toObject()); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + assertThat(clinicalDocMap.get(NATIONAL_PROVIDER_IDENTIFIER)) .isNull(); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(clinicalDocMap.get(ENTITY_ID)) .isNotNull(); } @@ -277,27 +276,27 @@ void testMeasurementSetIncludesSource() throws EncodeException { @Test void testAppApmIncludesEntityID() throws EncodeException { JsonWrapper testJsonWrapper = new JsonWrapper(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.APM_ENTITY_ID, "apm"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, "apm"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_APP1_APMENTITY"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, "app1"); + clinicalDocumentNode.putValue(APM_ENTITY_ID, "apm"); + clinicalDocumentNode.putValue(ENTITY_TYPE, "apm"); + clinicalDocumentNode.putValue(RAW_PROGRAM_NAME, "MIPS_APP1_APMENTITY"); + clinicalDocumentNode.putValue(PROGRAM_NAME, "app1"); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); Map clinicalDocMap = ((Map) testJsonWrapper.toObject()); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)) + assertThat(clinicalDocMap.get(NATIONAL_PROVIDER_IDENTIFIER)) .isNull(); - assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.ENTITY_ID)) + assertThat(clinicalDocMap.get(ENTITY_ID)) .isNotNull(); } @Test void testMvpIdReplacesProgramName() throws EncodeException { JsonWrapper testJsonWrapper = new JsonWrapper(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.MVP_ID, "G0053"); + clinicalDocumentNode.putValue(MVP_ID, "G0053"); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); @@ -311,9 +310,9 @@ void testMvpIdReplacesProgramName() throws EncodeException { @Test void testSubgroupIncludesSubgroupId() throws EncodeException { JsonWrapper testJsonWrapper = new JsonWrapper(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.MVP_ID, "G0053"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, "subgroup"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.SUBGROUP_ID, "SG-00000001"); + clinicalDocumentNode.putValue(MVP_ID, "G0053"); + clinicalDocumentNode.putValue(ENTITY_TYPE, "subgroup"); + clinicalDocumentNode.putValue(SUBGROUP_ID, "SG-00000001"); ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context()); clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode); @@ -323,8 +322,8 @@ void testSubgroupIncludesSubgroupId() throws EncodeException { String programName = measurementSets.get(0).getString("programName"); assertThat(programName).isEqualTo("G0053"); - assertThat(testJsonWrapper.getString(ClinicalDocumentDecoder.ENTITY_TYPE)).isEqualTo("subgroup"); - assertThat(testJsonWrapper.getString(ClinicalDocumentDecoder.ENTITY_ID)).isEqualTo("SG-00000001"); + assertThat(testJsonWrapper.getString(ENTITY_TYPE)).isEqualTo("subgroup"); + assertThat(testJsonWrapper.getString(ENTITY_ID)).isEqualTo("SG-00000001"); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/IaSectionEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/IaSectionEncoderTest.java index 0ab10d4d6..54dd53e88 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/IaSectionEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/IaSectionEncoderTest.java @@ -1,6 +1,8 @@ package gov.cms.qpp.conversion.encode; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_END; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_START; import java.io.BufferedWriter; import java.io.StringWriter; @@ -12,7 +14,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; @@ -47,8 +48,8 @@ void createNode() { iaSectionNode.addChildNode(iaMeasureNode); iaReportingSectionNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - iaReportingSectionNode.putValue(ReportingParametersActDecoder.PERFORMANCE_START, "20170101"); - iaReportingSectionNode.putValue(ReportingParametersActDecoder.PERFORMANCE_END, "20171231"); + iaReportingSectionNode.putValue(PERFORMANCE_START, "20170101"); + iaReportingSectionNode.putValue(PERFORMANCE_END, "20171231"); iaSectionNode.addChildNode(iaReportingSectionNode); nodes = new ArrayList<>(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/MeasureDataEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/MeasureDataEncoderTest.java index b0bf7ed15..9af217d6e 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/MeasureDataEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/MeasureDataEncoderTest.java @@ -8,8 +8,8 @@ import org.junit.jupiter.params.provider.EnumSource; import static com.google.common.truth.Truth.assertThat; -import static gov.cms.qpp.conversion.decode.AggregateCountDecoder.AGGREGATE_COUNT; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_TYPE; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; +import static gov.cms.qpp.conversion.model.Constants.MEASURE_TYPE; class MeasureDataEncoderTest { private enum Fixture { diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderMultiMeasureTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderMultiMeasureTest.java index db48790a0..bff64db14 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderMultiMeasureTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderMultiMeasureTest.java @@ -1,6 +1,7 @@ package gov.cms.qpp.conversion.encode; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; import java.io.BufferedWriter; import java.io.StringWriter; @@ -12,8 +13,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; @@ -103,9 +102,9 @@ void createNode() { aciProportionMeasureNode3.putValue("measureId", "PI_CCTPE_3"); clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.CEHRT, "xxxxxxxxxx12345"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_INDIV"); + clinicalDocumentNode.putValue(CEHRT, "xxxxxxxxxx12345"); + clinicalDocumentNode.putValue(PROGRAM_NAME, MIPS_PROGRAM_NAME); + clinicalDocumentNode.putValue(RAW_PROGRAM_NAME, "MIPS_INDIV"); aciSectionNode = new Node(TemplateId.PI_SECTION_V3, clinicalDocumentNode); aciSectionNode.putValue("category", "pi"); @@ -114,8 +113,8 @@ void createNode() { aciSectionNode.addChildNode(aciProportionMeasureNode3); reportingParametersNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - reportingParametersNode.putValue(ReportingParametersActDecoder.PERFORMANCE_START,"20170101"); - reportingParametersNode.putValue(ReportingParametersActDecoder.PERFORMANCE_END,"20171231"); + reportingParametersNode.putValue(PERFORMANCE_START,"20170101"); + reportingParametersNode.putValue(PERFORMANCE_END,"20171231"); aciSectionNode.addChildNode(reportingParametersNode); nodes = new ArrayList<>(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderTest.java index 73158bc7f..5cbb49fe2 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/PiSectionEncoderTest.java @@ -2,6 +2,7 @@ import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.spy; @@ -16,8 +17,6 @@ import org.mockito.Mockito; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.ProblemCode; @@ -64,13 +63,13 @@ void createNode() { piNumeratorDenominatorNode.putValue(MEASUREMENT_ID, MEASUREMENT_ID_VALUE); reportingParametersNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - reportingParametersNode.putValue(ReportingParametersActDecoder.PERFORMANCE_START,"20170101"); - reportingParametersNode.putValue(ReportingParametersActDecoder.PERFORMANCE_END,"20171231"); + reportingParametersNode.putValue(PERFORMANCE_START,"20170101"); + reportingParametersNode.putValue(PERFORMANCE_END,"20171231"); clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.CEHRT, "xxxxxxxxxx12345"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_INDIV"); + clinicalDocumentNode.putValue(CEHRT, "xxxxxxxxxx12345"); + clinicalDocumentNode.putValue(PROGRAM_NAME, MIPS_PROGRAM_NAME); + clinicalDocumentNode.putValue(RAW_PROGRAM_NAME, "MIPS_INDIV"); piSectionNode = new Node(TemplateId.PI_SECTION_V3, clinicalDocumentNode); piSectionNode.putValue(CATEGORY, PI); @@ -87,7 +86,7 @@ void testInternalEncode() { assertWithMessage("Must have a child node").that(jsonWrapper).isNotNull(); assertWithMessage("Must be category PI").that(jsonWrapper.getString(CATEGORY)).isEqualTo(PI); assertWithMessage("Must have measurements").that(jsonWrapper.get(MEASUREMENTS)).isNotNull(); - assertThat(jsonWrapper.getString(ClinicalDocumentDecoder.CEHRT)).isNotNull(); + assertThat(jsonWrapper.getString(CEHRT)).isNotNull(); assertWithMessage("Must have submissionMethod") .that(jsonWrapper.getString(SUBMISSION_METHOD)).isEqualTo(ELECTRONIC_HEALTH_RECORD); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoderTest.java index 1001e62c0..eb74b5a6c 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/QualityMeasureIdEncoderTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.MeasureDataDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.validation.MeasureConfigs; @@ -207,7 +206,7 @@ void testIgnoresNonMeasureDataNodes() { @Test void testEncodeSingleToMultiDefault() { qualityMeasureId.putValue("measureId", "40280382-6258-7581-0162-626f31a0009e"); - numeratorNode.putValue(MeasureDataDecoder.MEASURE_POPULATION,"F4580E7F-EB6C-42AB-93A8-9AF1A4FD46EE"); + numeratorNode.putValue("populationId","F4580E7F-EB6C-42AB-93A8-9AF1A4FD46EE"); executeInternalEncode(); JsonWrapper childValues = getChildValues(); List strata = JsonHelper.readJsonAtJsonPath(childValues.toString(), "$.strata", new TypeRef>() {}); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/QualitySectionEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/QualitySectionEncoderTest.java index cfbcc60fa..d3d8f01f6 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/QualitySectionEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/QualitySectionEncoderTest.java @@ -1,8 +1,6 @@ package gov.cms.qpp.conversion.encode; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.ProblemCode; @@ -11,6 +9,7 @@ import org.junit.jupiter.api.Test; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -65,14 +64,14 @@ void internalEncodeNoReportingParametersNegative() throws EncodeException { */ private Node getQualitySectionNode() { Node clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.CEHRT, "xxxxxxxxxx12345"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME); + clinicalDocumentNode.putValue(CEHRT, "xxxxxxxxxx12345"); + clinicalDocumentNode.putValue(PROGRAM_NAME, CPCPLUS_PROGRAM_NAME); Node qualitySectionNode = new Node(TemplateId.MEASURE_SECTION_V5, clinicalDocumentNode); qualitySectionNode.putValue("category", "quality"); qualitySectionNode.putValue("submissionMethod", "electronicHealthRecord"); Node reportingParameterNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - reportingParameterNode.putValue(ReportingParametersActDecoder.PERFORMANCE_START,"20170101"); - reportingParameterNode.putValue(ReportingParametersActDecoder.PERFORMANCE_END, "20171231"); + reportingParameterNode.putValue(PERFORMANCE_START,"20170101"); + reportingParameterNode.putValue(PERFORMANCE_END, "20171231"); qualitySectionNode.addChildNode(reportingParameterNode); return qualitySectionNode; } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoderTest.java b/converter/src/test/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoderTest.java index f73c34eeb..8e5de971a 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoderTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/encode/ReportingParametersActEncoderTest.java @@ -6,6 +6,8 @@ import org.junit.jupiter.api.Test; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_END; +import static gov.cms.qpp.conversion.model.Constants.PERFORMANCE_START; /** * Test class for ReportingParametersActEncoder @@ -15,13 +17,13 @@ class ReportingParametersActEncoderTest { @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"); + reportingParametersActNode.putValue(PERFORMANCE_START,"20170101"); + reportingParametersActNode.putValue(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); + String performanceStart = outputWrapper.getString(PERFORMANCE_START); + String performanceEnd = outputWrapper.getString(PERFORMANCE_END); assertThat(performanceStart).isEqualTo("2017-01-01"); assertThat(performanceEnd).isEqualTo("2017-12-31"); @@ -34,8 +36,8 @@ void missingValuesTest() throws Exception { 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); + String performanceStart = outputWrapper.getString(PERFORMANCE_START); + String performanceEnd = outputWrapper.getString(PERFORMANCE_END); assertThat(performanceStart).isNull(); assertThat(performanceEnd).isNull(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/model/ProgramTest.java b/converter/src/test/java/gov/cms/qpp/conversion/model/ProgramTest.java index c26a5e563..c6dce8dee 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/model/ProgramTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/model/ProgramTest.java @@ -1,9 +1,6 @@ package gov.cms.qpp.conversion.model; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; - -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.test.enums.EnumContract; import java.util.HashSet; @@ -12,6 +9,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.RAW_PROGRAM_NAME; class ProgramTest implements EnumContract { @@ -52,56 +50,56 @@ void instanceRetrievalNullProgramName() { @Test void testIsPcfForMixedCaseIsTrue() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "pCf"); + node.putValue(RAW_PROGRAM_NAME, "pCf"); assertThat(Program.isPcf(node)).isTrue(); } @Test void testIsPcfUppercaseIsTrue() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "PCF"); + node.putValue(RAW_PROGRAM_NAME, "PCF"); assertThat(Program.isPcf(node)).isTrue(); } @Test void testIsPcfLowercaseIsTrue() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "pcf"); + node.putValue(RAW_PROGRAM_NAME, "pcf"); assertThat(Program.isPcf(node)).isTrue(); } @Test void testIsAppIndividualIsTrue() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_APP1_INDIV"); + node.putValue(RAW_PROGRAM_NAME, "MIPS_APP1_INDIV"); assertThat(Program.isApp(node)).isTrue(); } @Test void testIsMipsNonAppIndividualFalse() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_INDIV"); + node.putValue(RAW_PROGRAM_NAME, "MIPS_INDIV"); assertThat(Program.isApp(node)).isFalse(); } @Test void testExtractProgramForMipsInd() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_INDIV"); + node.putValue(RAW_PROGRAM_NAME, "MIPS_INDIV"); assertThat(Program.isMips(node)).isTrue(); } @Test void testExtractProgramForMipsGroup() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_GROUP"); + node.putValue(RAW_PROGRAM_NAME, "MIPS_GROUP"); assertThat(Program.isMips(node)).isTrue(); } @Test void testExtractProgramForMipsVirtualGroup() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "MIPS_VIRTUALGROUP"); + node.putValue(RAW_PROGRAM_NAME, "MIPS_VIRTUALGROUP"); assertThat(Program.isMips(node)).isTrue(); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/util/DuplicationCheckHelperTest.java b/converter/src/test/java/gov/cms/qpp/conversion/util/DuplicationCheckHelperTest.java index fb454b92f..8d46c1892 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/util/DuplicationCheckHelperTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/util/DuplicationCheckHelperTest.java @@ -2,30 +2,30 @@ import org.junit.jupiter.api.Test; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; public class DuplicationCheckHelperTest { @Test void testDuplicateCheckerWithNoDuplicateAggregateCounts() { Node node = new Node(TemplateId.PI_AGGREGATE_COUNT); - node.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "1234", false); + node.putValue(AGGREGATE_COUNT, "1234", false); - int duplicationValue = DuplicationCheckHelper.calculateDuplications(node, AggregateCountDecoder.AGGREGATE_COUNT); + int duplicationValue = DuplicationCheckHelper.calculateDuplications(node, AGGREGATE_COUNT); assertThat(duplicationValue).isEqualTo(0); } @Test void testDuplicateCheckerWithDuplicateAggregateCounts() { Node node = new Node(TemplateId.PI_AGGREGATE_COUNT); - node.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "1234", false); - node.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "1234", false); + node.putValue(AGGREGATE_COUNT, "1234", false); + node.putValue(AGGREGATE_COUNT, "1234", false); - int duplicationValue = DuplicationCheckHelper.calculateDuplications(node, AggregateCountDecoder.AGGREGATE_COUNT); + int duplicationValue = DuplicationCheckHelper.calculateDuplications(node, AGGREGATE_COUNT); assertThat(duplicationValue).isEqualTo(2); } } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/AggregateCountValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/AggregateCountValidatorTest.java index 21ed48ce7..e6964e813 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/AggregateCountValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/AggregateCountValidatorTest.java @@ -1,12 +1,12 @@ package gov.cms.qpp.conversion.validate; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.AGGREGATE_COUNT; import java.util.List; import org.junit.jupiter.api.Test; -import gov.cms.qpp.conversion.decode.AggregateCountDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.Validator; @@ -44,7 +44,7 @@ void testValueAbsenceFailure() { void testValueTypeFailure() { Node aggregateCountNode = new Node(TemplateId.PI_AGGREGATE_COUNT); aggregateCountNode.setParent(new Node(TemplateId.PI_NUMERATOR)); - aggregateCountNode.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "meep"); + aggregateCountNode.putValue(AGGREGATE_COUNT, "meep"); AggregateCountValidator validator = new AggregateCountValidator(); List errors = validator.validateSingleNode(aggregateCountNode).getErrors(); @@ -58,7 +58,7 @@ void testValueTypeFailure() { void testValueTypeSuccess() { Node aggregateCountNode = new Node(TemplateId.PI_AGGREGATE_COUNT); aggregateCountNode.setParent(new Node(TemplateId.PI_NUMERATOR)); - aggregateCountNode.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "7"); + aggregateCountNode.putValue(AGGREGATE_COUNT, "7"); AggregateCountValidator validator = new AggregateCountValidator(); List errors = validator.validateSingleNode(aggregateCountNode).getErrors(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidatorTest.java index 49b605116..6fb0132f4 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/ClinicalDocumentValidatorTest.java @@ -2,6 +2,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.*; import java.io.IOException; import java.nio.file.Files; @@ -15,7 +16,6 @@ import gov.cms.qpp.conversion.Context; import gov.cms.qpp.conversion.Converter; import gov.cms.qpp.conversion.PathSource; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.AllErrors; @@ -246,7 +246,7 @@ void testInvalidProgramName() { Node aciSectionNode = createAciSectionNode(clinicalDocumentNode); clinicalDocumentNode.addChildNodes(aciSectionNode); String invalidProgramName = "Invalid program name"; - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME,invalidProgramName); + clinicalDocumentNode.putValue(PROGRAM_NAME,invalidProgramName); ClinicalDocumentValidator validator = new ClinicalDocumentValidator(); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); @@ -258,7 +258,7 @@ void testInvalidProgramName() { @Test void testMissingVirtualGroupId() { Node clinicalDocumentNode = createValidClinicalDocumentNode(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, ClinicalDocumentDecoder.ENTITY_VIRTUAL_GROUP); + clinicalDocumentNode.putValue(ENTITY_TYPE, ENTITY_VIRTUAL_GROUP); Node aciSectionNode = createAciSectionNode(clinicalDocumentNode); clinicalDocumentNode.addChildNode(aciSectionNode); ClinicalDocumentValidator validator = new ClinicalDocumentValidator(); @@ -271,8 +271,8 @@ void testMissingVirtualGroupId() { @Test void testSuccessVirtualGroupId() { Node clinicalDocumentNode = createValidClinicalDocumentNode(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, ClinicalDocumentDecoder.ENTITY_VIRTUAL_GROUP); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_ID, "x12345"); + clinicalDocumentNode.putValue(ENTITY_TYPE, ENTITY_VIRTUAL_GROUP); + clinicalDocumentNode.putValue(ENTITY_ID, "x12345"); Node aciSectionNode = createAciSectionNode(clinicalDocumentNode); clinicalDocumentNode.addChildNode(aciSectionNode); ClinicalDocumentValidator validator = new ClinicalDocumentValidator(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidatorTest.java index 3b228de03..a7c4378e1 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfClinicalDocumentValidatorTest.java @@ -7,7 +7,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.conversion.Context; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -19,6 +18,7 @@ import java.util.List; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; public class PcfClinicalDocumentValidatorTest { private PcfClinicalDocumentValidator validator; @@ -47,7 +47,7 @@ void testValidPcfPracticeSiteAddress() { @Test void testMissingPcfPracticeSiteAddress() { Node clinicalDocumentNode = createPcfClinicalDocumentNodeWithMeasureSection(); - clinicalDocumentNode.removeValue(ClinicalDocumentDecoder.PRACTICE_SITE_ADDR); + clinicalDocumentNode.removeValue(PRACTICE_SITE_ADDR); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -60,7 +60,7 @@ void testPcfMultipleApm() { Node clinicalDocumentNode = createPcfClinicalDocumentNodeWithMeasureSection(); // extra APM - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PCF_ENTITY_ID, "1234567", false); + clinicalDocumentNode.putValue(PCF_ENTITY_ID, "1234567", false); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -70,7 +70,7 @@ void testPcfMultipleApm() { @Test void testPcfNoApm() { Node clinicalDocumentNode = createPcfClinicalDocumentNodeWithMeasureSection(); - clinicalDocumentNode.removeValue(ClinicalDocumentDecoder.PCF_ENTITY_ID); + clinicalDocumentNode.removeValue(PCF_ENTITY_ID); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -80,7 +80,7 @@ void testPcfNoApm() { @Test void testPcfEmptyApm() { Node clinicalDocumentNode = createPcfClinicalDocumentNodeWithMeasureSection(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PCF_ENTITY_ID, ""); + clinicalDocumentNode.putValue(PCF_ENTITY_ID, ""); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) .containsExactly(ProblemCode.PCF_CLINICAL_DOCUMENT_EMPTY_APM); @@ -89,7 +89,7 @@ void testPcfEmptyApm() { @Test void testPcfInvalidApm() { Node clinicalDocumentNode = createPcfClinicalDocumentNodeWithMeasureSection(); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PCF_ENTITY_ID, "PropertyTaxes"); + clinicalDocumentNode.putValue(PCF_ENTITY_ID, "PropertyTaxes"); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) .containsExactly(ProblemCode.PCF_CLINICAL_DOCUMENT_INVALID_APM); @@ -131,12 +131,12 @@ void testNoPi() { @Test void testNonNumericNpi() { Node clinicalDocumentNode = createPcfClinicalDocumentNodeWithMeasureSection(); - clinicalDocumentNode.removeValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, "9900000.99"); + clinicalDocumentNode.removeValue(NATIONAL_PROVIDER_IDENTIFIER); + clinicalDocumentNode.putValue(NATIONAL_PROVIDER_IDENTIFIER, "9900000.99"); List errors = validator.validateSingleNode(clinicalDocumentNode).getErrors(); assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) - .containsExactly(ProblemCode.PCF_INVALID_NPI.format(ClinicalDocumentDecoder.PCF_PROGRAM_NAME.toUpperCase())); + .containsExactly(ProblemCode.PCF_INVALID_NPI.format(PCF_PROGRAM_NAME.toUpperCase())); } private Node createPcfClinicalDocumentNodeWithMeasureSection() { @@ -147,13 +147,13 @@ private Node createPcfClinicalDocumentNodeWithMeasureSection() { private Node createPcfClinicalDocumentNodeOnly() { Node clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.PCF); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_TYPE, ""); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PRACTICE_SITE_ADDR, "test"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PCF_ENTITY_ID, "DogCow"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, "123456789"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, "9900000099"); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.CEHRT, "XX15CXXXXXXXXXX"); + clinicalDocumentNode.putValue(PROGRAM_NAME, PCF); + clinicalDocumentNode.putValue(ENTITY_TYPE, ""); + clinicalDocumentNode.putValue(PRACTICE_SITE_ADDR, "test"); + clinicalDocumentNode.putValue(PCF_ENTITY_ID, "DogCow"); + clinicalDocumentNode.putValue(TAX_PAYER_IDENTIFICATION_NUMBER, "123456789"); + clinicalDocumentNode.putValue(NATIONAL_PROVIDER_IDENTIFIER, "9900000099"); + clinicalDocumentNode.putValue(CEHRT, "XX15CXXXXXXXXXX"); return clinicalDocumentNode; } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidationTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidationTest.java index e35ddb003..cfbf181fa 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidationTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfPerformancePeriodValidationTest.java @@ -3,8 +3,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -16,26 +14,27 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.*; public class PcfPerformancePeriodValidationTest { private PcfPerformancePeriodValidation validator; private Node node; - private String programName = ClinicalDocumentDecoder.PCF_PROGRAM_NAME.toUpperCase(Locale.ROOT); + private String programName = PCF_PROGRAM_NAME.toUpperCase(Locale.ROOT); @BeforeEach void setup() { validator = new PcfPerformancePeriodValidation(); Node clinicalDocument = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocument.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, programName); + clinicalDocument.putValue(PROGRAM_NAME, programName); Node measureSection = new Node(TemplateId.MEASURE_SECTION_V5); measureSection.setParent(clinicalDocument); node = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - node.putValue(ReportingParametersActDecoder.PERFORMANCE_YEAR, "2024"); - node.putValue(ReportingParametersActDecoder.PERFORMANCE_START, "20240101"); - node.putValue(ReportingParametersActDecoder.PERFORMANCE_END, "20241231"); + node.putValue(PERFORMANCE_YEAR, "2024"); + node.putValue(PERFORMANCE_START, "20240101"); + node.putValue(PERFORMANCE_END, "20241231"); node.setParent(measureSection); } @@ -48,7 +47,7 @@ void testPerformancePeriodIsValid() { @Test void testPerformancePeriodStartIsInvalid() { - node.putValue(ReportingParametersActDecoder.PERFORMANCE_START, "not what we want"); + node.putValue(PERFORMANCE_START, "not what we want"); List details = validator.validateSingleNode(node).getErrors(); assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -57,7 +56,7 @@ void testPerformancePeriodStartIsInvalid() { @Test void testPerformancePeriodEndIsInvalid() { - node.putValue(ReportingParametersActDecoder.PERFORMANCE_END, "not what we want"); + node.putValue(PERFORMANCE_END, "not what we want"); List details = validator.validateSingleNode(node).getErrors(); assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE) .containsExactly(ProblemCode.PCF_PERFORMANCE_PERIOD_END.format(programName)); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidatorTest.java index 5d09fb4f6..2b9765467 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/PcfQualityMeasureIdValidatorTest.java @@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.conversion.decode.AggregateCountDecoder; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -19,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.*; public class PcfQualityMeasureIdValidatorTest { private static final String MEASURE_ID = "2c928084-83d3-1b44-0183-ec9f5639051f"; @@ -34,7 +34,7 @@ void setUp() { validator = new PcfQualityMeasureIdValidator(); clinicalDoc = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDoc.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.PCF); + clinicalDoc.putValue(PROGRAM_NAME, PCF); measureSection = new Node(TemplateId.MEASURE_SECTION_V5, clinicalDoc); testNode = new Node(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5, measureSection); testNode.putValue(MeasureConfigHelper.MEASURE_ID, MEASURE_ID); @@ -108,7 +108,7 @@ private void addMeasureDataWithoutAggCount() { private void addMeasureDataWithInvalidAggCount() { Node childNode = createMeasureDataNode(); Node aggCount = new Node(TemplateId.PI_AGGREGATE_COUNT); - aggCount.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "ab1234"); + aggCount.putValue(AGGREGATE_COUNT, "ab1234"); testNode.addChildNode(childNode); } diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/PerformanceRateValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/PerformanceRateValidatorTest.java index c8b8b587b..982e0681c 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/PerformanceRateValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/PerformanceRateValidatorTest.java @@ -3,7 +3,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -11,6 +10,7 @@ import gov.cms.qpp.conversion.model.error.correspondence.DetailsErrorEquals; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.*; import java.util.List; @@ -27,7 +27,7 @@ void setup() { @Test void testZeroValue() { - node.putValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, "0"); + node.putValue(PERFORMANCE_RATE, "0"); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("Must contain a proper value") .that(errors).isEmpty(); @@ -35,7 +35,7 @@ void testZeroValue() { @Test void testOneValue() { - node.putValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, "1"); + node.putValue(PERFORMANCE_RATE, "1"); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("Must contain a proper value") .that(errors).isEmpty(); @@ -43,7 +43,7 @@ void testOneValue() { @Test void testNAValue() { - node.putValue(PerformanceRateProportionMeasureDecoder.NULL_PERFORMANCE_RATE, "NA"); + node.putValue(NULL_PERFORMANCE_RATE, "NA"); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("Must contain a proper value") .that(errors).isEmpty(); @@ -52,7 +52,7 @@ void testNAValue() { @Test void testNegativeValue() { String invalidValue = "-1"; - node.putValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, invalidValue); + node.putValue(PERFORMANCE_RATE, invalidValue); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("Must contain a proper value") .that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -62,7 +62,7 @@ void testNegativeValue() { @Test void testInvalidValue() { String invalidValue = "2"; - node.putValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, invalidValue); + node.putValue(PERFORMANCE_RATE, invalidValue); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("Must contain a proper value") .that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -72,7 +72,7 @@ void testInvalidValue() { @Test void testInvalidStringValue() { String invalidValue = "Inval"; - node.putValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, invalidValue); + node.putValue(PERFORMANCE_RATE, invalidValue); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("Must contain a proper value") .that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) @@ -81,7 +81,7 @@ void testInvalidStringValue() { @Test void testEmptyValue() { - node.putValue(PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE, ""); + node.putValue(PERFORMANCE_RATE, ""); List errors = performanceRateValidator.validateSingleNode(node).getErrors(); assertWithMessage("The error code is incorrect") .that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE) diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidatorTest.java index 67ddfab2d..c4016f785 100755 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureIdValidatorTest.java @@ -1,9 +1,7 @@ package gov.cms.qpp.conversion.validate; import static com.google.common.truth.Truth.assertWithMessage; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION; -import static gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_TYPE; -import static gov.cms.qpp.conversion.decode.PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID; +import static gov.cms.qpp.conversion.model.Constants.*; import java.util.List; @@ -454,7 +452,7 @@ private static class MeasureReferenceBuilder { Node measureSection = new Node(TemplateId.MEASURE_SECTION_V5, clinicalDoc); MeasureReferenceBuilder() { - clinicalDoc.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, ClinicalDocumentDecoder.MIPS_PROGRAM_NAME); + clinicalDoc.putValue(PROGRAM_NAME, MIPS_PROGRAM_NAME); measureReferenceResultsNode = new Node(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5, measureSection); } @@ -494,7 +492,7 @@ MeasureReferenceBuilder addSubPopulationMeasureDataWithCounts(String type, Strin measureNode.putValue(MEASURE_POPULATION, populationId); Node aggregateCountNode = new Node(TemplateId.PI_AGGREGATE_COUNT); - aggregateCountNode.putValue(AggregateCountDecoder.AGGREGATE_COUNT, count); + aggregateCountNode.putValue(AGGREGATE_COUNT, count); measureNode.addChildNode(aggregateCountNode); @@ -509,7 +507,7 @@ MeasureReferenceBuilder removeSubPopulationMeasureData(String type, String popul measureNode.putValue(MEASURE_POPULATION, populationId); Node aggregateCountNode = new Node(TemplateId.PI_AGGREGATE_COUNT); - aggregateCountNode.putValue(AggregateCountDecoder.AGGREGATE_COUNT, ONE_HUNDRED); + aggregateCountNode.putValue(AGGREGATE_COUNT, ONE_HUNDRED); measureNode.addChildNode(aggregateCountNode); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidatorTest.java index c6d9c62ce..7cf1ae3dc 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/QualityMeasureSectionValidatorTest.java @@ -2,6 +2,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static gov.cms.qpp.conversion.model.Constants.CATEGORY_SECTION_V5; import static gov.cms.qpp.conversion.model.TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V5; import java.util.List; @@ -11,7 +12,6 @@ import org.junit.jupiter.api.Test; import gov.cms.qpp.MarkupManipulationHandler; -import gov.cms.qpp.conversion.decode.QualitySectionDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -42,7 +42,7 @@ void setUpQualityMeasureSection() { void testValidQualityMeasureSectionValidation() { qualityMeasureSectionNode.addChildNode(reportingParameterNode); qualityMeasureSectionNode.addChildNode(measure); - qualityMeasureSectionNode.putValue(QualitySectionDecoder.CATEGORY_SECTION_V5, + qualityMeasureSectionNode.putValue(CATEGORY_SECTION_V5, TemplateId.CATEGORY_REPORT_V5.getExtension()); List errors = validateQualityMeasureSection(); @@ -54,7 +54,7 @@ void testValidQualityMeasureSectionValidation() { @Test void testQualityMeasureSectionWithoutMeasure() { qualityMeasureSectionNode.addChildNode(reportingParameterNode); - qualityMeasureSectionNode.putValue(QualitySectionDecoder.CATEGORY_SECTION_V5, + qualityMeasureSectionNode.putValue(CATEGORY_SECTION_V5, TemplateId.CATEGORY_REPORT_V5.getExtension()); List errors = validateQualityMeasureSection(); @@ -68,7 +68,7 @@ void testQualityMeasureSectionWithoutMeasure() { @Test void testMissingReportingParams() { - qualityMeasureSectionNode.putValue(QualitySectionDecoder.CATEGORY_SECTION_V5, + qualityMeasureSectionNode.putValue(CATEGORY_SECTION_V5, TemplateId.CATEGORY_REPORT_V5.getExtension()); List errors = validateQualityMeasureSection(); @@ -83,7 +83,7 @@ void testMissingReportingParams() { void testTooManyReportingParams() { Node secondReportingParameterNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); qualityMeasureSectionNode.addChildNodes(reportingParameterNode, secondReportingParameterNode); - qualityMeasureSectionNode.putValue(QualitySectionDecoder.CATEGORY_SECTION_V5, + qualityMeasureSectionNode.putValue(CATEGORY_SECTION_V5, TemplateId.CATEGORY_REPORT_V5.getExtension()); List errors = validateQualityMeasureSection(); diff --git a/converter/src/test/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidatorTest.java b/converter/src/test/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidatorTest.java index 3a8825991..3e6a726be 100644 --- a/converter/src/test/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidatorTest.java +++ b/converter/src/test/java/gov/cms/qpp/conversion/validate/ReportingParametersActValidatorTest.java @@ -4,10 +4,10 @@ import java.util.List; +import gov.cms.qpp.conversion.model.Constants; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import gov.cms.qpp.conversion.decode.ReportingParametersActDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.model.error.Detail; @@ -102,9 +102,9 @@ void testPerformanceStartAndEndSlashesAndDashesNoTimezone() { private Node createReportingParametersAct(String startDate, String endDate, String performanceYear) { Node reportingParametersActNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT); - reportingParametersActNode.putValue(ReportingParametersActDecoder.PERFORMANCE_START, startDate); - reportingParametersActNode.putValue(ReportingParametersActDecoder.PERFORMANCE_END, endDate); - reportingParametersActNode.putValue(ReportingParametersActDecoder.PERFORMANCE_YEAR, performanceYear); + reportingParametersActNode.putValue(Constants.PERFORMANCE_START, startDate); + reportingParametersActNode.putValue(Constants.PERFORMANCE_END, endDate); + reportingParametersActNode.putValue(Constants.PERFORMANCE_YEAR, performanceYear); return reportingParametersActNode; } diff --git a/rest-api/src/main/java/gov/cms/qpp/conversion/api/helper/MetadataHelper.java b/rest-api/src/main/java/gov/cms/qpp/conversion/api/helper/MetadataHelper.java index 3166c195f..60365654f 100644 --- a/rest-api/src/main/java/gov/cms/qpp/conversion/api/helper/MetadataHelper.java +++ b/rest-api/src/main/java/gov/cms/qpp/conversion/api/helper/MetadataHelper.java @@ -2,7 +2,6 @@ import gov.cms.qpp.conversion.api.model.Constants; import gov.cms.qpp.conversion.api.model.Metadata; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.Program; import gov.cms.qpp.conversion.model.TemplateId; @@ -12,6 +11,8 @@ import java.util.Objects; import java.util.concurrent.ThreadLocalRandom; +import static gov.cms.qpp.conversion.model.Constants.*; + /** * Utilities for working with Metadata beans */ @@ -74,9 +75,9 @@ private static String deriveHash(String partitionStart) { */ private static String findApm(Node node) { if (isPcf(node)) { - return findValue(node, ClinicalDocumentDecoder.PCF_ENTITY_ID, TemplateId.CLINICAL_DOCUMENT); + return findValue(node, PCF_ENTITY_ID, TemplateId.CLINICAL_DOCUMENT); } else { - return findValue(node, ClinicalDocumentDecoder.PRACTICE_ID, TemplateId.CLINICAL_DOCUMENT); + return findValue(node, PRACTICE_ID, TemplateId.CLINICAL_DOCUMENT); } } @@ -87,7 +88,7 @@ private static String findApm(Node node) { * @return TIN value */ private static String findTin(Node node) { - return findValue(node, ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, + return findValue(node, TAX_PAYER_IDENTIFICATION_NUMBER, TemplateId.CLINICAL_DOCUMENT); } @@ -98,12 +99,12 @@ private static String findTin(Node node) { * @return NPI value */ private static String findNpi(Node node) { - return findValue(node, ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, + return findValue(node, NATIONAL_PROVIDER_IDENTIFIER, TemplateId.CLINICAL_DOCUMENT); } private static String findProgramName(Node node) { - return findValue(node, ClinicalDocumentDecoder.PROGRAM_NAME, + return findValue(node, PROGRAM_NAME, TemplateId.CLINICAL_DOCUMENT); } @@ -112,7 +113,7 @@ private static boolean isPcf(Node node) { return true; } - Node found = findPossibleChildNode(node, ClinicalDocumentDecoder.RAW_PROGRAM_NAME, + Node found = findPossibleChildNode(node, RAW_PROGRAM_NAME, TemplateId.CLINICAL_DOCUMENT); return found != null && Program.isPcf(found); diff --git a/rest-api/src/main/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidator.java b/rest-api/src/main/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidator.java index 5ab3d47fe..dd598587d 100644 --- a/rest-api/src/main/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidator.java +++ b/rest-api/src/main/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidator.java @@ -4,7 +4,6 @@ import gov.cms.qpp.conversion.api.model.PcfValidationInfoMap; import gov.cms.qpp.conversion.api.model.TinNpiCombination; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.error.Detail; import gov.cms.qpp.conversion.model.error.ProblemCode; @@ -17,6 +16,8 @@ import java.util.List; import java.util.Map; +import static gov.cms.qpp.conversion.model.Constants.*; + public class SpecPiiValidator implements PiiValidator { private final PcfValidationInfoMap file; @@ -32,12 +33,12 @@ public void validateApmTinNpiCombination(Node node, NodeValidator validator) { } private void validateInvalidApmCombinations(Node node, NodeValidator validator) { - String program = node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME); + String program = node.getValue(PROGRAM_NAME); String apm = getApmEntityId(node, program); List npiList = Arrays.asList( - node.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER).split(",")); + node.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(",")); List tinList = Arrays.asList( - node.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); + node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); Map>> apmToTinNpiMap = file.getApmTinNpiCombinationMap(); if (apmToTinNpiMap == null || StringUtils.isEmpty(apm)) { @@ -59,12 +60,12 @@ private void validateInvalidApmCombinations(Node node, NodeValidator validator) } private void validateMissingApmCombinations(Node node, NodeValidator validator) { - String program = node.getValue(ClinicalDocumentDecoder.PROGRAM_NAME); + String program = node.getValue(PROGRAM_NAME); String apm = getApmEntityId(node, program); List npiList = Arrays.asList( - node.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER).split(",")); + node.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(",")); List tinList = Arrays.asList( - node.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); + node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(",")); List tinNpiCombinations = createTinNpiMap(tinList, npiList); @@ -97,10 +98,10 @@ private void validateMissingApmCombinations(Node node, NodeValidator validator) private String getApmEntityId(final Node node, final String program) { String apm; - if (ClinicalDocumentDecoder.PCF_PROGRAM_NAME.equalsIgnoreCase(program)) { - apm = node.getValue(ClinicalDocumentDecoder.PCF_ENTITY_ID); - } else if (ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME.equalsIgnoreCase(program)) { - apm = node.getValue(ClinicalDocumentDecoder.PRACTICE_ID); + if (PCF_PROGRAM_NAME.equalsIgnoreCase(program)) { + apm = node.getValue(PCF_ENTITY_ID); + } else if (CPCPLUS_PROGRAM_NAME.equalsIgnoreCase(program)) { + apm = node.getValue(PRACTICE_ID); } else { apm = ""; } diff --git a/rest-api/src/test/java/gov/cms/qpp/conversion/api/helper/MetadataHelperTest.java b/rest-api/src/test/java/gov/cms/qpp/conversion/api/helper/MetadataHelperTest.java index 4e98c21f9..601ec60c1 100644 --- a/rest-api/src/test/java/gov/cms/qpp/conversion/api/helper/MetadataHelperTest.java +++ b/rest-api/src/test/java/gov/cms/qpp/conversion/api/helper/MetadataHelperTest.java @@ -7,13 +7,13 @@ import gov.cms.qpp.conversion.api.helper.MetadataHelper.Outcome; import gov.cms.qpp.conversion.api.model.Constants; import gov.cms.qpp.conversion.api.model.Metadata; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.test.enums.EnumContract; import gov.cms.qpp.test.helper.HelperContract; import static com.google.common.truth.Truth.assertThat; +import static gov.cms.qpp.conversion.model.Constants.*; class MetadataHelperTest implements HelperContract { @@ -42,7 +42,7 @@ void testGenerateMetadataForNullOutcomeThrowsNullPointerException() { @Test void testExtractsPcfProgramType() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "PCF"); + node.putValue(RAW_PROGRAM_NAME, "PCF"); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); assertThat(metadata.getPcf()).startsWith(Constants.PCF_DYNAMO_PARTITION_START); @@ -62,7 +62,7 @@ void testChildLacksCpcPlus() { @Test void testExtractsApm() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.PRACTICE_ID, MOCK_STRING); + node.putValue(PRACTICE_ID, MOCK_STRING); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); assertThat(metadata.getApm()).isEqualTo(MOCK_STRING); @@ -71,8 +71,8 @@ void testExtractsApm() { @Test void testExtractsPcfApm() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.PCF_ENTITY_ID, MOCK_STRING); - node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, ClinicalDocumentDecoder.PCF_PROGRAM_NAME); + node.putValue(PCF_ENTITY_ID, MOCK_STRING); + node.putValue(RAW_PROGRAM_NAME, PCF_PROGRAM_NAME); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); assertThat(metadata.getApm()).isEqualTo(MOCK_STRING); @@ -83,7 +83,7 @@ void testExtractsApmFromChild() { Node node = new Node(); Node child = new Node(); child.setType(TemplateId.CLINICAL_DOCUMENT); - child.putValue(ClinicalDocumentDecoder.PRACTICE_ID, MOCK_STRING); + child.putValue(PRACTICE_ID, MOCK_STRING); node.addChildNode(child); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); @@ -104,7 +104,7 @@ void testChildLacksApm() { @Test void testExtractsTin() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, MOCK_STRING); + node.putValue(TAX_PAYER_IDENTIFICATION_NUMBER, MOCK_STRING); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); assertThat(metadata.getTin()).isEqualTo(MOCK_STRING); @@ -115,7 +115,7 @@ void testExtractsTinFromChild() { Node node = new Node(); Node child = new Node(); child.setType(TemplateId.CLINICAL_DOCUMENT); - child.putValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, MOCK_STRING); + child.putValue(TAX_PAYER_IDENTIFICATION_NUMBER, MOCK_STRING); node.addChildNode(child); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); @@ -136,7 +136,7 @@ void testChildLacksTin() { @Test void testExtractsNpi() { Node node = new Node(); - node.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, MOCK_STRING); + node.putValue(NATIONAL_PROVIDER_IDENTIFIER, MOCK_STRING); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); assertThat(metadata.getNpi()).isEqualTo(MOCK_STRING); @@ -147,7 +147,7 @@ void testExtractsNpiFromChild() { Node node = new Node(); Node child = new Node(); child.setType(TemplateId.CLINICAL_DOCUMENT); - child.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, MOCK_STRING); + child.putValue(NATIONAL_PROVIDER_IDENTIFIER, MOCK_STRING); node.addChildNode(child); Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS); diff --git a/rest-api/src/test/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidatorTest.java b/rest-api/src/test/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidatorTest.java index 929163dd4..7072efe69 100644 --- a/rest-api/src/test/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidatorTest.java +++ b/rest-api/src/test/java/gov/cms/qpp/conversion/api/internal/pii/SpecPiiValidatorTest.java @@ -9,17 +9,18 @@ import com.google.common.truth.Truth; import gov.cms.qpp.conversion.api.model.PcfValidationInfoMap; -import gov.cms.qpp.conversion.decode.ClinicalDocumentDecoder; import gov.cms.qpp.conversion.model.Node; import gov.cms.qpp.conversion.model.TemplateId; import gov.cms.qpp.conversion.validate.NodeValidator; +import static gov.cms.qpp.conversion.model.Constants.*; + public class SpecPiiValidatorTest { @Test void testValidCombination() throws Exception { SpecPiiValidator validator = validator("DogCow_APM", "DogCow_NPI"); - Node node = node("DogCow_APM", "DogCow_NPI,DogCow_NPI2", "DogCow,DogCow", ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME); + Node node = node("DogCow_APM", "DogCow_NPI,DogCow_NPI2", "DogCow,DogCow", CPCPLUS_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -32,7 +33,7 @@ protected void performValidation(Node node) { @Test void testDuplicateSpecStillValid() throws Exception { SpecPiiValidator validator = validatorWithDupeSpec("DogCow_APM", "DogCow_NPI"); - Node node = node("DogCow_APM", "DogCow_NPI", "DogCow", ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME); + Node node = node("DogCow_APM", "DogCow_NPI", "DogCow", CPCPLUS_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -45,7 +46,7 @@ protected void performValidation(Node node) { @Test void testMissingAndInvalidCombination() throws Exception { SpecPiiValidator validator = validator("Valid_DogCow_APM", "Valid_DogCow_NPI"); - Node node = node("Valid_DogCow_APM", "Invalid_Entered_DogCow_NPI", "DogCow", ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME); + Node node = node("Valid_DogCow_APM", "Invalid_Entered_DogCow_NPI", "DogCow", CPCPLUS_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -59,7 +60,7 @@ protected void performValidation(Node node) { @Test void testNullSpec() throws Exception { SpecPiiValidator validator = validator("Valid_DogCow_APM", "Valid_DogCow_NPI"); - Node node = node("DogCow_APM", "Invalid_Entered_DogCow_NPI", "DogCow", ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME); + Node node = node("DogCow_APM", "Invalid_Entered_DogCow_NPI", "DogCow", CPCPLUS_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -72,7 +73,7 @@ protected void performValidation(Node node) { @Test void testMasking() throws Exception { SpecPiiValidator validator = validator("DogCow_APM", "DogCow_NPI"); - Node node = node("DogCow_APM", "DogCow_NPI", "_____INVALID", ClinicalDocumentDecoder.CPCPLUS_PROGRAM_NAME); + Node node = node("DogCow_APM", "DogCow_NPI", "_____INVALID", CPCPLUS_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -86,7 +87,7 @@ protected void performValidation(Node node) { @Test void testValidPcfCombination() throws Exception { SpecPiiValidator validator = validator("DogCow_APM", "DogCow_NPI"); - Node node = node("DogCow_APM", "DogCow_NPI,DogCow_NPI2", "DogCow,DogCow", ClinicalDocumentDecoder.PCF_PROGRAM_NAME); + Node node = node("DogCow_APM", "DogCow_NPI,DogCow_NPI2", "DogCow,DogCow", PCF_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -99,7 +100,7 @@ protected void performValidation(Node node) { @Test void testInvalidApm() throws Exception { SpecPiiValidator validator = validator("DogCow_APM", "DogCow_NPI"); - Node node = node("Invalid_Apm", "DogCow_NPI,DogCow_NPI2", "DogCow,DogCow", ClinicalDocumentDecoder.PCF_PROGRAM_NAME); + Node node = node("Invalid_Apm", "DogCow_NPI,DogCow_NPI2", "DogCow,DogCow", PCF_PROGRAM_NAME); NodeValidator nodeValidator = new NodeValidator() { @Override protected void performValidation(Node node) { @@ -157,11 +158,11 @@ private PcfValidationInfoMap createDuplicatedSpecFile(String apm, String npi) th private Node node(String apm, String npi, String tin, String programName) { Node clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PRACTICE_ID, apm); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PCF_ENTITY_ID, apm); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, npi); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, tin); - clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, programName); + clinicalDocumentNode.putValue(PRACTICE_ID, apm); + clinicalDocumentNode.putValue(PCF_ENTITY_ID, apm); + clinicalDocumentNode.putValue(NATIONAL_PROVIDER_IDENTIFIER, npi); + clinicalDocumentNode.putValue(TAX_PAYER_IDENTIFICATION_NUMBER, tin); + clinicalDocumentNode.putValue(PROGRAM_NAME, programName); return clinicalDocumentNode; }