use of org.hl7.fhir.r4.model.codesystems.ClaimType in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method searchForNonSamhsaEobsWithExcludeSamhsaFalse.
/**
* Verifies that {@link ExplanationOfBenefitResourceProvider#findByPatient} with <code>
* excludeSAMHSA=false</code> properly returns claims that are not SAMHSA-related.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void searchForNonSamhsaEobsWithExcludeSamhsaFalse() throws FHIRException {
// Load the SAMPLE_A resources normally.
Beneficiary beneficiary = loadSampleA();
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
Bundle searchResults = fhirClient.search().forResource(ExplanationOfBenefit.class).where(ExplanationOfBenefit.PATIENT.hasId(TransformerUtils.buildPatientId(beneficiary.getBeneficiaryId()))).and(new StringClientParam("excludeSAMHSA").matches().value("false")).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
for (ClaimType claimType : ClaimType.values()) {
// None of the claims are SAMHSA so we expect one record per claim type in the results.
assertEquals(1, filterToClaimType(searchResults, claimType).size(), String.format("Verify claims of type '%s' are present", claimType));
}
}
use of org.hl7.fhir.r4.model.codesystems.ClaimType in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method searchForSamhsaEobsWithExcludeSamhsaTrue.
/**
* Verifies that {@link ExplanationOfBenefitResourceProvider#findByPatient} with <code>
* excludeSAMHSA=true</code> properly filters out SAMHSA-related claims.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void searchForSamhsaEobsWithExcludeSamhsaTrue() throws FHIRException {
Beneficiary beneficiary = loadSampleAWithSamhsa();
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
Bundle searchResults = fhirClient.search().forResource(ExplanationOfBenefit.class).where(ExplanationOfBenefit.PATIENT.hasId(TransformerUtils.buildPatientId(beneficiary.getBeneficiaryId()))).and(new StringClientParam("excludeSAMHSA").matches().value("true")).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
for (ClaimType claimType : ClaimType.values()) {
/*
* SAMHSA fields are present on all claim types except for PDE so we should not
* get any claims back in the results except for PDE.
*/
if (claimType == ClaimType.PDE) {
assertEquals(1, filterToClaimType(searchResults, claimType).size());
} else {
assertEquals(0, filterToClaimType(searchResults, claimType).size());
}
}
}
use of org.hl7.fhir.r4.model.codesystems.ClaimType in project beneficiary-fhir-data by CMSgov.
the class HHAClaimTransformerTest method assertMatches.
/**
* Verifies that the {@link ExplanationOfBenefit} "looks like" it should, if it were produced from
* the specified {@link HHAClaim}.
*
* @param claim the {@link HHAClaim} that the {@link ExplanationOfBenefit} was generated from
* @param eob the {@link ExplanationOfBenefit} that was generated from the specified {@link
* HHAClaim}
* @throws FHIRException (indicates test failure)
*/
static void assertMatches(HHAClaim claim, ExplanationOfBenefit eob) throws FHIRException {
// Test to ensure group level fields between all claim types match
TransformerTestUtils.assertEobCommonClaimHeaderData(eob, claim.getClaimId(), claim.getBeneficiaryId(), ClaimType.HHA, claim.getClaimGroupId().toPlainString(), MedicareSegment.PART_B, Optional.of(claim.getDateFrom()), Optional.of(claim.getDateThrough()), Optional.of(claim.getPaymentAmount()), claim.getFinalAction());
// test the common field provider number is set as expected in the EOB
TransformerTestUtils.assertProviderNumber(eob, claim.getProviderNumber());
// Test to ensure common group fields between Inpatient, Outpatient HHA, Hospice
// and SNF match
TransformerTestUtils.assertEobCommonGroupInpOutHHAHospiceSNFEquals(eob, claim.getOrganizationNpi(), claim.getClaimFacilityTypeCode(), claim.getClaimFrequencyCode(), claim.getClaimNonPaymentReasonCode(), claim.getPatientDischargeStatusCode(), claim.getClaimServiceClassificationTypeCode(), claim.getClaimPrimaryPayerCode(), claim.getAttendingPhysicianNpi(), claim.getTotalChargeAmount(), claim.getPrimaryPayerPaidAmount(), claim.getFiscalIntermediaryNumber(), claim.getFiDocumentClaimControlNumber(), claim.getFiOriginalClaimControlNumber());
assertEquals(4, eob.getDiagnosis().size());
if (claim.getClaimLUPACode().isPresent())
TransformerTestUtils.assertInfoWithCodeEquals(CcwCodebookVariable.CLM_HHA_LUPA_IND_CD, CcwCodebookVariable.CLM_HHA_LUPA_IND_CD, claim.getClaimLUPACode(), eob);
if (claim.getClaimReferralCode().isPresent())
TransformerTestUtils.assertInfoWithCodeEquals(CcwCodebookVariable.CLM_HHA_RFRL_CD, CcwCodebookVariable.CLM_HHA_RFRL_CD, claim.getClaimReferralCode(), eob);
TransformerTestUtils.assertBenefitBalanceUsedIntEquals(BenefitCategory.MEDICAL, CcwCodebookVariable.CLM_HHA_TOT_VISIT_CNT, claim.getTotalVisitCount().intValue(), eob);
assertEquals(1, eob.getItem().size());
ItemComponent eobItem0 = eob.getItem().get(0);
HHAClaimLine claimLine1 = claim.getLines().get(0);
assertEquals(claimLine1.getLineNumber(), new BigDecimal(eobItem0.getSequence()));
assertEquals(claim.getProviderStateCode(), eobItem0.getLocationAddress().getState());
TransformerTestUtils.assertAdjudicationReasonEquals(CcwCodebookVariable.REV_CNTR_1ST_ANSI_CD, claimLine1.getRevCntr1stAnsiCd(), eobItem0.getAdjudication());
TransformerTestUtils.assertHcpcsCodes(eobItem0, claimLine1.getHcpcsCode(), claimLine1.getHcpcsInitialModifierCode(), claimLine1.getHcpcsSecondModifierCode(), Optional.empty(), 0);
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.REV_CNTR_STUS_IND_CD, claimLine1.getStatusCode().get(), eobItem0.getRevenue());
// test common eob information between Inpatient, HHA, Hospice and SNF claims are set as
// expected
TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFEquals(eob, claim.getCareStartDate(), Optional.empty(), Optional.empty());
// Test to ensure common group field coinsurance between Inpatient, HHA, Hospice and SNF match
TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFCoinsuranceEquals(eobItem0, claimLine1.getDeductibleCoinsuranceCd());
String claimControlNumber = "0000000000";
// Test to ensure item level fields between Inpatient, Outpatient, HHA, Hopsice
// and SNF match
TransformerTestUtils.assertEobCommonItemRevenueEquals(eobItem0, eob, claimLine1.getRevenueCenterCode(), claimLine1.getRateAmount(), claimLine1.getTotalChargeAmount(), claimLine1.getNonCoveredChargeAmount(), claimLine1.getUnitCount(), claimControlNumber, claimLine1.getNationalDrugCodeQuantity(), claimLine1.getNationalDrugCodeQualifierCode(), claimLine1.getRevenueCenterRenderingPhysicianNPI(), 1);
// Test to ensure item level fields between Outpatient, HHA and Hospice match
TransformerTestUtils.assertEobCommonItemRevenueOutHHAHospice(eobItem0, claimLine1.getRevenueCenterDate(), claimLine1.getPaymentAmount());
// verify {@link
// TransformerUtils#mapEobType(CodeableConcept,ClaimType,Optional,Optional)}
// method worked as expected for this claim type
TransformerTestUtils.assertMapEobType(eob.getType(), ClaimType.HHA, // be updated to match expected result.
Optional.empty(), Optional.of(claim.getNearLineRecordIdCode()), Optional.of(claim.getClaimTypeCode()));
// Test lastUpdated
TransformerTestUtils.assertLastUpdatedEquals(claim.getLastUpdated(), eob);
}
use of org.hl7.fhir.r4.model.codesystems.ClaimType in project beneficiary-fhir-data by CMSgov.
the class HospiceClaimTransformerTest method assertMatches.
/**
* Verifies that the {@link ExplanationOfBenefit} "looks like" it should, if it were produced from
* the specified {@link HospiceClaim}.
*
* @param claim the {@link HospiceClaim} that the {@link ExplanationOfBenefit} was generated from
* @param eob the {@link ExplanationOfBenefit} that was generated from the specified {@link
* HospiceClaim}
* @throws FHIRException (indicates test failure)
*/
static void assertMatches(HospiceClaim claim, ExplanationOfBenefit eob) throws FHIRException {
// Test to ensure group level fields between all claim types match
TransformerTestUtils.assertEobCommonClaimHeaderData(eob, claim.getClaimId(), claim.getBeneficiaryId(), ClaimType.HOSPICE, claim.getClaimGroupId().toPlainString(), MedicareSegment.PART_A, Optional.of(claim.getDateFrom()), Optional.of(claim.getDateThrough()), Optional.of(claim.getPaymentAmount()), claim.getFinalAction());
// test the common field provider number is set as expected in the EOB
TransformerTestUtils.assertProviderNumber(eob, claim.getProviderNumber());
TransformerTestUtils.assertInfoWithCodeEquals(CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, claim.getPatientStatusCd(), eob);
TransformerTestUtils.assertDateEquals(claim.getClaimHospiceStartDate().get(), eob.getHospitalization().getStartElement());
TransformerTestUtils.assertDateEquals(claim.getBeneficiaryDischargeDate().get(), eob.getHospitalization().getEndElement());
// Test to ensure common group fields between Inpatient, Outpatient HHA, Hospice
// and SNF match
TransformerTestUtils.assertEobCommonGroupInpOutHHAHospiceSNFEquals(eob, claim.getOrganizationNpi(), claim.getClaimFacilityTypeCode(), claim.getClaimFrequencyCode(), claim.getClaimNonPaymentReasonCode(), claim.getPatientDischargeStatusCode(), claim.getClaimServiceClassificationTypeCode(), claim.getClaimPrimaryPayerCode(), claim.getAttendingPhysicianNpi(), claim.getTotalChargeAmount(), claim.getPrimaryPayerPaidAmount(), claim.getFiscalIntermediaryNumber(), claim.getFiDocumentClaimControlNumber(), claim.getFiOriginalClaimControlNumber());
// test common eob information between Inpatient, HHA, Hospice and SNF claims are set as
// expected
TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFEquals(eob, claim.getClaimHospiceStartDate(), claim.getBeneficiaryDischargeDate(), Optional.of(claim.getUtilizationDayCount()));
assertEquals(4, eob.getDiagnosis().size());
assertEquals(1, eob.getItem().size());
ItemComponent eobItem0 = eob.getItem().get(0);
HospiceClaimLine claimLine1 = claim.getLines().get(0);
assertEquals(claimLine1.getLineNumber(), new BigDecimal(eobItem0.getSequence()));
TransformerTestUtils.assertExtensionQuantityEquals(CcwCodebookVariable.BENE_HOSPC_PRD_CNT, claim.getHospicePeriodCount(), eob.getHospitalization());
assertEquals(claim.getProviderStateCode(), eobItem0.getLocationAddress().getState());
TransformerTestUtils.assertHcpcsCodes(eobItem0, claimLine1.getHcpcsCode(), claimLine1.getHcpcsInitialModifierCode(), claimLine1.getHcpcsSecondModifierCode(), Optional.empty(), 0);
TransformerTestUtils.assertAdjudicationAmountEquals(CcwCodebookVariable.REV_CNTR_PRVDR_PMT_AMT, claimLine1.getProviderPaymentAmount(), eobItem0.getAdjudication());
TransformerTestUtils.assertAdjudicationAmountEquals(CcwCodebookVariable.REV_CNTR_BENE_PMT_AMT, claimLine1.getBenficiaryPaymentAmount(), eobItem0.getAdjudication());
// Test to ensure common group field coinsurance between Inpatient, HHA, Hospice and SNF match
TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFCoinsuranceEquals(eobItem0, claimLine1.getDeductibleCoinsuranceCd());
String claimControlNumber = "0000000000";
// Test to ensure item level fields between Inpatient, Outpatient, HHA, Hopsice
// and SNF match
TransformerTestUtils.assertEobCommonItemRevenueEquals(eobItem0, eob, claimLine1.getRevenueCenterCode(), claimLine1.getRateAmount(), claimLine1.getTotalChargeAmount(), claimLine1.getNonCoveredChargeAmount().get(), claimLine1.getUnitCount(), claimControlNumber, claimLine1.getNationalDrugCodeQuantity(), claimLine1.getNationalDrugCodeQualifierCode(), claimLine1.getRevenueCenterRenderingPhysicianNPI(), 1);
TransformerTestUtils.assertCareTeamEquals(claimLine1.getRevenueCenterRenderingPhysicianNPI().get(), ClaimCareteamrole.PRIMARY, eob);
// Test to ensure item level fields between Outpatient, HHA and Hospice match
TransformerTestUtils.assertEobCommonItemRevenueOutHHAHospice(eobItem0, claimLine1.getRevenueCenterDate(), claimLine1.getPaymentAmount());
// verify {@link
// TransformerUtils#mapEobType(CodeableConcept,ClaimType,Optional,Optional)}
// method worked as expected for this claim type
TransformerTestUtils.assertMapEobType(eob.getType(), ClaimType.HOSPICE, Optional.of(org.hl7.fhir.dstu3.model.codesystems.ClaimType.INSTITUTIONAL), Optional.of(claim.getNearLineRecordIdCode()), Optional.of(claim.getClaimTypeCode()));
// Test lastUpdated
TransformerTestUtils.assertLastUpdatedEquals(claim.getLastUpdated(), eob);
}
use of org.hl7.fhir.r4.model.codesystems.ClaimType in project beneficiary-fhir-data by CMSgov.
the class DMEClaimTransformerTest method assertMatches.
/**
* Verifies that the {@link ExplanationOfBenefit} "looks like" it should, if it were produced from
* the specified {@link DMEClaim}.
*
* @param claim the {@link DMEClaim} that the {@link ExplanationOfBenefit} was generated from
* @param eob the {@link ExplanationOfBenefit} that was generated from the specified {@link
* DMEClaim}@param includedTaxNumbers whether or not to include tax numbers are expected to be
* included in the result (see {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS}, defaults to <code>
* false</code>)
* @throws FHIRException (indicates test failure)
*/
static void assertMatches(DMEClaim claim, ExplanationOfBenefit eob, Optional<Boolean> includedTaxNumbers) throws FHIRException {
// Test to ensure group level fields between all claim types match
TransformerTestUtils.assertEobCommonClaimHeaderData(eob, claim.getClaimId(), claim.getBeneficiaryId(), ClaimType.DME, claim.getClaimGroupId().toPlainString(), MedicareSegment.PART_B, Optional.of(claim.getDateFrom()), Optional.of(claim.getDateThrough()), Optional.of(claim.getPaymentAmount()), claim.getFinalAction());
// Test to ensure common group fields between Carrier and DME match
TransformerTestUtils.assertEobCommonGroupCarrierDMEEquals(eob, claim.getBeneficiaryId(), claim.getCarrierNumber(), claim.getClinicalTrialNumber(), claim.getBeneficiaryPartBDeductAmount(), claim.getPaymentDenialCode(), claim.getReferringPhysicianNpi(), Optional.of(claim.getProviderAssignmentIndicator()), claim.getProviderPaymentAmount(), claim.getBeneficiaryPaymentAmount(), claim.getSubmittedChargeAmount(), claim.getAllowedChargeAmount());
TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.PRPAYAMT, claim.getPrimaryPayerPaidAmount(), eob);
assertEquals(3, eob.getDiagnosis().size());
assertEquals(1, eob.getItem().size());
ItemComponent eobItem0 = eob.getItem().get(0);
DMEClaimLine claimLine1 = claim.getLines().get(0);
assertEquals(claimLine1.getLineNumber(), new BigDecimal(eobItem0.getSequence()));
TransformerTestUtils.assertExtensionIdentifierEquals(CcwCodebookVariable.SUPLRNUM, claimLine1.getProviderBillingNumber(), eobItem0);
TransformerTestUtils.assertCareTeamEquals(claimLine1.getProviderNPI().get(), ClaimCareteamrole.PRIMARY, eob);
CareTeamComponent performingCareTeamEntry = TransformerTestUtils.findCareTeamEntryForProviderNpi(claimLine1.getProviderNPI().get(), eob.getCareTeam());
TransformerTestUtils.assertHasCoding(CcwCodebookVariable.PRVDR_SPCLTY, claimLine1.getProviderSpecialityCode(), performingCareTeamEntry.getQualification());
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.PRTCPTNG_IND_CD, claimLine1.getProviderParticipatingIndCode(), performingCareTeamEntry);
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.PRVDR_STATE_CD, claimLine1.getProviderStateCode(), eobItem0.getLocation());
CareTeamComponent taxNumberCareTeamEntry = TransformerTestUtils.findCareTeamEntryForProviderTaxNumber(claimLine1.getProviderTaxNumber(), eob.getCareTeam());
if (includedTaxNumbers.orElse(false)) {
assertNotNull(taxNumberCareTeamEntry);
} else {
assertNull(taxNumberCareTeamEntry);
}
TransformerTestUtils.assertHcpcsCodes(eobItem0, claimLine1.getHcpcsCode(), claimLine1.getHcpcsInitialModifierCode(), claimLine1.getHcpcsSecondModifierCode(), claim.getHcpcsYearCode(), 0);
TransformerTestUtils.assertHasCoding(TransformerConstants.CODING_SYSTEM_HCPCS, "" + claim.getHcpcsYearCode().get(), null, claimLine1.getHcpcsCode().get(), eobItem0.getService().getCoding());
TransformerTestUtils.assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_PRMRY_ALOWD_CHRG_AMT, claimLine1.getPrimaryPayerAllowedChargeAmount(), eobItem0.getAdjudication());
TransformerTestUtils.assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_DME_PRCHS_PRICE_AMT, claimLine1.getPurchasePriceAmount(), eobItem0.getAdjudication());
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.DMERC_LINE_PRCNG_STATE_CD, claimLine1.getPricingStateCode(), eobItem0.getLocation());
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.DMERC_LINE_SUPPLR_TYPE_CD, claimLine1.getSupplierTypeCode(), eobItem0.getLocation());
TransformerTestUtils.assertExtensionQuantityEquals(CcwCodebookVariable.DMERC_LINE_SCRN_SVGS_AMT, claimLine1.getScreenSavingsAmount(), eobItem0);
TransformerTestUtils.assertQuantityUnitInfoEquals(CcwCodebookVariable.DMERC_LINE_MTUS_CNT, CcwCodebookVariable.DMERC_LINE_MTUS_CD, claimLine1.getMtusCode(), eobItem0);
TransformerTestUtils.assertExtensionQuantityEquals(CcwCodebookVariable.DMERC_LINE_MTUS_CNT, claimLine1.getMtusCount(), eobItem0);
TransformerTestUtils.assertExtensionCodingEquals(eobItem0, TransformerConstants.CODING_NDC, TransformerConstants.CODING_NDC, claimLine1.getNationalDrugCode().get());
// verify {@link
// TransformerUtils#mapEobType(CodeableConcept,ClaimType,Optional,Optional)}
// method worked as expected for this claim type
TransformerTestUtils.assertMapEobType(eob.getType(), ClaimType.DME, // be updated to match expected result.
Optional.empty(), Optional.of(claim.getNearLineRecordIdCode()), Optional.of(claim.getClaimTypeCode()));
// Test to ensure common item fields between Carrier and DME match
TransformerTestUtils.assertEobCommonItemCarrierDMEEquals(eobItem0, eob, claimLine1.getServiceCount(), claimLine1.getPlaceOfServiceCode(), claimLine1.getFirstExpenseDate(), claimLine1.getLastExpenseDate(), claimLine1.getBeneficiaryPaymentAmount(), claimLine1.getProviderPaymentAmount(), claimLine1.getBeneficiaryPartBDeductAmount(), claimLine1.getPrimaryPayerCode(), claimLine1.getPrimaryPayerPaidAmount(), claimLine1.getBetosCode(), claimLine1.getPaymentAmount(), claimLine1.getPaymentCode(), claimLine1.getCoinsuranceAmount(), claimLine1.getSubmittedChargeAmount(), claimLine1.getAllowedChargeAmount(), claimLine1.getProcessingIndicatorCode(), claimLine1.getServiceDeductibleCode(), claimLine1.getDiagnosisCode(), claimLine1.getDiagnosisCodeVersion(), claimLine1.getHctHgbTestTypeCode(), claimLine1.getHctHgbTestResult(), claimLine1.getCmsServiceTypeCode(), claimLine1.getNationalDrugCode());
// Test lastUpdated
TransformerTestUtils.assertLastUpdatedEquals(claim.getLastUpdated(), eob);
}
Aggregations