use of gov.cms.bfd.model.rda.Mbi in project beneficiary-fhir-data by CMSgov.
the class MbiCacheIT method usesExistingRecordWhenOneExists.
@Test
public void usesExistingRecordWhenOneExists() throws Exception {
RdaPipelineTestUtils.runTestWithTemporaryDb(FissClaimRdaSinkIT.class, Clock.systemUTC(), (appState, entityManager) -> {
final String fakeHash1 = "not-a-real-hash-but-loads-from-db";
// preload our fake hash code
entityManager.getTransaction().begin();
entityManager.persist(new Mbi(mbi1, fakeHash1));
entityManager.getTransaction().commit();
// verify our fake is used instead of a computed correct one
final MbiCache mbiCache = MbiCache.databaseCache(entityManager, normalHasher);
assertEquals(fakeHash1, mbiCache.lookupMbi(mbi1).getHash());
assertEquals(fakeHash1, mbiCache.lookupMbi(mbi1).getHash());
// verify database still contains our fake hash
Mbi databaseMbiEntity = RdaPipelineTestUtils.lookupCachedMbi(entityManager, mbi1);
assertNotNull(databaseMbiEntity);
assertEquals(fakeHash1, databaseMbiEntity.getHash());
});
}
use of gov.cms.bfd.model.rda.Mbi in project beneficiary-fhir-data by CMSgov.
the class RdaPipelineTestUtils method lookupCachedMbi.
/**
* Looks for a record in the MbiCache table using the given EntityManager.
*
* @param entityManager used to perform the query
* @param mbi mbi string to look for
* @return null if not cached otherwise the Mbi record from database
*/
public static Mbi lookupCachedMbi(EntityManager entityManager, String mbi) {
entityManager.getTransaction().begin();
final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
final CriteriaQuery<Mbi> criteria = builder.createQuery(Mbi.class);
final Root<Mbi> root = criteria.from(Mbi.class);
criteria.select(root).where(builder.equal(root.get(Mbi.Fields.mbi), mbi));
final var records = entityManager.createQuery(criteria).getResultList();
entityManager.getTransaction().commit();
return records.isEmpty() ? null : records.get(0);
}
use of gov.cms.bfd.model.rda.Mbi in project beneficiary-fhir-data by CMSgov.
the class FissClaimTransformerTest method basicFieldsTestForClaimObjectTransformation.
/**
* Basic smoke test for transformation of claim objects prior to all of the individual field
* tests.
*/
@Test
public void basicFieldsTestForClaimObjectTransformation() {
claim.setDcn("dcn");
claim.setSequenceNumber(42L);
claim.setHicNo("hicn");
claim.setCurrStatus('M');
claim.setCurrLoc1('M');
claim.setCurrLoc2("9000");
claim.setMedaProvId("mpi");
claim.setMedaProv_6("mp_6");
claim.setTotalChargeAmount(new BigDecimal("1002.54"));
claim.setReceivedDate(LocalDate.of(2020, 1, 2));
claim.setCurrTranDate(LocalDate.of(2021, 3, 4));
claim.setAdmitDiagCode("1234567");
claim.setPrincipleDiag("7654321");
claim.setNpiNumber("npi-123456");
claim.setMbiRecord(new Mbi(1L, "12345678901", "3cf7b310f8fd6e7b275ddbdc6c3cd5b4eec0ea10bc9a504d471b086bd5d9b888"));
claim.setFedTaxNumber("1234567890");
claim.setPracLocAddr1("loc-address-1");
claim.setPracLocAddr2("loc-address-2");
claim.setPracLocCity("loc-city");
claim.setPracLocState("ls");
claim.setPracLocZip("123456789012345");
claim.setStmtCovFromDate(LocalDate.of(2020, 2, 3));
claim.setStmtCovToDate(LocalDate.of(2021, 4, 5));
claim.setLobCd("1");
claim.setServTypeCd("6");
claim.setServTypeCdMapping(PreAdjFissClaim.ServTypeCdMapping.Clinic);
claim.setFreqCd("G");
claim.setBillTypCd("ABC");
claim.setLastUpdated(clock.instant());
claimBuilder.setDcn("dcn").setHicNo("hicn").setCurrStatusEnum(FissClaimStatus.CLAIM_STATUS_MOVE).setCurrLoc1Enum(FissProcessingType.PROCESSING_TYPE_MANUAL).setCurrLoc2Enum(FissCurrentLocation2.CURRENT_LOCATION_2_CABLE).setMedaProvId("mpi").setMedaProv6("mp_6").setTotalChargeAmount("1002.54").setRecdDtCymd("2020-01-02").setCurrTranDtCymd("2021-03-04").setAdmDiagCode("1234567").setPrincipleDiag("7654321").setNpiNumber("npi-123456").setMbi("12345678901").setFedTaxNb("1234567890").setPracLocAddr1("loc-address-1").setPracLocAddr2("loc-address-2").setPracLocCity("loc-city").setPracLocState("ls").setPracLocZip("123456789012345").setStmtCovFromCymd("2020-02-03").setStmtCovToCymd("2021-04-05").setLobCdEnum(FissBillFacilityType.BILL_FACILITY_TYPE_HOSPITAL).setServTypeCdForClinicsEnum(FissBillClassificationForClinics.BILL_CLASSIFICATION_FOR_CLINICS_COMMUNITY_MENTAL_HEALTH_CENTER).setFreqCdEnum(FissBillFrequency.BILL_FREQUENCY_ADJUSTMENT_CLAIM_G).setBillTypCd("ABC");
changeBuilder.setSeq(42).setChangeType(ChangeType.CHANGE_TYPE_UPDATE).setClaim(claimBuilder.build());
assertChangeMatches(RdaChange.Type.UPDATE);
}
use of gov.cms.bfd.model.rda.Mbi in project beneficiary-fhir-data by CMSgov.
the class McsClaimTransformerTest method basicFieldsTestForClaimObjectTransformation.
/**
* Basic smoke test for transformation of claim objects prior to all of the individual field
* tests.
*/
@Test
public void basicFieldsTestForClaimObjectTransformation() {
claim.setSequenceNumber(42L);
claim.setIdrClmHdIcn("123456789012345");
claim.setIdrContrId("12345");
claim.setIdrHic("123456789012");
claim.setIdrClaimType("3");
claim.setIdrDtlCnt(0);
claim.setIdrBeneLast_1_6("123456");
claim.setIdrBeneFirstInit("7");
claim.setIdrBeneMidInit("8");
claim.setIdrBeneSex("F");
claim.setIdrStatusCode("A");
claim.setIdrStatusDate(LocalDate.of(2020, 2, 3));
claim.setIdrBillProvNpi("CDEFGHIJKL");
claim.setIdrBillProvNum("MNOPQRSTUV");
claim.setIdrBillProvEin("WXYZabcdef");
claim.setIdrBillProvType("RS");
claim.setIdrBillProvSpec("tu");
claim.setIdrBillProvGroupInd("v");
claim.setIdrBillProvPriceSpec("rw");
claim.setIdrBillProvCounty("34");
claim.setIdrBillProvLoc("43");
claim.setIdrTotAllowed(new BigDecimal("12345.42"));
claim.setIdrCoinsurance(new BigDecimal("67890.94"));
claim.setIdrDeductible(new BigDecimal("87945.28"));
claim.setIdrBillProvStatusCd("P");
claim.setIdrTotBilledAmt(new BigDecimal("67591.96"));
claim.setIdrClaimReceiptDate(LocalDate.of(2020, 2, 1));
claim.setMbiRecord(new Mbi(1L, "54678912456", "717ac79ed263a61100f92f7ca67df9249501d52ee4d1af49ea43b457fcabf0d1"));
claim.setIdrHdrFromDateOfSvc(LocalDate.of(2020, 1, 7));
claim.setIdrHdrToDateOfSvc(LocalDate.of(2020, 1, 14));
claim.setLastUpdated(clock.instant());
claimBuilder.setIdrClmHdIcn("123456789012345").setIdrContrId("12345").setIdrHic("123456789012").setIdrClaimTypeEnum(McsClaimType.CLAIM_TYPE_MEDICAL).setIdrDtlCnt(0).setIdrBeneLast16("123456").setIdrBeneFirstInit("7").setIdrBeneMidInit("8").setIdrBeneSexEnum(McsBeneficiarySex.BENEFICIARY_SEX_FEMALE).setIdrStatusCodeEnum(McsStatusCode.STATUS_CODE_ACTIVE_A).setIdrStatusDate("2020-02-03").setIdrBillProvNpi("CDEFGHIJKL").setIdrBillProvNum("MNOPQRSTUV").setIdrBillProvEin("WXYZabcdef").setIdrBillProvType("RS").setIdrBillProvSpec("tu").setIdrBillProvGroupIndUnrecognized("v").setIdrBillProvPriceSpec("rw").setIdrBillProvCounty("34").setIdrBillProvLoc("43").setIdrTotAllowed("12345.42").setIdrCoinsurance("67890.94").setIdrDeductible("87945.28").setIdrBillProvStatusCdEnum(McsBillingProviderStatusCode.BILLING_PROVIDER_STATUS_CODE_PARTICIPATING).setIdrTotBilledAmt("67591.96").setIdrClaimReceiptDate("2020-02-01").setIdrClaimMbi("54678912456").setIdrHdrFromDos("2020-01-07").setIdrHdrToDos("2020-01-14");
changeBuilder.setChangeType(ChangeType.CHANGE_TYPE_INSERT).setSeq(42).setClaim(claimBuilder.build());
assertChangeMatches(RdaChange.Type.INSERT);
}
Aggregations