use of gov.cms.bfd.model.rda.PreAdjMcsDetail in project beneficiary-fhir-data by CMSgov.
the class McsClaimTransformerTest method basicFieldsTestForDetailObjectTransformation.
/**
* Basic smoke test for transformation of detail objects prior to all of the individual field
* tests.
*/
@Test
public void basicFieldsTestForDetailObjectTransformation() {
claim.setIdrClmHdIcn("123456789012345");
claim.setIdrContrId("12345");
claim.setIdrClaimType("3");
claim.setLastUpdated(clock.instant());
final PreAdjMcsDetail detail = new PreAdjMcsDetail();
detail.setIdrClmHdIcn(claim.getIdrClmHdIcn());
detail.setPriority((short) 0);
detail.setIdrDtlStatus("F");
detail.setIdrDtlFromDate(LocalDate.of(2020, 1, 9));
detail.setIdrDtlToDate(LocalDate.of(2020, 1, 10));
detail.setIdrProcCode("abCDe");
detail.setIdrModOne("aB");
detail.setIdrModTwo("Cd");
detail.setIdrModThree("EF");
detail.setIdrModFour("gh");
detail.setIdrDtlDiagIcdType("9");
detail.setIdrDtlPrimaryDiagCode("hetwpqj");
detail.setIdrKPosLnameOrg("123456789012345678901234567890123456789012345678901234567890");
detail.setIdrKPosFname("12345678901234567890123456789012345");
detail.setIdrKPosMname("1234567890123456789012345");
detail.setIdrKPosAddr1("1234567890123456789012345678901234567890123456789012345");
detail.setIdrKPosAddr2_1st("123456789012345678901234567890");
detail.setIdrKPosAddr2_2nd("1234567890123456789012345");
detail.setIdrKPosCity("123456789012345678901234567890");
detail.setIdrKPosState("12");
detail.setIdrKPosZip("123456789012345");
detail.setLastUpdated(clock.instant());
claim.getDetails().add(detail);
claimBuilder.setIdrClmHdIcn("123456789012345").setIdrContrId("12345").setIdrClaimTypeEnum(McsClaimType.CLAIM_TYPE_MEDICAL).addMcsDetails(McsDetail.newBuilder().setIdrDtlStatusEnum(McsDetailStatus.DETAIL_STATUS_FINAL).setIdrDtlFromDate("2020-01-09").setIdrDtlToDate("2020-01-10").setIdrProcCode("abCDe").setIdrModOne("aB").setIdrModTwo("Cd").setIdrModThree("EF").setIdrModFour("gh").setIdrDtlDiagIcdTypeEnum(McsDiagnosisIcdType.DIAGNOSIS_ICD_TYPE_ICD9).setIdrDtlPrimaryDiagCode("hetwpqj").setIdrKPosLnameOrg("123456789012345678901234567890123456789012345678901234567890").setIdrKPosFname("12345678901234567890123456789012345").setIdrKPosMname("1234567890123456789012345").setIdrKPosAddr1("1234567890123456789012345678901234567890123456789012345").setIdrKPosAddr21St("123456789012345678901234567890").setIdrKPosAddr22Nd("1234567890123456789012345").setIdrKPosCity("123456789012345678901234567890").setIdrKPosState("12").setIdrKPosZip("123456789012345").build());
changeBuilder.setChangeType(ChangeType.CHANGE_TYPE_INSERT).setClaim(claimBuilder.build());
assertChangeMatches(RdaChange.Type.INSERT);
PreAdjMcsClaim transformed = transformer.transformClaim(changeBuilder.build()).getClaim();
assertListContentsHaveSamePropertyValues(claim.getDetails(), transformed.getDetails(), PreAdjMcsDetail::getPriority);
}
use of gov.cms.bfd.model.rda.PreAdjMcsDetail in project beneficiary-fhir-data by CMSgov.
the class McsClaimTransformerTest method basicFieldsTestForDiagCodeObjectTransformation.
/**
* Basic smoke test for transformation of diagnosis code objects prior to all of the individual
* field tests.
*/
@Test
public void basicFieldsTestForDiagCodeObjectTransformation() {
claim.setIdrClmHdIcn("123456789012345");
claim.setIdrContrId("12345");
claim.setIdrClaimType("3");
claim.setLastUpdated(clock.instant());
PreAdjMcsDiagnosisCode diagCode = new PreAdjMcsDiagnosisCode();
diagCode.setIdrClmHdIcn(claim.getIdrClmHdIcn());
diagCode.setPriority((short) 0);
diagCode.setIdrDiagIcdType("9");
diagCode.setIdrDiagCode("1234567");
diagCode.setLastUpdated(clock.instant());
claim.getDiagCodes().add(diagCode);
diagCode = new PreAdjMcsDiagnosisCode();
diagCode.setIdrClmHdIcn(claim.getIdrClmHdIcn());
diagCode.setPriority((short) 1);
diagCode.setIdrDiagIcdType("0");
diagCode.setIdrDiagCode("jdsyejs");
diagCode.setLastUpdated(clock.instant());
claim.getDiagCodes().add(diagCode);
claimBuilder.setIdrClmHdIcn("123456789012345").setIdrContrId("12345").setIdrClaimTypeEnum(McsClaimType.CLAIM_TYPE_MEDICAL).addMcsDiagnosisCodes(McsDiagnosisCode.newBuilder().setIdrClmHdIcn("123456789012345").setIdrDiagCode("1234567").setIdrDiagIcdTypeEnum(McsDiagnosisIcdType.DIAGNOSIS_ICD_TYPE_ICD9).build()).addMcsDiagnosisCodes(McsDiagnosisCode.newBuilder().setIdrClmHdIcn("123456789012345").setIdrDiagCode("jdsyejs").setIdrDiagIcdTypeEnum(McsDiagnosisIcdType.DIAGNOSIS_ICD_TYPE_ICD10).build());
changeBuilder.setChangeType(ChangeType.CHANGE_TYPE_INSERT).setClaim(claimBuilder.build());
assertChangeMatches(RdaChange.Type.INSERT);
PreAdjMcsClaim transformed = transformer.transformClaim(changeBuilder.build()).getClaim();
assertListContentsHaveSamePropertyValues(claim.getDetails(), transformed.getDetails(), PreAdjMcsDetail::getPriority);
}
use of gov.cms.bfd.model.rda.PreAdjMcsDetail in project beneficiary-fhir-data by CMSgov.
the class McsClaimRdaSinkIT method mcsClaim.
@Test
public void mcsClaim() throws Exception {
RdaPipelineTestUtils.runTestWithTemporaryDb(McsClaimRdaSinkIT.class, Clock.systemUTC(), (appState, entityManager) -> {
final LocalDate today = LocalDate.of(2022, 1, 3);
final Instant now = today.atStartOfDay().toInstant(ZoneOffset.UTC);
final Clock clock = Clock.fixed(now, ZoneOffset.UTC);
final PreAdjMcsClaim claim = new PreAdjMcsClaim();
claim.setSequenceNumber(7L);
claim.setIdrClmHdIcn("3");
claim.setIdrContrId("c1");
claim.setIdrHic("hc");
claim.setIdrClaimType("c");
claim.setMbiRecord(new Mbi(1L, "12345678901", "hash-of-12345678901"));
final PreAdjMcsDetail detail = new PreAdjMcsDetail();
detail.setIdrClmHdIcn(claim.getIdrClmHdIcn());
detail.setPriority((short) 0);
detail.setIdrDtlStatus("P");
claim.getDetails().add(detail);
final PreAdjMcsDiagnosisCode diagCode = new PreAdjMcsDiagnosisCode();
diagCode.setIdrClmHdIcn(claim.getIdrClmHdIcn());
diagCode.setPriority((short) 0);
diagCode.setIdrDiagIcdType("T");
diagCode.setIdrDiagCode("D");
claim.getDiagCodes().add(diagCode);
final McsDetail detailMessage = McsDetail.newBuilder().setIdrDtlStatusUnrecognized(detail.getIdrDtlStatus()).build();
final McsDiagnosisCode diagCodeMessage = McsDiagnosisCode.newBuilder().setIdrDiagIcdTypeUnrecognized(diagCode.getIdrDiagIcdType()).setIdrDiagCode(diagCode.getIdrDiagCode()).build();
final McsClaim claimMessage = McsClaim.newBuilder().setIdrClmHdIcn(claim.getIdrClmHdIcn()).setIdrContrId(claim.getIdrContrId()).setIdrClaimMbi(claim.getIdrClaimMbi()).setIdrHic(claim.getIdrHic()).setIdrClaimTypeUnrecognized(claim.getIdrClaimType()).addMcsDetails(detailMessage).addMcsDiagnosisCodes(diagCodeMessage).build();
final McsClaimChange message = McsClaimChange.newBuilder().setSeq(claim.getSequenceNumber()).setIcn(claim.getIdrClmHdIcn()).setClaim(claimMessage).build();
final IdHasher hasher = new IdHasher(new IdHasher.Config(1, "notarealpepper"));
final McsClaimTransformer transformer = new McsClaimTransformer(clock, MbiCache.computedCache(hasher.getConfig()));
final McsClaimRdaSink sink = new McsClaimRdaSink(appState, transformer, true);
final String expectedMbiHash = hasher.computeIdentifierHash(claim.getIdrClaimMbi());
assertEquals(Optional.empty(), sink.readMaxExistingSequenceNumber());
int count = sink.writeMessage("version", message);
assertEquals(1, count);
List<PreAdjMcsClaim> resultClaims = entityManager.createQuery("select c from PreAdjMcsClaim c", PreAdjMcsClaim.class).getResultList();
assertEquals(1, resultClaims.size());
PreAdjMcsClaim resultClaim = resultClaims.get(0);
assertEquals(Long.valueOf(7), resultClaim.getSequenceNumber());
assertEquals(claim.getIdrHic(), resultClaim.getIdrHic());
assertEquals(claim.getIdrClaimMbi(), resultClaim.getIdrClaimMbi());
assertEquals(expectedMbiHash, resultClaim.getIdrClaimMbiHash());
assertEquals(claim.getDetails().size(), resultClaim.getDetails().size());
assertEquals(claim.getDiagCodes().size(), resultClaim.getDiagCodes().size());
assertEquals(Optional.of(claim.getSequenceNumber()), sink.readMaxExistingSequenceNumber());
Mbi databaseMbiEntity = RdaPipelineTestUtils.lookupCachedMbi(entityManager, claimMessage.getIdrClaimMbi());
assertNotNull(databaseMbiEntity);
assertEquals(claim.getIdrClaimMbi(), databaseMbiEntity.getMbi());
assertEquals(expectedMbiHash, databaseMbiEntity.getHash());
});
}
use of gov.cms.bfd.model.rda.PreAdjMcsDetail in project beneficiary-fhir-data by CMSgov.
the class RDATestUtils method mcsTestDataA.
/**
* One MCS claim for testing
*
* @return The MCS test claim A
*/
private PreAdjMcsClaim mcsTestDataA(Mbi mbi) {
PreAdjMcsClaim claim = PreAdjMcsClaim.builder().sequenceNumber(1L).idrClmHdIcn("654321").idrContrId("contr").idrHic("HicValue").idrClaimType("R").idrDtlCnt(56).idrBeneLast_1_6("SMITH").idrBeneFirstInit("J").idrBeneMidInit("D").idrBeneSex("M").idrStatusCode("5").idrStatusDate(LocalDate.ofEpochDay(191)).idrBillProvNpi("9876789102").idrBillProvNum("4444422222").idrBillProvEin("1231231231").idrBillProvType("AB").idrBillProvSpec("BA").idrBillProvGroupInd("A").idrBillProvPriceSpec("FF").idrBillProvCounty("GG").idrBillProvLoc("HH").idrTotAllowed(new BigDecimal("323.45")).idrCoinsurance(new BigDecimal("300.45")).idrDeductible(new BigDecimal("23.00")).idrBillProvStatusCd("Z").idrTotBilledAmt(new BigDecimal("23.00")).idrClaimReceiptDate(LocalDate.ofEpochDay(54)).mbiRecord(mbi).idrHdrFromDateOfSvc(LocalDate.ofEpochDay(210)).idrHdrToDateOfSvc(LocalDate.ofEpochDay(210)).lastUpdated(Instant.ofEpochMilli(4000)).build();
Set<PreAdjMcsDetail> procCodes = Set.of(PreAdjMcsDetail.builder().priority((short) 0).idrClmHdIcn("654321").idrDtlToDate(LocalDate.ofEpochDay(208)).idrProcCode("FDSAE").idrModOne("A").build(), PreAdjMcsDetail.builder().priority((short) 1).idrClmHdIcn("654321").idrProcCode("FDAAA").idrModTwo("B").build());
claim.setDetails(procCodes);
claim.setDiagCodes(Set.of(new PreAdjMcsDiagnosisCode("654321", (short) 0, "0", "HF3IJIF", Instant.ofEpochMilli(4000)), new PreAdjMcsDiagnosisCode("654321", (short) 1, "1", "HF3IJIG", Instant.ofEpochMilli(4000))));
return claim;
}
use of gov.cms.bfd.model.rda.PreAdjMcsDetail in project beneficiary-fhir-data by CMSgov.
the class RDATestUtils method mcsTestDataB.
/**
* One MCS claim for testing
*
* @return The MCS test claim B
*/
private PreAdjMcsClaim mcsTestDataB(Mbi mbi) {
PreAdjMcsClaim claim = PreAdjMcsClaim.builder().sequenceNumber(1L).idrClmHdIcn("654323").idrContrId("contr").idrHic("HicValue").idrClaimType("R").idrDtlCnt(56).idrBeneLast_1_6("SMITH").idrBeneFirstInit("J").idrBeneMidInit("D").idrBeneSex("M").idrStatusCode(null).idrStatusDate(LocalDate.ofEpochDay(2)).idrBillProvNpi("9876789102").idrBillProvNum("4444422222").idrBillProvEin("1231231231").idrBillProvType("AB").idrBillProvSpec("BA").idrBillProvGroupInd("A").idrBillProvPriceSpec("FF").idrBillProvCounty("GG").idrBillProvLoc("HH").idrTotAllowed(new BigDecimal("224.41")).idrCoinsurance(new BigDecimal("14.32")).idrDeductible(new BigDecimal("11.00")).idrBillProvStatusCd(null).idrTotBilledAmt(new BigDecimal("23.00")).idrClaimReceiptDate(LocalDate.ofEpochDay(54)).mbiRecord(mbi).idrHdrFromDateOfSvc(LocalDate.ofEpochDay(200)).idrHdrToDateOfSvc(LocalDate.ofEpochDay(200)).lastUpdated(Instant.ofEpochMilli(4000)).build();
Set<PreAdjMcsDetail> procCodes = Set.of(PreAdjMcsDetail.builder().priority((short) 0).idrClmHdIcn("654323").idrDtlToDate(LocalDate.ofEpochDay(208)).idrProcCode("FDSAE").idrModOne("A").build(), PreAdjMcsDetail.builder().priority((short) 1).idrClmHdIcn("654323").idrProcCode("FDAAA").idrModTwo("B").build());
claim.setDetails(procCodes);
claim.setDiagCodes(Set.of(new PreAdjMcsDiagnosisCode("654323", (short) 0, "0", "HF3IJIF", Instant.ofEpochMilli(4000)), new PreAdjMcsDiagnosisCode("654323", (short) 1, "1", "HF3IJIG", Instant.ofEpochMilli(4000))));
return claim;
}
Aggregations