Search in sources :

Example 11 with RifFileRecords

use of gov.cms.bfd.model.rif.RifFileRecords in project beneficiary-fhir-data by CMSgov.

the class RifFilesProcessorTest method process1HHAClaimRecord.

/**
 * Ensures that {@link RifFilesProcessor} can correctly handle {@link
 * StaticRifResource#SAMPLE_A_HHA}.
 */
@Test
public void process1HHAClaimRecord() {
    RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_HHA.toRifFile());
    RifFilesProcessor processor = new RifFilesProcessor();
    RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
    List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
    assertEquals(StaticRifResource.SAMPLE_A_HHA.getRecordCount(), rifEventsList.size());
    RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
    assertEquals(StaticRifResource.SAMPLE_A_HHA.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
    assertNotNull(rifRecordEvent.getRecord());
    assertTrue(rifRecordEvent.getRecord() instanceof HHAClaim);
    // Verify the claim header.
    HHAClaim claimGroup = (HHAClaim) rifRecordEvent.getRecord();
    assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
    assertEquals(claimGroup.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
    assertEquals("567834", claimGroup.getBeneficiaryId());
    assertEquals("2925555555", claimGroup.getClaimId());
    assertEquals(new BigDecimal(900), claimGroup.getClaimGroupId());
    assertEquals('W', claimGroup.getNearLineRecordIdCode());
    assertEquals("10", claimGroup.getClaimTypeCode());
    assertEquals('2', claimGroup.getClaimServiceClassificationTypeCode());
    assertEquals(LocalDate.of(2015, 6, 23), claimGroup.getDateFrom());
    assertEquals(LocalDate.of(2015, 6, 23), claimGroup.getDateThrough());
    assertEquals("45645", claimGroup.getProviderNumber());
    assertEquals("P", claimGroup.getClaimNonPaymentReasonCode().get());
    assertEquals(new BigDecimal("188.00"), claimGroup.getPaymentAmount());
    assertEquals(new BigDecimal("11.00"), claimGroup.getPrimaryPayerPaidAmount());
    assertEquals("UT", claimGroup.getProviderStateCode());
    assertEquals("1811111111", claimGroup.getOrganizationNpi().get());
    assertEquals("2222222222", claimGroup.getAttendingPhysicianNpi().get());
    assertEquals("30", claimGroup.getPatientDischargeStatusCode());
    assertEquals(new BigDecimal("199.99"), claimGroup.getTotalChargeAmount());
    assertEquals("H5555", claimGroup.getDiagnosisPrincipalCode().get());
    assertEquals('9', claimGroup.getDiagnosisPrincipalCodeVersion().get().charValue());
    assertEquals('L', claimGroup.getClaimLUPACode().get().charValue());
    assertEquals('1', claimGroup.getClaimReferralCode().get().charValue());
    assertEquals(new BigDecimal(3), claimGroup.getTotalVisitCount());
    assertEquals(LocalDate.of(2015, 6, 23), claimGroup.getCareStartDate().get());
    // assertEquals("308683096577486", claimGroup.getFiDocumentClaimControlNumber().get());
    // assertEquals("10493204767560565", claimGroup.getFiOriginalClaimControlNumber().get());
    assertEquals(1, claimGroup.getLines().size());
    // Verify one of the claim lines.
    HHAClaimLine claimLine = claimGroup.getLines().get(0);
    assertEquals(new BigDecimal(1), claimLine.getLineNumber());
    assertEquals("0023", claimLine.getRevenueCenterCode());
    assertEquals(new BigDecimal("26.00"), claimGroup.getLines().get(0).getPaymentAmount());
    assertEquals(new BigDecimal("24.00"), claimGroup.getLines().get(0).getNonCoveredChargeAmount());
    assertEquals(new BigDecimal("25.00"), claimGroup.getLines().get(0).getTotalChargeAmount());
    assertEquals("345345345", claimLine.getRevenueCenterRenderingPhysicianNPI().get());
}
Also used : RifRecordEvent(gov.cms.bfd.model.rif.RifRecordEvent) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) RifFileRecords(gov.cms.bfd.model.rif.RifFileRecords) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) RifFilesEvent(gov.cms.bfd.model.rif.RifFilesEvent) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 12 with RifFileRecords

use of gov.cms.bfd.model.rif.RifFileRecords in project beneficiary-fhir-data by CMSgov.

the class RifFilesProcessorTest method process1DMEClaimRecord.

/**
 * Ensures that {@link RifFilesProcessor} can correctly handle {@link
 * StaticRifResource#SAMPLE_A_DME}.
 */
@Test
public void process1DMEClaimRecord() {
    RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_DME.toRifFile());
    RifFilesProcessor processor = new RifFilesProcessor();
    RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
    List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
    assertEquals(StaticRifResource.SAMPLE_A_DME.getRecordCount(), rifEventsList.size());
    RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
    assertEquals(StaticRifResource.SAMPLE_A_DME.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
    assertNotNull(rifRecordEvent.getRecord());
    assertTrue(rifRecordEvent.getRecord() instanceof DMEClaim);
    // Verify the claim header.
    DMEClaim claimGroup = (DMEClaim) rifRecordEvent.getRecord();
    assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
    assertEquals(claimGroup.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
    assertEquals("567834", claimGroup.getBeneficiaryId());
    assertEquals("2188888888", claimGroup.getClaimId());
    assertEquals(new BigDecimal(900), claimGroup.getClaimGroupId());
    assertEquals('M', claimGroup.getNearLineRecordIdCode());
    assertEquals("82", claimGroup.getClaimTypeCode());
    assertEquals(LocalDate.of(2014, 02, 03), claimGroup.getDateFrom());
    assertEquals(LocalDate.of(2014, 02, 03), claimGroup.getDateThrough());
    assertEquals(LocalDate.of(2014, 02, 14), claimGroup.getWeeklyProcessDate());
    assertEquals('1', claimGroup.getClaimEntryCode());
    assertEquals("01", claimGroup.getClaimDispositionCode());
    assertEquals("99999", claimGroup.getCarrierNumber());
    assertEquals("1", claimGroup.getPaymentDenialCode());
    assertEquals(new BigDecimal("777.75"), claimGroup.getPaymentAmount());
    assertEquals(new BigDecimal("0"), claimGroup.getPrimaryPayerPaidAmount());
    assertEquals('A', claimGroup.getProviderAssignmentIndicator());
    assertEquals(new BigDecimal("666.75"), claimGroup.getProviderPaymentAmount());
    assertEquals(new BigDecimal("666.66"), claimGroup.getBeneficiaryPaymentAmount());
    assertEquals(new BigDecimal("1752.75"), claimGroup.getSubmittedChargeAmount());
    assertEquals(new BigDecimal("754.79"), claimGroup.getAllowedChargeAmount());
    assertEquals(new BigDecimal("777.00"), claimGroup.getBeneficiaryPartBDeductAmount());
    assertEquals('3', claimGroup.getHcpcsYearCode().get().charValue());
    assertEquals("R5555", claimGroup.getDiagnosis1Code().get());
    assertEquals('0', claimGroup.getDiagnosis1CodeVersion().get().charValue());
    assertEquals("1306849450", claimGroup.getReferringPhysicianNpi().get());
    assertEquals("0", claimGroup.getClinicalTrialNumber().get());
    assertEquals(1, claimGroup.getLines().size());
    assertEquals("74655592568216", claimGroup.getClaimCarrierControlNumber().get());
    // Verify one of the claim lines.
    DMEClaimLine claimLine = claimGroup.getLines().get(0);
    assertEquals(new BigDecimal(1), claimLine.getLineNumber());
    assertEquals("9994931888", claimLine.getProviderTaxNumber());
    assertEquals("A5", claimLine.getProviderSpecialityCode().get());
    assertEquals('1', claimLine.getProviderParticipatingIndCode().get().charValue());
    assertEquals(new BigDecimal("60"), claimLine.getServiceCount());
    assertEquals('P', claimLine.getCmsServiceTypeCode());
    assertEquals("12", claimLine.getPlaceOfServiceCode());
    assertEquals(LocalDate.of(2014, 02, 03), claimLine.getFirstExpenseDate().get());
    assertEquals(LocalDate.of(2014, 02, 03), claimLine.getLastExpenseDate().get());
    assertEquals("345", claimLine.getHcpcsCode().get());
    assertFalse(claimLine.getHcpcsSecondModifierCode().isPresent());
    assertFalse(claimLine.getHcpcsThirdModifierCode().isPresent());
    assertFalse(claimLine.getHcpcsFourthModifierCode().isPresent());
    assertEquals("D9Z", claimLine.getBetosCode().get());
    assertEquals(new BigDecimal("123.45"), claimLine.getPaymentAmount());
    assertEquals(new BigDecimal("11.00"), claimLine.getBeneficiaryPaymentAmount());
    assertEquals(new BigDecimal("120.00"), claimLine.getProviderPaymentAmount());
    assertEquals(new BigDecimal("18.00"), claimLine.getBeneficiaryPartBDeductAmount());
    assertTrue(claimLine.getPrimaryPayerCode().isPresent());
    assertEquals(new BigDecimal("11.00"), claimLine.getPrimaryPayerPaidAmount());
    assertEquals(new BigDecimal("20.20"), claimLine.getCoinsuranceAmount());
    assertEquals(new BigDecimal("20.29"), claimLine.getPrimaryPayerAllowedChargeAmount());
    assertEquals(new BigDecimal("130.45"), claimLine.getSubmittedChargeAmount());
    assertEquals(new BigDecimal("129.45"), claimLine.getAllowedChargeAmount());
    assertEquals("A", claimLine.getProcessingIndicatorCode().get());
    assertEquals('0', claimLine.getPaymentCode().get().charValue());
    assertEquals('0', claimLine.getServiceDeductibleCode().get().charValue());
    assertEquals(new BigDecimal("82.29"), claimLine.getPurchasePriceAmount());
    assertEquals("1244444444", claimLine.getProviderNPI().get());
    assertEquals("AL", claimLine.getPricingStateCode().get());
    assertEquals("MO", claimLine.getProviderStateCode());
    assertEquals(new Character('3'), claimLine.getSupplierTypeCode().get());
    assertEquals(new BigDecimal("0.00"), claimLine.getScreenSavingsAmount().get());
    assertEquals(new BigDecimal("60"), claimLine.getMtusCount());
    assertEquals('3', claimLine.getMtusCode().get().charValue());
    assertEquals(new BigDecimal("44.4"), claimLine.getHctHgbTestResult());
    assertEquals("R2", claimLine.getHctHgbTestTypeCode().get());
    assertEquals("500904610", claimLine.getNationalDrugCode().get());
}
Also used : DMEClaim(gov.cms.bfd.model.rif.DMEClaim) RifRecordEvent(gov.cms.bfd.model.rif.RifRecordEvent) RifFileRecords(gov.cms.bfd.model.rif.RifFileRecords) RifFilesEvent(gov.cms.bfd.model.rif.RifFilesEvent) BigDecimal(java.math.BigDecimal) DMEClaimLine(gov.cms.bfd.model.rif.DMEClaimLine) Test(org.junit.jupiter.api.Test)

Example 13 with RifFileRecords

use of gov.cms.bfd.model.rif.RifFileRecords in project beneficiary-fhir-data by CMSgov.

the class RifFilesProcessorTest method process1PDERecord.

/**
 * Ensures that {@link RifFilesProcessor} can correctly handle {@link
 * StaticRifResource#SAMPLE_A_PDE}.
 */
@Test
public void process1PDERecord() {
    RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_PDE.toRifFile());
    RifFilesProcessor processor = new RifFilesProcessor();
    RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
    List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
    assertEquals(StaticRifResource.SAMPLE_A_PDE.getRecordCount(), rifEventsList.size());
    RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
    assertEquals(StaticRifResource.SAMPLE_A_PDE.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
    assertNotNull(rifRecordEvent.getRecord());
    assertTrue(rifRecordEvent.getRecord() instanceof PartDEvent);
    PartDEvent pdeRow = (PartDEvent) rifRecordEvent.getRecord();
    assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
    assertEquals(pdeRow.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
    assertEquals("89", pdeRow.getEventId());
    assertEquals(new BigDecimal(900), pdeRow.getClaimGroupId());
    assertEquals("567834", pdeRow.getBeneficiaryId());
    assertEquals(LocalDate.of(2015, Month.MAY, 12), pdeRow.getPrescriptionFillDate());
    assertEquals(LocalDate.of(2015, Month.MAY, 27), pdeRow.getPaymentDate().get());
    assertEquals("01", pdeRow.getServiceProviderIdQualiferCode());
    assertEquals("1023011079", pdeRow.getServiceProviderId());
    assertEquals("01", pdeRow.getPrescriberIdQualifierCode());
    assertEquals("1750384806", pdeRow.getPrescriberId());
    assertEquals(new BigDecimal(799999), pdeRow.getPrescriptionReferenceNumber());
    assertEquals("500904610", pdeRow.getNationalDrugCode());
    assertEquals("H9999", pdeRow.getPlanContractId());
    assertEquals("020", pdeRow.getPlanBenefitPackageId());
    assertEquals(1, pdeRow.getCompoundCode());
    assertEquals('0', pdeRow.getDispenseAsWrittenProductSelectionCode());
    assertEquals(new BigDecimal("60"), pdeRow.getQuantityDispensed());
    assertEquals(new BigDecimal(30), pdeRow.getDaysSupply());
    assertEquals(new BigDecimal(3), pdeRow.getFillNumber());
    assertEquals(new Character('P'), pdeRow.getDispensingStatusCode().get());
    assertEquals('C', pdeRow.getDrugCoverageStatusCode());
    assertEquals(new Character('A'), pdeRow.getAdjustmentDeletionCode().get());
    assertEquals(new Character('X'), pdeRow.getNonstandardFormatCode().get());
    assertEquals(new Character('M'), pdeRow.getPricingExceptionCode().get());
    assertEquals(new Character('C'), pdeRow.getCatastrophicCoverageCode().get());
    assertEquals(new BigDecimal("995.34"), pdeRow.getGrossCostBelowOutOfPocketThreshold());
    assertEquals(new BigDecimal("15.25"), pdeRow.getGrossCostAboveOutOfPocketThreshold());
    assertEquals(new BigDecimal("235.85"), pdeRow.getPatientPaidAmount());
    assertEquals(new BigDecimal("17.30"), pdeRow.getOtherTrueOutOfPocketPaidAmount());
    assertEquals(new BigDecimal("122.23"), pdeRow.getLowIncomeSubsidyPaidAmount());
    assertEquals(new BigDecimal("42.42"), pdeRow.getPatientLiabilityReductionOtherPaidAmount());
    assertEquals(new BigDecimal("126.99"), pdeRow.getPartDPlanCoveredPaidAmount());
    assertEquals(new BigDecimal("17.98"), pdeRow.getPartDPlanNonCoveredPaidAmount());
    assertEquals(new BigDecimal("550.00"), pdeRow.getTotalPrescriptionCost());
    assertEquals(new Character('3'), pdeRow.getPrescriptionOriginationCode().get());
    assertEquals(new BigDecimal("317.22"), pdeRow.getGapDiscountAmount());
    assertEquals(new Character('G'), pdeRow.getBrandGenericCode().get());
    assertEquals("01", pdeRow.getPharmacyTypeCode());
    assertEquals("02", pdeRow.getPatientResidenceCode());
    assertEquals("08", pdeRow.getSubmissionClarificationCode().get());
}
Also used : RifRecordEvent(gov.cms.bfd.model.rif.RifRecordEvent) RifFileRecords(gov.cms.bfd.model.rif.RifFileRecords) RifFilesEvent(gov.cms.bfd.model.rif.RifFilesEvent) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 14 with RifFileRecords

use of gov.cms.bfd.model.rif.RifFileRecords in project beneficiary-fhir-data by CMSgov.

the class RifFilesProcessorTest method process1InpatientClaimRecord.

/**
 * Ensures that {@link RifFilesProcessor} can correctly handle {@link
 * StaticRifResource#SAMPLE_A_INPATIENT}.
 */
@Test
public void process1InpatientClaimRecord() {
    RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_INPATIENT.toRifFile());
    RifFilesProcessor processor = new RifFilesProcessor();
    RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
    List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
    assertEquals(StaticRifResource.SAMPLE_A_INPATIENT.getRecordCount(), rifEventsList.size());
    RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
    assertEquals(StaticRifResource.SAMPLE_A_INPATIENT.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
    assertNotNull(rifRecordEvent.getRecord());
    assertTrue(rifRecordEvent.getRecord() instanceof InpatientClaim);
    // Verify the claim header.
    InpatientClaim claimGroup = (InpatientClaim) rifRecordEvent.getRecord();
    assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
    assertEquals(claimGroup.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
    assertEquals("567834", claimGroup.getBeneficiaryId());
    assertEquals("333333222222", claimGroup.getClaimId());
    assertEquals(new BigDecimal(900), claimGroup.getClaimGroupId());
    assertEquals('V', claimGroup.getNearLineRecordIdCode());
    assertEquals("60", claimGroup.getClaimTypeCode());
    assertEquals(LocalDate.of(2016, 01, 15), claimGroup.getDateFrom());
    assertEquals(LocalDate.of(2016, 01, 27), claimGroup.getDateThrough());
    assertEquals('3', claimGroup.getClaimQueryCode());
    assertEquals("777776", claimGroup.getProviderNumber());
    assertEquals('1', claimGroup.getClaimServiceClassificationTypeCode());
    assertTrue(claimGroup.getClaimNonPaymentReasonCode().isPresent());
    assertEquals(new BigDecimal("7699.48"), claimGroup.getPaymentAmount());
    assertEquals(new BigDecimal("11.00"), claimGroup.getPrimaryPayerPaidAmount());
    assertEquals("IA", claimGroup.getProviderStateCode());
    assertEquals("5555553305", claimGroup.getOrganizationNpi().get());
    assertEquals("161999999", claimGroup.getAttendingPhysicianNpi().get());
    assertEquals("3333444555", claimGroup.getOperatingPhysicianNpi().get());
    assertEquals("161943433", claimGroup.getOtherPhysicianNpi().get());
    assertEquals("51", claimGroup.getPatientDischargeStatusCode());
    assertEquals(new BigDecimal("84999.37"), claimGroup.getTotalChargeAmount());
    assertEquals(LocalDate.of(2016, 1, 15), claimGroup.getClaimAdmissionDate().get());
    assertEquals('1', claimGroup.getAdmissionTypeCd());
    assertEquals(new Character('4'), claimGroup.getSourceAdmissionCd().get());
    assertEquals(new BigDecimal("10.00"), claimGroup.getPassThruPerDiemAmount());
    assertEquals(new BigDecimal("112.00"), claimGroup.getDeductibleAmount());
    assertEquals(new BigDecimal("5.00"), claimGroup.getPartACoinsuranceLiabilityAmount());
    assertEquals(new BigDecimal("6.00"), claimGroup.getBloodDeductibleLiabilityAmount());
    assertEquals(new BigDecimal("4.00"), claimGroup.getProfessionalComponentCharge());
    assertEquals(new BigDecimal("33.00"), claimGroup.getNoncoveredCharge());
    assertEquals(new BigDecimal("14.00"), claimGroup.getTotalDeductionAmount());
    assertEquals(new BigDecimal("646.23"), claimGroup.getClaimTotalPPSCapitalAmount().get());
    assertEquals(new BigDecimal("552.56"), claimGroup.getClaimPPSCapitalFSPAmount().get());
    assertEquals(new BigDecimal("0"), claimGroup.getClaimPPSCapitalOutlierAmount().get());
    assertEquals(new BigDecimal("68.58"), claimGroup.getClaimPPSCapitalIMEAmount().get());
    assertEquals(new BigDecimal("0"), claimGroup.getClaimPPSCapitalExceptionAmount().get());
    assertEquals(new BigDecimal("0"), claimGroup.getClaimPPSOldCapitalHoldHarmlessAmount().get());
    assertEquals(new BigDecimal(12), claimGroup.getUtilizationDayCount());
    assertEquals(new BigDecimal(0), claimGroup.getCoinsuranceDayCount());
    assertEquals(new BigDecimal(0), claimGroup.getNonUtilizationDayCount());
    assertEquals(new BigDecimal(19), claimGroup.getBloodPintsFurnishedQty());
    assertEquals(LocalDate.of(2016, 1, 27), claimGroup.getBeneficiaryDischargeDate().get());
    assertEquals(new BigDecimal("23.99"), claimGroup.getDrgOutlierApprovedPaymentAmount().get());
    assertEquals("R4444", claimGroup.getDiagnosisAdmittingCode().get());
    assertEquals('0', claimGroup.getDiagnosisAdmittingCodeVersion().get().charValue());
    assertEquals("R5555", claimGroup.getDiagnosisPrincipalCode().get());
    assertEquals('0', claimGroup.getDiagnosisPrincipalCodeVersion().get().charValue());
    assertEquals("R5555", claimGroup.getDiagnosis1Code().get());
    assertEquals('0', claimGroup.getDiagnosis1CodeVersion().get().charValue());
    assertEquals('Y', claimGroup.getDiagnosis1PresentOnAdmissionCode().get().charValue());
    assertEquals("0TCDDEE", claimGroup.getProcedure1Code().get());
    assertEquals('0', claimGroup.getProcedure1CodeVersion().get().charValue());
    assertEquals(LocalDate.of(2016, 1, 16), claimGroup.getProcedure1Date().get());
    assertEquals(new BigDecimal("120.56"), claimGroup.getClaimUncompensatedCareAmount().get());
    assertEquals("28486613848", claimGroup.getFiDocumentClaimControlNumber().get());
    assertEquals("261660474641024", claimGroup.getFiOriginalClaimControlNumber().get());
    assertEquals(1, claimGroup.getLines().size());
    // Verify one of the claim lines.
    InpatientClaimLine claimLine = claimGroup.getLines().get(0);
    assertEquals(new BigDecimal("84888.88"), claimLine.getTotalChargeAmount());
    assertEquals(new BigDecimal("3699.00"), claimLine.getNonCoveredChargeAmount());
    assertEquals("345345345", claimLine.getRevenueCenterRenderingPhysicianNPI().get());
}
Also used : InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) RifRecordEvent(gov.cms.bfd.model.rif.RifRecordEvent) RifFileRecords(gov.cms.bfd.model.rif.RifFileRecords) RifFilesEvent(gov.cms.bfd.model.rif.RifFilesEvent) BigDecimal(java.math.BigDecimal) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine) Test(org.junit.jupiter.api.Test)

Example 15 with RifFileRecords

use of gov.cms.bfd.model.rif.RifFileRecords in project beneficiary-fhir-data by CMSgov.

the class RifFilesProcessorTest method process1OutpatientClaimRecord.

/**
 * Ensures that {@link RifFilesProcessor} can correctly handle {@link
 * StaticRifResource#SAMPLE_A_OUTPATIENT}.
 */
@Test
public void process1OutpatientClaimRecord() {
    RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_OUTPATIENT.toRifFile());
    RifFilesProcessor processor = new RifFilesProcessor();
    RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
    List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
    assertEquals(StaticRifResource.SAMPLE_A_OUTPATIENT.getRecordCount(), rifEventsList.size());
    RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
    assertEquals(StaticRifResource.SAMPLE_A_OUTPATIENT.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
    assertNotNull(rifRecordEvent.getRecord());
    assertTrue(rifRecordEvent.getRecord() instanceof OutpatientClaim);
    // Verify the claim header.
    OutpatientClaim claimGroup = (OutpatientClaim) rifRecordEvent.getRecord();
    assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
    assertEquals(claimGroup.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
    assertEquals("567834", claimGroup.getBeneficiaryId());
    assertEquals("1234567890", claimGroup.getClaimId());
    assertEquals(new BigDecimal(900), claimGroup.getClaimGroupId());
    assertEquals('W', claimGroup.getNearLineRecordIdCode());
    assertEquals("40", claimGroup.getClaimTypeCode());
    assertEquals(LocalDate.of(2011, 01, 24), claimGroup.getDateFrom());
    assertEquals(LocalDate.of(2011, 01, 24), claimGroup.getDateThrough());
    assertEquals('3', claimGroup.getClaimQueryCode());
    assertEquals("999999", claimGroup.getProviderNumber());
    assertEquals("A", claimGroup.getClaimNonPaymentReasonCode().get());
    assertEquals(new BigDecimal("693.11"), claimGroup.getPaymentAmount());
    assertEquals(new BigDecimal("11.00"), claimGroup.getPrimaryPayerPaidAmount());
    assertEquals("KY", claimGroup.getProviderStateCode());
    assertEquals("1497758544", claimGroup.getOrganizationNpi().get());
    assertEquals("2222222222", claimGroup.getAttendingPhysicianNpi().get());
    assertEquals("3333333333", claimGroup.getOperatingPhysicianNpi().get());
    assertTrue(claimGroup.getOtherPhysicianNpi().isPresent());
    assertEquals("1", claimGroup.getPatientDischargeStatusCode().get());
    assertEquals(new BigDecimal("8888.85"), claimGroup.getTotalChargeAmount());
    assertEquals(new BigDecimal("6.00"), claimGroup.getBloodDeductibleLiabilityAmount());
    assertEquals(new BigDecimal("66.89"), claimGroup.getProfessionalComponentCharge());
    assertEquals("R5555", claimGroup.getDiagnosisPrincipalCode().get());
    assertEquals('0', claimGroup.getDiagnosisPrincipalCodeVersion().get().charValue());
    assertEquals("R5555", claimGroup.getDiagnosis1Code().get());
    assertEquals('0', claimGroup.getDiagnosis1CodeVersion().get().charValue());
    assertEquals(new BigDecimal("112.00"), claimGroup.getDeductibleAmount());
    assertEquals(new BigDecimal("175.73"), claimGroup.getCoinsuranceAmount());
    assertEquals(new BigDecimal("693.92"), claimGroup.getProviderPaymentAmount());
    assertEquals(new BigDecimal("44.00"), claimGroup.getBeneficiaryPaymentAmount());
    assertEquals("32490593716374487", claimGroup.getFiDocumentClaimControlNumber().get());
    assertEquals("373273882012", claimGroup.getFiOriginalClaimControlNumber().get());
    assertEquals(1, claimGroup.getLines().size());
    // Verify one of the claim lines.
    OutpatientClaimLine claimLine = claimGroup.getLines().get(0);
    assertEquals(new BigDecimal(25), claimLine.getLineNumber());
    assertEquals("M99", claimGroup.getLines().get(0).getHcpcsCode().get());
    assertEquals("XX", claimGroup.getLines().get(0).getHcpcsInitialModifierCode().get());
    assertFalse(claimLine.getHcpcsSecondModifierCode().isPresent());
    assertEquals(new BigDecimal("10.45"), claimGroup.getLines().get(0).getBloodDeductibleAmount());
    assertEquals(new BigDecimal("12.89"), claimGroup.getLines().get(0).getCashDeductibleAmount());
    assertEquals(new BigDecimal(5000.00), claimGroup.getLines().get(0).getPaymentAmount());
    assertEquals(new BigDecimal(134.00), claimGroup.getLines().get(0).getNonCoveredChargeAmount());
    assertEquals("345345345", claimLine.getRevenueCenterRenderingPhysicianNPI().get());
}
Also used : OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) RifRecordEvent(gov.cms.bfd.model.rif.RifRecordEvent) RifFileRecords(gov.cms.bfd.model.rif.RifFileRecords) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) RifFilesEvent(gov.cms.bfd.model.rif.RifFilesEvent) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Aggregations

RifFileRecords (gov.cms.bfd.model.rif.RifFileRecords)21 RifFilesEvent (gov.cms.bfd.model.rif.RifFilesEvent)19 RifRecordEvent (gov.cms.bfd.model.rif.RifRecordEvent)15 Test (org.junit.jupiter.api.Test)13 BigDecimal (java.math.BigDecimal)10 RifFileEvent (gov.cms.bfd.model.rif.RifFileEvent)9 RifFilesProcessor (gov.cms.bfd.pipeline.ccw.rif.extract.RifFilesProcessor)7 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)5 IOException (java.io.IOException)5 List (java.util.List)5 RifLoader (gov.cms.bfd.pipeline.ccw.rif.load.RifLoader)4 UncheckedIOException (java.io.UncheckedIOException)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 BeneficiaryHistory (gov.cms.bfd.model.rif.BeneficiaryHistory)3 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)3 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)3 StaticRifResource (gov.cms.bfd.model.rif.samples.StaticRifResource)3 LoadAppOptions (gov.cms.bfd.pipeline.ccw.rif.load.LoadAppOptions)3 FileWriter (java.io.FileWriter)3