Search in sources :

Example 6 with CcwCodebookVariable

use of gov.cms.bfd.model.codebook.data.CcwCodebookVariable in project beneficiary-fhir-data by CMSgov.

the class CoverageTransformer method transformPartD.

/**
 * @param metricRegistry the {@link MetricRegistry} to use
 * @param beneficiary the {@link Beneficiary} to generate a {@link MedicareSegment#PART_D} {@link
 *     Coverage} resource for
 * @return {@link MedicareSegment#PART_D} {@link Coverage} resource for the specified {@link
 *     Beneficiary}
 */
private static Coverage transformPartD(MetricRegistry metricRegistry, Beneficiary beneficiary) {
    Timer.Context timer = metricRegistry.timer(MetricRegistry.name(CoverageTransformer.class.getSimpleName(), "transform", "part_d")).time();
    Objects.requireNonNull(beneficiary);
    Coverage coverage = new Coverage();
    coverage.setId(TransformerUtils.buildCoverageId(MedicareSegment.PART_D, beneficiary));
    coverage.getGrouping().setSubGroup(TransformerConstants.COVERAGE_PLAN).setSubPlan(TransformerConstants.COVERAGE_PLAN_PART_D);
    coverage.setType(TransformerUtils.createCodeableConcept(TransformerConstants.COVERAGE_PLAN, TransformerConstants.COVERAGE_PLAN_PART_D));
    coverage.setStatus(CoverageStatus.ACTIVE);
    coverage.setBeneficiary(TransformerUtils.referencePatient(beneficiary));
    if (beneficiary.getMedicareEnrollmentStatusCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.MS_CD, beneficiary.getMedicareEnrollmentStatusCode()));
    }
    // Contract Number
    if (beneficiary.getPartDContractNumberJanId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT01, beneficiary.getPartDContractNumberJanId()));
    }
    if (beneficiary.getPartDContractNumberFebId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT02, beneficiary.getPartDContractNumberFebId()));
    }
    if (beneficiary.getPartDContractNumberMarId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT03, beneficiary.getPartDContractNumberMarId()));
    }
    if (beneficiary.getPartDContractNumberAprId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT04, beneficiary.getPartDContractNumberAprId()));
    }
    if (beneficiary.getPartDContractNumberMayId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT05, beneficiary.getPartDContractNumberMayId()));
    }
    if (beneficiary.getPartDContractNumberJunId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT06, beneficiary.getPartDContractNumberJunId()));
    }
    if (beneficiary.getPartDContractNumberJulId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT07, beneficiary.getPartDContractNumberJulId()));
    }
    if (beneficiary.getPartDContractNumberAugId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT08, beneficiary.getPartDContractNumberAugId()));
    }
    if (beneficiary.getPartDContractNumberSeptId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT09, beneficiary.getPartDContractNumberSeptId()));
    }
    if (beneficiary.getPartDContractNumberOctId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT10, beneficiary.getPartDContractNumberOctId()));
    }
    if (beneficiary.getPartDContractNumberNovId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT11, beneficiary.getPartDContractNumberNovId()));
    }
    if (beneficiary.getPartDContractNumberDecId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDCNTRCT12, beneficiary.getPartDContractNumberDecId()));
    }
    // Beneficiary Monthly Data
    beneficiary.getBeneficiaryMonthlys().forEach(beneMonthly -> {
        int month = beneMonthly.getYearMonth().getMonthValue();
        String yearMonth = String.format("%s-%s", String.valueOf(beneMonthly.getYearMonth().getYear()), String.valueOf(month));
        Map<Integer, CcwCodebookVariable> mapOfMonth = new HashMap<Integer, CcwCodebookVariable>() {

            {
                put(1, CcwCodebookVariable.PTDCNTRCT01);
                put(2, CcwCodebookVariable.PTDCNTRCT02);
                put(3, CcwCodebookVariable.PTDCNTRCT03);
                put(4, CcwCodebookVariable.PTDCNTRCT04);
                put(5, CcwCodebookVariable.PTDCNTRCT05);
                put(6, CcwCodebookVariable.PTDCNTRCT06);
                put(7, CcwCodebookVariable.PTDCNTRCT07);
                put(8, CcwCodebookVariable.PTDCNTRCT08);
                put(9, CcwCodebookVariable.PTDCNTRCT09);
                put(10, CcwCodebookVariable.PTDCNTRCT10);
                put(11, CcwCodebookVariable.PTDCNTRCT11);
                put(12, CcwCodebookVariable.PTDCNTRCT12);
            }
        };
        if (mapOfMonth.containsKey(month)) {
            if (!beneMonthly.getPartDContractNumberId().isPresent() || beneMonthly.getPartDContractNumberId().get().isEmpty()) {
                beneMonthly.setPartDContractNumberId(Optional.of("0"));
            }
            coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, mapOfMonth.get(month), yearMonth, beneMonthly.getPartDContractNumberId()));
        }
    });
    // PBP
    if (beneficiary.getPartDPbpNumberJanId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID01, beneficiary.getPartDPbpNumberJanId()));
    }
    if (beneficiary.getPartDPbpNumberFebId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID02, beneficiary.getPartDPbpNumberFebId()));
    }
    if (beneficiary.getPartDPbpNumberMarId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID03, beneficiary.getPartDPbpNumberMarId()));
    }
    if (beneficiary.getPartDPbpNumberAprId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID04, beneficiary.getPartDPbpNumberAprId()));
    }
    if (beneficiary.getPartDPbpNumberMayId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID05, beneficiary.getPartDPbpNumberMayId()));
    }
    if (beneficiary.getPartDPbpNumberJunId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID06, beneficiary.getPartDPbpNumberJunId()));
    }
    if (beneficiary.getPartDPbpNumberJulId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID07, beneficiary.getPartDPbpNumberJulId()));
    }
    if (beneficiary.getPartDPbpNumberAugId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID08, beneficiary.getPartDPbpNumberAugId()));
    }
    if (beneficiary.getPartDPbpNumberSeptId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID09, beneficiary.getPartDPbpNumberSeptId()));
    }
    if (beneficiary.getPartDPbpNumberOctId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID10, beneficiary.getPartDPbpNumberOctId()));
    }
    if (beneficiary.getPartDPbpNumberNovId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID11, beneficiary.getPartDPbpNumberNovId()));
    }
    if (beneficiary.getPartDPbpNumberDecId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.PTDPBPID12, beneficiary.getPartDPbpNumberDecId()));
    }
    // Segment Number
    if (beneficiary.getPartDSegmentNumberJanId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID01, beneficiary.getPartDSegmentNumberJanId()));
    }
    if (beneficiary.getPartDSegmentNumberFebId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID02, beneficiary.getPartDSegmentNumberFebId()));
    }
    if (beneficiary.getPartDSegmentNumberMarId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID03, beneficiary.getPartDSegmentNumberMarId()));
    }
    if (beneficiary.getPartDSegmentNumberAprId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID04, beneficiary.getPartDSegmentNumberAprId()));
    }
    if (beneficiary.getPartDSegmentNumberMayId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID05, beneficiary.getPartDSegmentNumberMayId()));
    }
    if (beneficiary.getPartDSegmentNumberJunId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID06, beneficiary.getPartDSegmentNumberJunId()));
    }
    if (beneficiary.getPartDSegmentNumberJulId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID07, beneficiary.getPartDSegmentNumberJulId()));
    }
    if (beneficiary.getPartDSegmentNumberAugId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID08, beneficiary.getPartDSegmentNumberAugId()));
    }
    if (beneficiary.getPartDSegmentNumberSeptId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID09, beneficiary.getPartDSegmentNumberSeptId()));
    }
    if (beneficiary.getPartDSegmentNumberOctId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID10, beneficiary.getPartDSegmentNumberOctId()));
    }
    if (beneficiary.getPartDSegmentNumberNovId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID11, beneficiary.getPartDSegmentNumberNovId()));
    }
    if (beneficiary.getPartDSegmentNumberDecId().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.SGMTID12, beneficiary.getPartDSegmentNumberDecId()));
    }
    // Monthly cost sharing group
    if (beneficiary.getPartDLowIncomeCostShareGroupJanCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR01, beneficiary.getPartDLowIncomeCostShareGroupJanCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupFebCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR02, beneficiary.getPartDLowIncomeCostShareGroupFebCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupMarCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR03, beneficiary.getPartDLowIncomeCostShareGroupMarCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupAprCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR04, beneficiary.getPartDLowIncomeCostShareGroupAprCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupMayCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR05, beneficiary.getPartDLowIncomeCostShareGroupMayCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupJunCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR06, beneficiary.getPartDLowIncomeCostShareGroupJunCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupJulCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR07, beneficiary.getPartDLowIncomeCostShareGroupJulCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupAugCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR08, beneficiary.getPartDLowIncomeCostShareGroupAugCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupSeptCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR09, beneficiary.getPartDLowIncomeCostShareGroupSeptCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupOctCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR10, beneficiary.getPartDLowIncomeCostShareGroupOctCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupNovCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR11, beneficiary.getPartDLowIncomeCostShareGroupNovCode()));
    }
    if (beneficiary.getPartDLowIncomeCostShareGroupDecCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CSTSHR12, beneficiary.getPartDLowIncomeCostShareGroupDecCode()));
    }
    // Monthly Part D Retiree Drug Subsidy Indicators
    if (beneficiary.getPartDRetireeDrugSubsidyJanInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND01, beneficiary.getPartDRetireeDrugSubsidyJanInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyFebInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND02, beneficiary.getPartDRetireeDrugSubsidyFebInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyMarInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND03, beneficiary.getPartDRetireeDrugSubsidyMarInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyAprInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND04, beneficiary.getPartDRetireeDrugSubsidyAprInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyMayInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND05, beneficiary.getPartDRetireeDrugSubsidyMayInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyJunInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND06, beneficiary.getPartDRetireeDrugSubsidyJunInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyJulInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND07, beneficiary.getPartDRetireeDrugSubsidyJulInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyAugInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND08, beneficiary.getPartDRetireeDrugSubsidyAugInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidySeptInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND09, beneficiary.getPartDRetireeDrugSubsidySeptInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyOctInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND10, beneficiary.getPartDRetireeDrugSubsidyOctInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyNovInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND11, beneficiary.getPartDRetireeDrugSubsidyNovInd()));
    }
    if (beneficiary.getPartDRetireeDrugSubsidyDecInd().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.RDSIND12, beneficiary.getPartDRetireeDrugSubsidyDecInd()));
    }
    // The reference year of the enrollment data
    if (beneficiary.getBeneEnrollmentReferenceYear().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionDate(CcwCodebookVariable.RFRNC_YR, beneficiary.getBeneEnrollmentReferenceYear()));
    }
    // Monthly Medicare-Medicaid dual eligibility codes
    if (beneficiary.getMedicaidDualEligibilityJanCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_01, beneficiary.getMedicaidDualEligibilityJanCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityFebCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_02, beneficiary.getMedicaidDualEligibilityFebCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityMarCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_03, beneficiary.getMedicaidDualEligibilityMarCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityAprCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_04, beneficiary.getMedicaidDualEligibilityAprCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityMayCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_05, beneficiary.getMedicaidDualEligibilityMayCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityJunCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_06, beneficiary.getMedicaidDualEligibilityJunCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityJulCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_07, beneficiary.getMedicaidDualEligibilityJulCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityAugCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_08, beneficiary.getMedicaidDualEligibilityAugCode()));
    }
    if (beneficiary.getMedicaidDualEligibilitySeptCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_09, beneficiary.getMedicaidDualEligibilitySeptCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityOctCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_10, beneficiary.getMedicaidDualEligibilityOctCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityNovCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_11, beneficiary.getMedicaidDualEligibilityNovCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityDecCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_12, beneficiary.getMedicaidDualEligibilityDecCode()));
    }
    TransformerUtils.setLastUpdated(coverage, beneficiary.getLastUpdated());
    timer.stop();
    return coverage;
}
Also used : CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Timer(com.codahale.metrics.Timer) HashMap(java.util.HashMap) Coverage(org.hl7.fhir.dstu3.model.Coverage)

Example 7 with CcwCodebookVariable

use of gov.cms.bfd.model.codebook.data.CcwCodebookVariable in project beneficiary-fhir-data by CMSgov.

the class CoverageTransformerV2 method transformPartD.

/**
 * @param metricRegistry the {@link MetricRegistry} to use
 * @param beneficiary the {@link Beneficiary} to generate a {@link MedicareSegment#PART_D} {@link
 *     Coverage} resource for
 * @return {@link MedicareSegment#PART_D} {@link Coverage} resource for the specified {@link
 *     Beneficiary}
 */
private static Coverage transformPartD(MetricRegistry metricRegistry, Beneficiary beneficiary) {
    Timer.Context timer = getTimerContext(metricRegistry, "part_d");
    Coverage coverage = new Coverage();
    coverage.getMeta().addProfile(ProfileConstants.C4BB_COVERAGE_URL);
    coverage.setId(TransformerUtilsV2.buildCoverageId(MedicareSegment.PART_D, beneficiary));
    beneficiary.getMedicareBeneficiaryId().ifPresent(value -> coverage.setSubscriberId(value));
    setTypeAndIssuer(coverage);
    setCoverageRelationship(coverage, SubscriberPolicyRelationship.SELF);
    createCoverageClass(coverage, CoverageClass.GROUP, TransformerConstants.COVERAGE_PLAN, Optional.empty());
    createCoverageClass(coverage, CoverageClass.PLAN, TransformerConstants.COVERAGE_PLAN_PART_D, Optional.empty());
    coverage.setStatus(CoverageStatus.ACTIVE);
    coverage.setBeneficiary(TransformerUtilsV2.referencePatient(beneficiary));
    addCoverageExtension(coverage, CcwCodebookVariable.MS_CD, beneficiary.getMedicareEnrollmentStatusCode());
    // Contract Number
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT01, beneficiary.getPartDContractNumberJanId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT02, beneficiary.getPartDContractNumberFebId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT03, beneficiary.getPartDContractNumberMarId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT04, beneficiary.getPartDContractNumberAprId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT05, beneficiary.getPartDContractNumberMayId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT06, beneficiary.getPartDContractNumberJunId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT07, beneficiary.getPartDContractNumberJulId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT08, beneficiary.getPartDContractNumberAugId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT09, beneficiary.getPartDContractNumberSeptId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT10, beneficiary.getPartDContractNumberOctId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT11, beneficiary.getPartDContractNumberNovId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT12, beneficiary.getPartDContractNumberDecId());
    // Beneficiary Monthly Data
    beneficiary.getBeneficiaryMonthlys().forEach(beneMonthly -> {
        int month = beneMonthly.getYearMonth().getMonthValue();
        String yearMonth = String.format("%s-%s", String.valueOf(beneMonthly.getYearMonth().getYear()), String.valueOf(month));
        Map<Integer, CcwCodebookVariable> mapOfMonth = new HashMap<Integer, CcwCodebookVariable>() {

            {
                put(1, CcwCodebookVariable.PTDCNTRCT01);
                put(2, CcwCodebookVariable.PTDCNTRCT02);
                put(3, CcwCodebookVariable.PTDCNTRCT03);
                put(4, CcwCodebookVariable.PTDCNTRCT04);
                put(5, CcwCodebookVariable.PTDCNTRCT05);
                put(6, CcwCodebookVariable.PTDCNTRCT06);
                put(7, CcwCodebookVariable.PTDCNTRCT07);
                put(8, CcwCodebookVariable.PTDCNTRCT08);
                put(9, CcwCodebookVariable.PTDCNTRCT09);
                put(10, CcwCodebookVariable.PTDCNTRCT10);
                put(11, CcwCodebookVariable.PTDCNTRCT11);
                put(12, CcwCodebookVariable.PTDCNTRCT12);
            }
        };
        if (mapOfMonth.containsKey(month)) {
            if (!beneMonthly.getPartDContractNumberId().isPresent() || beneMonthly.getPartDContractNumberId().get().isEmpty()) {
                beneMonthly.setPartDContractNumberId(Optional.of("0"));
            }
            coverage.addExtension(TransformerUtilsV2.createExtensionCoding(coverage, mapOfMonth.get(month), yearMonth, beneMonthly.getPartDContractNumberId()));
        }
    });
    // PBP
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID01, beneficiary.getPartDPbpNumberJanId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID02, beneficiary.getPartDPbpNumberFebId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID03, beneficiary.getPartDPbpNumberMarId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID04, beneficiary.getPartDPbpNumberAprId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID05, beneficiary.getPartDPbpNumberMayId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID06, beneficiary.getPartDPbpNumberJunId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID07, beneficiary.getPartDPbpNumberJulId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID08, beneficiary.getPartDPbpNumberAugId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID09, beneficiary.getPartDPbpNumberSeptId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID10, beneficiary.getPartDPbpNumberOctId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID11, beneficiary.getPartDPbpNumberNovId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID12, beneficiary.getPartDPbpNumberDecId());
    // Segment Number
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID01, beneficiary.getPartDSegmentNumberJanId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID02, beneficiary.getPartDSegmentNumberFebId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID03, beneficiary.getPartDSegmentNumberMarId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID04, beneficiary.getPartDSegmentNumberAprId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID05, beneficiary.getPartDSegmentNumberMayId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID06, beneficiary.getPartDSegmentNumberJunId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID07, beneficiary.getPartDSegmentNumberJulId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID08, beneficiary.getPartDSegmentNumberAugId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID09, beneficiary.getPartDSegmentNumberSeptId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID10, beneficiary.getPartDSegmentNumberOctId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID11, beneficiary.getPartDSegmentNumberNovId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID12, beneficiary.getPartDSegmentNumberDecId());
    // Monthly cost sharing group
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR01, beneficiary.getPartDLowIncomeCostShareGroupJanCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR02, beneficiary.getPartDLowIncomeCostShareGroupFebCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR03, beneficiary.getPartDLowIncomeCostShareGroupMarCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR04, beneficiary.getPartDLowIncomeCostShareGroupAprCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR05, beneficiary.getPartDLowIncomeCostShareGroupMayCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR06, beneficiary.getPartDLowIncomeCostShareGroupJunCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR07, beneficiary.getPartDLowIncomeCostShareGroupJulCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR08, beneficiary.getPartDLowIncomeCostShareGroupAugCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR09, beneficiary.getPartDLowIncomeCostShareGroupSeptCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR10, beneficiary.getPartDLowIncomeCostShareGroupOctCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR11, beneficiary.getPartDLowIncomeCostShareGroupNovCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR12, beneficiary.getPartDLowIncomeCostShareGroupDecCode());
    // Monthly Part D Retiree Drug Subsidy Indicators
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND01, beneficiary.getPartDRetireeDrugSubsidyJanInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND02, beneficiary.getPartDRetireeDrugSubsidyFebInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND03, beneficiary.getPartDRetireeDrugSubsidyMarInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND04, beneficiary.getPartDRetireeDrugSubsidyAprInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND05, beneficiary.getPartDRetireeDrugSubsidyMayInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND06, beneficiary.getPartDRetireeDrugSubsidyJunInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND07, beneficiary.getPartDRetireeDrugSubsidyJulInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND08, beneficiary.getPartDRetireeDrugSubsidyAugInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND09, beneficiary.getPartDRetireeDrugSubsidySeptInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND10, beneficiary.getPartDRetireeDrugSubsidyOctInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND11, beneficiary.getPartDRetireeDrugSubsidyNovInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND12, beneficiary.getPartDRetireeDrugSubsidyDecInd());
    // The reference year of the enrollment data
    addCoverageDecimalExtension(coverage, CcwCodebookVariable.RFRNC_YR, beneficiary.getBeneEnrollmentReferenceYear());
    // Monthly Medicare-Medicaid dual eligibility codes
    transformEntitlementDualEligibility(coverage, beneficiary);
    // update Coverage.meta.lastUpdated
    TransformerUtilsV2.setLastUpdated(coverage, beneficiary.getLastUpdated());
    timer.stop();
    return coverage;
}
Also used : CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Timer(com.codahale.metrics.Timer) HashMap(java.util.HashMap) Coverage(org.hl7.fhir.r4.model.Coverage)

Example 8 with CcwCodebookVariable

use of gov.cms.bfd.model.codebook.data.CcwCodebookVariable in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertAdjudicationReasonEquals.

/**
 * @param expectedCategoryCode the {@link CcwCodebookVariable} for the {@link
 *     AdjudicationComponent#getCategory()} to find and verify
 * @param expectedReasonCode the expected {@link Coding#getCode()} of the {@link
 *     AdjudicationComponent#getReason()} to find and verify
 * @param actuals the actual {@link AdjudicationComponent}s to verify
 */
static void assertAdjudicationReasonEquals(CcwCodebookInterface ccwVariable, Optional<?> expectedReasonCode, List<AdjudicationComponent> actuals) {
    CodeableConcept expectedCategory = TransformerUtils.createAdjudicationCategory(ccwVariable);
    Optional<AdjudicationComponent> adjudication = actuals.stream().filter(a -> isCodeInConcept(a.getCategory(), expectedCategory.getCodingFirstRep().getSystem(), expectedCategory.getCodingFirstRep().getCode())).findAny();
    assertEquals(expectedReasonCode.isPresent(), adjudication.isPresent());
    if (expectedReasonCode.isPresent())
        assertHasCoding(ccwVariable, expectedReasonCode, adjudication.get().getReason());
}
Also used : IBaseHasExtensions(org.hl7.fhir.instance.model.api.IBaseHasExtensions) Arrays(java.util.Arrays) CarrierClaimColumn(gov.cms.bfd.model.rif.CarrierClaimColumn) CcwCodebookInterface(gov.cms.bfd.model.codebook.model.CcwCodebookInterface) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) Extension(org.hl7.fhir.dstu3.model.Extension) IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) SNFClaimColumn(gov.cms.bfd.model.rif.SNFClaimColumn) BigDecimal(java.math.BigDecimal) FhirContext(ca.uhn.fhir.context.FhirContext) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) HHAClaimColumn(gov.cms.bfd.model.rif.HHAClaimColumn) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) Duration(java.time.Duration) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) Method(java.lang.reflect.Method) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Reference(org.hl7.fhir.dstu3.model.Reference) DiagnosisComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.DiagnosisComponent) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) InpatientClaimColumn(gov.cms.bfd.model.rif.InpatientClaimColumn) Instant(java.time.Instant) InvocationTargetException(java.lang.reflect.InvocationTargetException) Quantity(org.hl7.fhir.dstu3.model.Quantity) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) OutpatientClaimColumn(gov.cms.bfd.model.rif.OutpatientClaimColumn) HospiceClaimLine(gov.cms.bfd.model.rif.HospiceClaimLine) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) HospiceClaimColumn(gov.cms.bfd.model.rif.HospiceClaimColumn) Money(org.hl7.fhir.dstu3.model.Money) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine) ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) CCWUtils(gov.cms.bfd.server.war.commons.CCWUtils) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Period(org.hl7.fhir.dstu3.model.Period) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DMEClaimLine(gov.cms.bfd.model.rif.DMEClaimLine) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) BenefitCategory(org.hl7.fhir.dstu3.model.codesystems.BenefitCategory) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Resource(org.hl7.fhir.dstu3.model.Resource) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) IOException(java.io.IOException) Observation(org.hl7.fhir.dstu3.model.Observation) BaseDateTimeType(org.hl7.fhir.dstu3.model.BaseDateTimeType) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) DMEClaimColumn(gov.cms.bfd.model.rif.DMEClaimColumn) FHIRException(org.hl7.fhir.exceptions.FHIRException) IdentifierType(gov.cms.bfd.server.war.commons.IdentifierType) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 9 with CcwCodebookVariable

use of gov.cms.bfd.model.codebook.data.CcwCodebookVariable in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertHasBenefitComponent.

/**
 * @param ccwVariable the {@link CcwCodebookVariable} matching the {@link
 *     BenefitComponent#getType()} to find
 * @param eob the {@link ExplanationOfBenefit} to search
 * @return the {@link BenefitComponent} that was found (if one wasn't, the method will instead
 *     fail with an {@link AssertionFailedError})
 */
private static BenefitComponent assertHasBenefitComponent(CcwCodebookInterface ccwVariable, ExplanationOfBenefit eob) {
    // We only ever map one root EOB.benefitBalance.
    BenefitBalanceComponent benefitBalanceComponent = eob.getBenefitBalanceFirstRep();
    assertNotNull(benefitBalanceComponent);
    Optional<BenefitComponent> benefitOptional = benefitBalanceComponent.getFinancial().stream().filter(bc -> isCodeInConcept(bc.getType(), TransformerConstants.CODING_BBAPI_BENEFIT_BALANCE_TYPE, CCWUtils.calculateVariableReferenceUrl(ccwVariable))).findFirst();
    assertTrue(benefitOptional.isPresent());
    return benefitOptional.get();
}
Also used : IBaseHasExtensions(org.hl7.fhir.instance.model.api.IBaseHasExtensions) Arrays(java.util.Arrays) CarrierClaimColumn(gov.cms.bfd.model.rif.CarrierClaimColumn) CcwCodebookInterface(gov.cms.bfd.model.codebook.model.CcwCodebookInterface) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) Extension(org.hl7.fhir.dstu3.model.Extension) IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) SNFClaimColumn(gov.cms.bfd.model.rif.SNFClaimColumn) BigDecimal(java.math.BigDecimal) FhirContext(ca.uhn.fhir.context.FhirContext) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) HHAClaimColumn(gov.cms.bfd.model.rif.HHAClaimColumn) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) Duration(java.time.Duration) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) Method(java.lang.reflect.Method) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Reference(org.hl7.fhir.dstu3.model.Reference) DiagnosisComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.DiagnosisComponent) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) InpatientClaimColumn(gov.cms.bfd.model.rif.InpatientClaimColumn) Instant(java.time.Instant) InvocationTargetException(java.lang.reflect.InvocationTargetException) Quantity(org.hl7.fhir.dstu3.model.Quantity) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) OutpatientClaimColumn(gov.cms.bfd.model.rif.OutpatientClaimColumn) HospiceClaimLine(gov.cms.bfd.model.rif.HospiceClaimLine) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) HospiceClaimColumn(gov.cms.bfd.model.rif.HospiceClaimColumn) Money(org.hl7.fhir.dstu3.model.Money) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine) ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) CCWUtils(gov.cms.bfd.server.war.commons.CCWUtils) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Period(org.hl7.fhir.dstu3.model.Period) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DMEClaimLine(gov.cms.bfd.model.rif.DMEClaimLine) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) BenefitCategory(org.hl7.fhir.dstu3.model.codesystems.BenefitCategory) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Resource(org.hl7.fhir.dstu3.model.Resource) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) IOException(java.io.IOException) Observation(org.hl7.fhir.dstu3.model.Observation) BaseDateTimeType(org.hl7.fhir.dstu3.model.BaseDateTimeType) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) DMEClaimColumn(gov.cms.bfd.model.rif.DMEClaimColumn) FHIRException(org.hl7.fhir.exceptions.FHIRException) IdentifierType(gov.cms.bfd.server.war.commons.IdentifierType) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent)

Example 10 with CcwCodebookVariable

use of gov.cms.bfd.model.codebook.data.CcwCodebookVariable in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertAdjudicationAmountEquals.

/**
 * @param ccwVariable the {@link CcwCodebookVariable} for the {@link
 *     AdjudicationComponent#getCategory()} to find and verify
 * @param expectedAmount the expected {@link AdjudicationComponent#getAmount()}
 * @param actuals the actual {@link AdjudicationComponent}s to verify
 * @return the {@link AdjudicationComponent} that was found and verified
 */
static AdjudicationComponent assertAdjudicationAmountEquals(CcwCodebookInterface ccwVariable, BigDecimal expectedAmount, List<AdjudicationComponent> actuals) {
    CodeableConcept expectedCategory = TransformerUtils.createAdjudicationCategory(ccwVariable);
    Optional<AdjudicationComponent> adjudication = actuals.stream().filter(a -> isCodeInConcept(a.getCategory(), expectedCategory.getCodingFirstRep().getSystem(), expectedCategory.getCodingFirstRep().getCode())).findAny();
    assertTrue(adjudication.isPresent());
    assertEquivalent(expectedAmount, adjudication.get().getAmount().getValue());
    return adjudication.get();
}
Also used : IBaseHasExtensions(org.hl7.fhir.instance.model.api.IBaseHasExtensions) Arrays(java.util.Arrays) CarrierClaimColumn(gov.cms.bfd.model.rif.CarrierClaimColumn) CcwCodebookInterface(gov.cms.bfd.model.codebook.model.CcwCodebookInterface) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) Extension(org.hl7.fhir.dstu3.model.Extension) IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) SNFClaimColumn(gov.cms.bfd.model.rif.SNFClaimColumn) BigDecimal(java.math.BigDecimal) FhirContext(ca.uhn.fhir.context.FhirContext) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) HHAClaimColumn(gov.cms.bfd.model.rif.HHAClaimColumn) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) Duration(java.time.Duration) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) Method(java.lang.reflect.Method) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Reference(org.hl7.fhir.dstu3.model.Reference) DiagnosisComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.DiagnosisComponent) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) InpatientClaimColumn(gov.cms.bfd.model.rif.InpatientClaimColumn) Instant(java.time.Instant) InvocationTargetException(java.lang.reflect.InvocationTargetException) Quantity(org.hl7.fhir.dstu3.model.Quantity) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) OutpatientClaimColumn(gov.cms.bfd.model.rif.OutpatientClaimColumn) HospiceClaimLine(gov.cms.bfd.model.rif.HospiceClaimLine) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) HospiceClaimColumn(gov.cms.bfd.model.rif.HospiceClaimColumn) Money(org.hl7.fhir.dstu3.model.Money) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine) ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) CCWUtils(gov.cms.bfd.server.war.commons.CCWUtils) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Period(org.hl7.fhir.dstu3.model.Period) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DMEClaimLine(gov.cms.bfd.model.rif.DMEClaimLine) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) BenefitCategory(org.hl7.fhir.dstu3.model.codesystems.BenefitCategory) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Resource(org.hl7.fhir.dstu3.model.Resource) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) IOException(java.io.IOException) Observation(org.hl7.fhir.dstu3.model.Observation) BaseDateTimeType(org.hl7.fhir.dstu3.model.BaseDateTimeType) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) DMEClaimColumn(gov.cms.bfd.model.rif.DMEClaimColumn) FHIRException(org.hl7.fhir.exceptions.FHIRException) IdentifierType(gov.cms.bfd.server.war.commons.IdentifierType) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Aggregations

CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)11 FhirContext (ca.uhn.fhir.context.FhirContext)6 TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)6 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)6 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)6 CarrierClaimColumn (gov.cms.bfd.model.rif.CarrierClaimColumn)6 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)6 DMEClaim (gov.cms.bfd.model.rif.DMEClaim)6 DMEClaimColumn (gov.cms.bfd.model.rif.DMEClaimColumn)6 DMEClaimLine (gov.cms.bfd.model.rif.DMEClaimLine)6 HHAClaim (gov.cms.bfd.model.rif.HHAClaim)6 HHAClaimColumn (gov.cms.bfd.model.rif.HHAClaimColumn)6 HHAClaimLine (gov.cms.bfd.model.rif.HHAClaimLine)6 HospiceClaim (gov.cms.bfd.model.rif.HospiceClaim)6 HospiceClaimColumn (gov.cms.bfd.model.rif.HospiceClaimColumn)6 HospiceClaimLine (gov.cms.bfd.model.rif.HospiceClaimLine)6 InpatientClaim (gov.cms.bfd.model.rif.InpatientClaim)6 InpatientClaimColumn (gov.cms.bfd.model.rif.InpatientClaimColumn)6 InpatientClaimLine (gov.cms.bfd.model.rif.InpatientClaimLine)6 OutpatientClaim (gov.cms.bfd.model.rif.OutpatientClaim)6