use of gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode 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.PreAdjMcsDiagnosisCode 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.PreAdjMcsDiagnosisCode 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.PreAdjMcsDiagnosisCode 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;
}
use of gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode in project beneficiary-fhir-data by CMSgov.
the class R4ClaimSamhsaMatcherTransformerTest method mcsTest.
/**
* These tests check if the transformed MCS claims result in the expected SAMHSA filtering
* outcomes.
*/
@ParameterizedTest(name = "{index}: {0}")
@MethodSource
public void mcsTest(String testName, List<String> diagCodes, List<String> procCodes, boolean expectedResult, String errorMessagePostFix) {
PreAdjMcsClaim entity = new PreAdjMcsClaim();
entity.setLastUpdated(Instant.ofEpochMilli(1));
Set<PreAdjMcsDiagnosisCode> diagnoses = IntStream.range(0, diagCodes.size()).mapToObj(i -> {
String[] dx = diagCodes.get(i).split(":");
PreAdjMcsDiagnosisCode diagCode = new PreAdjMcsDiagnosisCode();
diagCode.setPriority((short) i);
diagCode.setIdrDiagIcdType(dx[0]);
diagCode.setIdrDiagCode(dx[1]);
return diagCode;
}).collect(Collectors.toSet());
entity.setDiagCodes(diagnoses);
Set<PreAdjMcsDetail> procedures = IntStream.range(0, procCodes.size()).mapToObj(i -> {
PreAdjMcsDetail procCode = new PreAdjMcsDetail();
procCode.setIdrDtlToDate(LocalDate.EPOCH);
procCode.setPriority((short) i);
procCode.setIdrProcCode(procCodes.get(i));
return procCode;
}).collect(Collectors.toSet());
entity.setDetails(procedures);
Claim claim = McsClaimTransformerV2.transform(new MetricRegistry(), entity);
R4ClaimSamhsaMatcher matcher = new R4ClaimSamhsaMatcher();
assertEquals(expectedResult, matcher.test(claim), testName + " " + errorMessagePostFix);
}
Aggregations