Search in sources :

Example 46 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method addInformation.

/**
 * Returns a new {@link SupportingInformationComponent} that has been added to the specified
 * {@link ExplanationOfBenefit}.
 *
 * @param eob the {@link ExplanationOfBenefit} to modify
 * @param categoryVariable {@link CcwCodebookInterface to map to {@link
 *     SupportingInformationComponent#getCategory()}
 * @return the newly-added {@link SupportingInformationComponent} entry
 */
static SupportingInformationComponent addInformation(ExplanationOfBenefit eob, CcwCodebookInterface categoryVariable) {
    int maxSequence = eob.getInformation().stream().mapToInt(i -> i.getSequence()).max().orElse(0);
    SupportingInformationComponent infoComponent = new SupportingInformationComponent();
    infoComponent.setSequence(maxSequence + 1);
    infoComponent.setCategory(createCodeableConceptForFieldId(eob, TransformerConstants.CODING_BBAPI_INFORMATION_CATEGORY, categoryVariable));
    eob.getInformation().add(infoComponent);
    return infoComponent;
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)

Example 47 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method addCommonEobInformationInpatientSNF.

/**
 * Adds EOB information to fields that are common between the Inpatient and SNF claim types.
 *
 * @param eob the {@link ExplanationOfBenefit} that fields will be added to by this method
 * @param admissionTypeCd CLM_IP_ADMSN_TYPE_CD: a {@link Character} shared field representing the
 *     admission type cd for the claim
 * @param sourceAdmissionCd CLM_SRC_IP_ADMSN_CD: an {@link Optional}<{@link Character}>
 *     shared field representing the source admission cd for the claim
 * @param noncoveredStayFromDate NCH_VRFD_NCVRD_STAY_FROM_DT: an {@link Optional}<{@link
 *     LocalDate}> shared field representing the non-covered stay from date for the claim
 * @param noncoveredStayThroughDate NCH_VRFD_NCVRD_STAY_THRU_DT: an {@link Optional}<{@link
 *     LocalDate}> shared field representing the non-covered stay through date for the claim
 * @param coveredCareThroughDate NCH_ACTV_OR_CVRD_LVL_CARE_THRU: an {@link Optional}<{@link
 *     LocalDate}> shared field representing the covered stay through date for the claim
 * @param medicareBenefitsExhaustedDate NCH_BENE_MDCR_BNFTS_EXHTD_DT_I: an {@link
 *     Optional}<{@link LocalDate}> shared field representing the medicare benefits
 *     exhausted date for the claim
 * @param diagnosisRelatedGroupCd CLM_DRG_CD: an {@link Optional}<{@link String}> shared
 *     field representing the non-covered stay from date for the claim
 */
static void addCommonEobInformationInpatientSNF(ExplanationOfBenefit eob, Character admissionTypeCd, Optional<Character> sourceAdmissionCd, Optional<LocalDate> noncoveredStayFromDate, Optional<LocalDate> noncoveredStayThroughDate, Optional<LocalDate> coveredCareThroughDate, Optional<LocalDate> medicareBenefitsExhaustedDate, Optional<String> diagnosisRelatedGroupCd) {
    // admissionTypeCd
    addInformationWithCode(eob, CcwCodebookVariable.CLM_IP_ADMSN_TYPE_CD, CcwCodebookVariable.CLM_IP_ADMSN_TYPE_CD, admissionTypeCd);
    // sourceAdmissionCd
    if (sourceAdmissionCd.isPresent()) {
        addInformationWithCode(eob, CcwCodebookVariable.CLM_SRC_IP_ADMSN_CD, CcwCodebookVariable.CLM_SRC_IP_ADMSN_CD, sourceAdmissionCd);
    }
    // noncoveredStayFromDate & noncoveredStayThroughDate
    if (noncoveredStayFromDate.isPresent() || noncoveredStayThroughDate.isPresent()) {
        TransformerUtils.validatePeriodDates(noncoveredStayFromDate, noncoveredStayThroughDate);
        SupportingInformationComponent nchVrfdNcvrdStayInfo = TransformerUtils.addInformation(eob, CcwCodebookVariable.NCH_VRFD_NCVRD_STAY_FROM_DT);
        Period nchVrfdNcvrdStayPeriod = new Period();
        if (noncoveredStayFromDate.isPresent())
            nchVrfdNcvrdStayPeriod.setStart(TransformerUtils.convertToDate((noncoveredStayFromDate.get())), TemporalPrecisionEnum.DAY);
        if (noncoveredStayThroughDate.isPresent())
            nchVrfdNcvrdStayPeriod.setEnd(TransformerUtils.convertToDate((noncoveredStayThroughDate.get())), TemporalPrecisionEnum.DAY);
        nchVrfdNcvrdStayInfo.setTiming(nchVrfdNcvrdStayPeriod);
    }
    // coveredCareThroughDate
    if (coveredCareThroughDate.isPresent()) {
        SupportingInformationComponent nchActvOrCvrdLvlCareThruInfo = TransformerUtils.addInformation(eob, CcwCodebookVariable.NCH_ACTV_OR_CVRD_LVL_CARE_THRU);
        nchActvOrCvrdLvlCareThruInfo.setTiming(new DateType(TransformerUtils.convertToDate(coveredCareThroughDate.get())));
    }
    // medicareBenefitsExhaustedDate
    if (medicareBenefitsExhaustedDate.isPresent()) {
        SupportingInformationComponent nchBeneMdcrBnftsExhtdDtIInfo = TransformerUtils.addInformation(eob, CcwCodebookVariable.NCH_BENE_MDCR_BNFTS_EXHTD_DT_I);
        nchBeneMdcrBnftsExhtdDtIInfo.setTiming(new DateType(TransformerUtils.convertToDate(medicareBenefitsExhaustedDate.get())));
    }
    // diagnosisRelatedGroupCd
    if (diagnosisRelatedGroupCd.isPresent()) {
        /*
       * FIXME This is an invalid DiagnosisComponent, since it's missing a (required) ICD code.
       * Instead, stick the DRG on the claim's primary/first diagnosis. SamhsaMatcher uses this
       * field so if this is updated you'll need to update that as well.
       */
        eob.addDiagnosis().setPackageCode(createCodeableConcept(eob, CcwCodebookVariable.CLM_DRG_CD, diagnosisRelatedGroupCd));
    }
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) Period(org.hl7.fhir.dstu3.model.Period) DateType(org.hl7.fhir.dstu3.model.DateType)

Example 48 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method addInformationWithCode.

/**
 * Returns a new {@link SupportingInformationComponent} that has been added to the specified
 * {@link ExplanationOfBenefit}. Unlike {@link #addInformation(ExplanationOfBenefit,
 * CcwCodebookVariable)}, this also sets the {@link SupportingInformationComponent#getCode()}
 * based on the values provided.
 *
 * @param eob the {@link ExplanationOfBenefit} to modify
 * @param categoryVariable {@link CcwCodebookInterface} to map to {@link
 *     SupportingInformationComponent#getCategory()}
 * @param codeSystemVariable the {@link CcwCodebookInterface} to map to the {@link
 *     Coding#getSystem()} used in the {@link SupportingInformationComponent#getCode()}
 * @param codeValue the value to map to the {@link Coding#getCode()} used in the {@link
 *     SupportingInformationComponent#getCode()}
 * @return the newly-added {@link SupportingInformationComponent} entry
 */
static SupportingInformationComponent addInformationWithCode(ExplanationOfBenefit eob, CcwCodebookInterface categoryVariable, CcwCodebookInterface codeSystemVariable, Optional<?> codeValue) {
    SupportingInformationComponent infoComponent = addInformation(eob, categoryVariable);
    CodeableConcept infoCode = new CodeableConcept().addCoding(createCoding(eob, codeSystemVariable, codeValue));
    infoComponent.setCode(infoCode);
    return infoComponent;
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 49 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class HHAClaimTransformerV2Test method shouldHaveTypeOfBillSupInfo.

@Test
public void shouldHaveTypeOfBillSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("typeofbill", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType", "typeofbill", "Type of Bill")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/clm_freq_cd", "1", "Admit thru discharge claim"));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 50 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class HHAClaimTransformerV2Test method shouldHaveAdmissionPeriodSupInfo.

@Test
public void shouldHaveAdmissionPeriodSupInfo() throws Exception {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("admissionperiod", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType", "admissionperiod", "Admission Period")));
    // timingPeriod
    Period period = new Period();
    period.setStart(new SimpleDateFormat("yyy-MM-dd").parse("2015-06-23"), TemporalPrecisionEnum.DAY);
    compare.setTiming(period);
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Period(org.hl7.fhir.r4.model.Period) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.jupiter.api.Test)

Aggregations

SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)68 Coding (org.hl7.fhir.r4.model.Coding)59 Test (org.junit.jupiter.api.Test)59 SupportingInformationComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)11 DateType (org.hl7.fhir.r4.model.DateType)11 Period (org.hl7.fhir.r4.model.Period)6 SNFClaimLine (gov.cms.bfd.model.rif.SNFClaimLine)4 Quantity (org.hl7.fhir.r4.model.Quantity)4 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)3 BigDecimal (java.math.BigDecimal)3 SimpleDateFormat (java.text.SimpleDateFormat)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3 SimpleQuantity (org.hl7.fhir.r4.model.SimpleQuantity)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)2 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)2 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)2 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)2 CarrierClaimColumn (gov.cms.bfd.model.rif.CarrierClaimColumn)2 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)2