Search in sources :

Example 21 with Contract

use of org.hl7.fhir.dstu3.model.Contract in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeCoverage.

protected void composeCoverage(Complex parent, String parentType, String name, Coverage element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Coverage", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Coverage", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Coverage", "status", element.getStatusElement(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "Coverage", "type", element.getType(), -1);
    if (element.hasPolicyHolder())
        composeReference(t, "Coverage", "policyHolder", element.getPolicyHolder(), -1);
    if (element.hasSubscriber())
        composeReference(t, "Coverage", "subscriber", element.getSubscriber(), -1);
    if (element.hasSubscriberIdElement())
        composeString(t, "Coverage", "subscriberId", element.getSubscriberIdElement(), -1);
    if (element.hasBeneficiary())
        composeReference(t, "Coverage", "beneficiary", element.getBeneficiary(), -1);
    if (element.hasDependentElement())
        composeString(t, "Coverage", "dependent", element.getDependentElement(), -1);
    if (element.hasRelationship())
        composeCodeableConcept(t, "Coverage", "relationship", element.getRelationship(), -1);
    if (element.hasPeriod())
        composePeriod(t, "Coverage", "period", element.getPeriod(), -1);
    for (int i = 0; i < element.getPayor().size(); i++) composeReference(t, "Coverage", "payor", element.getPayor().get(i), i);
    for (int i = 0; i < element.getClass_().size(); i++) composeCoverageClassComponent(t, "Coverage", "class", element.getClass_().get(i), i);
    if (element.hasOrderElement())
        composePositiveInt(t, "Coverage", "order", element.getOrderElement(), -1);
    if (element.hasNetworkElement())
        composeString(t, "Coverage", "network", element.getNetworkElement(), -1);
    for (int i = 0; i < element.getCostToBeneficiary().size(); i++) composeCoverageCostToBeneficiaryComponent(t, "Coverage", "costToBeneficiary", element.getCostToBeneficiary().get(i), i);
    if (element.hasSubrogationElement())
        composeBoolean(t, "Coverage", "subrogation", element.getSubrogationElement(), -1);
    for (int i = 0; i < element.getContract().size(); i++) composeReference(t, "Coverage", "contract", element.getContract().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 22 with Contract

use of org.hl7.fhir.dstu3.model.Contract in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeContractContractPartyComponent.

protected void composeContractContractPartyComponent(Complex parent, String parentType, String name, Contract.ContractPartyComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "party", name, element, index);
    for (int i = 0; i < element.getReference().size(); i++) composeReference(t, "Contract", "reference", element.getReference().get(i), i);
    if (element.hasRole())
        composeCodeableConcept(t, "Contract", "role", element.getRole(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 23 with Contract

use of org.hl7.fhir.dstu3.model.Contract in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeContractSecurityLabelComponent.

protected void composeContractSecurityLabelComponent(Complex parent, String parentType, String name, Contract.SecurityLabelComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "securityLabel", name, element, index);
    for (int i = 0; i < element.getNumber().size(); i++) composeUnsignedInt(t, "Contract", "number", element.getNumber().get(i), i);
    if (element.hasClassification())
        composeCoding(t, "Contract", "classification", element.getClassification(), -1);
    for (int i = 0; i < element.getCategory().size(); i++) composeCoding(t, "Contract", "category", element.getCategory().get(i), i);
    for (int i = 0; i < element.getControl().size(); i++) composeCoding(t, "Contract", "control", element.getControl().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 24 with Contract

use of org.hl7.fhir.dstu3.model.Contract in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeContractContractOfferComponent.

protected void composeContractContractOfferComponent(Complex parent, String parentType, String name, Contract.ContractOfferComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "offer", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Contract", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getParty().size(); i++) composeContractContractPartyComponent(t, "Contract", "party", element.getParty().get(i), i);
    if (element.hasTopic())
        composeReference(t, "Contract", "topic", element.getTopic(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "Contract", "type", element.getType(), -1);
    if (element.hasDecision())
        composeCodeableConcept(t, "Contract", "decision", element.getDecision(), -1);
    for (int i = 0; i < element.getDecisionMode().size(); i++) composeCodeableConcept(t, "Contract", "decisionMode", element.getDecisionMode().get(i), i);
    for (int i = 0; i < element.getAnswer().size(); i++) composeContractAnswerComponent(t, "Contract", "answer", element.getAnswer().get(i), i);
    if (element.hasTextElement())
        composeString(t, "Contract", "text", element.getTextElement(), -1);
    for (int i = 0; i < element.getLinkId().size(); i++) composeString(t, "Contract", "linkId", element.getLinkId().get(i), i);
    for (int i = 0; i < element.getSecurityLabelNumber().size(); i++) composeUnsignedInt(t, "Contract", "securityLabelNumber", element.getSecurityLabelNumber().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 25 with Contract

use of org.hl7.fhir.dstu3.model.Contract 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)

Aggregations

Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)17 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)12 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)12 Timer (com.codahale.metrics.Timer)6 Test (org.junit.jupiter.api.Test)6 ContractDTO (gov.cms.ab2d.common.dto.ContractDTO)4 CoverageMapping (gov.cms.ab2d.coverage.model.CoverageMapping)4 CoverageSearch (gov.cms.ab2d.coverage.model.CoverageSearch)4 ContractToContractCoverageMapping (gov.cms.ab2d.worker.config.ContractToContractCoverageMapping)4 ArrayList (java.util.ArrayList)4 CoveragePeriod (gov.cms.ab2d.coverage.model.CoveragePeriod)3 CoverageSearchEvent (gov.cms.ab2d.coverage.model.CoverageSearchEvent)3 Coverage (org.hl7.fhir.dstu3.model.Coverage)3 Job (gov.cms.ab2d.common.model.Job)2 PdpClient (gov.cms.ab2d.common.model.PdpClient)2 Identifiers (gov.cms.ab2d.coverage.model.Identifiers)2 LogManager (gov.cms.ab2d.eventlogger.LogManager)2 BundleUtils.createPatient (gov.cms.ab2d.worker.processor.BundleUtils.createPatient)2 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)2 HashMap (java.util.HashMap)2