use of gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode in project beneficiary-fhir-data by CMSgov.
the class FissClaimRdaSinkIT method fissClaim.
@Test
public void fissClaim() throws Exception {
RdaPipelineTestUtils.runTestWithTemporaryDb(FissClaimRdaSinkIT.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 PreAdjFissClaim claim = new PreAdjFissClaim();
claim.setSequenceNumber(3L);
claim.setDcn("1");
claim.setHicNo("h1");
claim.setCurrStatus('T');
claim.setCurrLoc1('A');
claim.setCurrLoc2("1A");
claim.setPracLocCity("city name can be very long indeed");
claim.setMbiRecord(new Mbi(1L, "12345678901", "hash-of-12345678901"));
final PreAdjFissProcCode procCode0 = new PreAdjFissProcCode();
procCode0.setDcn(claim.getDcn());
procCode0.setPriority((short) 0);
procCode0.setProcCode("P");
procCode0.setProcFlag("F");
procCode0.setProcDate(today);
claim.getProcCodes().add(procCode0);
final PreAdjFissDiagnosisCode diagCode0 = new PreAdjFissDiagnosisCode();
diagCode0.setDcn(claim.getDcn());
diagCode0.setPriority((short) 0);
diagCode0.setDiagCd2("cd2");
diagCode0.setDiagPoaInd("Q");
claim.getDiagCodes().add(diagCode0);
final FissProcedureCode procCodeMessage = FissProcedureCode.newBuilder().setProcCd("P").setProcFlag("F").setProcDt("2022-01-03").build();
final FissDiagnosisCode diagCodeMessage = FissDiagnosisCode.newBuilder().setDiagCd2("cd2").setDiagPoaIndUnrecognized("Q").build();
final FissClaim claimMessage = FissClaim.newBuilder().setDcn(claim.getDcn()).setHicNo(claim.getHicNo()).setCurrStatusEnum(FissClaimStatus.CLAIM_STATUS_RTP).setCurrLoc1Unrecognized(String.valueOf(claim.getCurrLoc1())).setCurrLoc2Unrecognized(claim.getCurrLoc2()).setPracLocCity("city name can be very long indeed").addFissProcCodes(0, procCodeMessage).addFissDiagCodes(0, diagCodeMessage).setMbi(claim.getMbi()).build();
final FissClaimChange message = FissClaimChange.newBuilder().setSeq(claim.getSequenceNumber()).setDcn(claim.getDcn()).setClaim(claimMessage).build();
final IdHasher defaultIdHasher = new IdHasher(new IdHasher.Config(1, "notarealpepper"));
final FissClaimTransformer transformer = new FissClaimTransformer(clock, MbiCache.computedCache(defaultIdHasher.getConfig()));
final FissClaimRdaSink sink = new FissClaimRdaSink(appState, transformer, true);
final String expectedMbiHash = defaultIdHasher.computeIdentifierHash(claim.getMbi());
assertEquals(Optional.empty(), sink.readMaxExistingSequenceNumber());
int count = sink.writeMessage("version", message);
assertEquals(1, count);
List<PreAdjFissClaim> claims = entityManager.createQuery("select c from PreAdjFissClaim c", PreAdjFissClaim.class).getResultList();
assertEquals(1, claims.size());
PreAdjFissClaim resultClaim = claims.get(0);
assertEquals(Long.valueOf(3), resultClaim.getSequenceNumber());
assertEquals(claim.getHicNo(), resultClaim.getHicNo());
assertEquals(claim.getPracLocCity(), resultClaim.getPracLocCity());
assertEquals(claim.getMbi(), resultClaim.getMbi());
assertEquals(expectedMbiHash, resultClaim.getMbiHash());
assertEquals(claim.getProcCodes().size(), resultClaim.getProcCodes().size());
assertEquals(claim.getDiagCodes().size(), resultClaim.getDiagCodes().size());
assertEquals(Optional.of(claim.getSequenceNumber()), sink.readMaxExistingSequenceNumber());
Mbi databaseMbiEntity = RdaPipelineTestUtils.lookupCachedMbi(entityManager, claimMessage.getMbi());
assertNotNull(databaseMbiEntity);
assertEquals(claim.getMbi(), databaseMbiEntity.getMbi());
assertEquals(expectedMbiHash, databaseMbiEntity.getHash());
});
}
use of gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode in project beneficiary-fhir-data by CMSgov.
the class FissClaimTransformerTest method basicFieldsTestForDiagCodeObjectTransformation.
/**
* Basic smoke test for transformation of diagnosis code objects prior to all of the individual
* field tests.
*/
@Test
public void basicFieldsTestForDiagCodeObjectTransformation() {
claimBuilder.setDcn("dcn").setHicNo("hicn").setCurrStatusEnum(FissClaimStatus.CLAIM_STATUS_MOVE).setCurrLoc1Enum(FissProcessingType.PROCESSING_TYPE_MANUAL).setCurrLoc2Enum(FissCurrentLocation2.CURRENT_LOCATION_2_FINAL).addFissDiagCodes(FissDiagnosisCode.newBuilder().setDiagCd2("code-1").setDiagPoaIndEnum(FissDiagnosisPresentOnAdmissionIndicator.DIAGNOSIS_PRESENT_ON_ADMISSION_INDICATOR_CLINICALLY_UNDETERMINED).setBitFlags("1234").build()).addFissDiagCodes(FissDiagnosisCode.newBuilder().setDiagCd2("code-2").setDiagPoaIndEnum(FissDiagnosisPresentOnAdmissionIndicator.DIAGNOSIS_PRESENT_ON_ADMISSION_INDICATOR_NO).setBitFlags("4321").build());
claim.setDcn("dcn");
claim.setHicNo("hicn");
claim.setCurrStatus('M');
claim.setCurrLoc1('M');
claim.setCurrLoc2("9997");
claim.setLastUpdated(clock.instant());
PreAdjFissDiagnosisCode code = new PreAdjFissDiagnosisCode();
code.setDcn("dcn");
code.setPriority((short) 0);
code.setDiagCd2("code-1");
code.setDiagPoaInd("W");
code.setBitFlags("1234");
code.setLastUpdated(claim.getLastUpdated());
claim.getDiagCodes().add(code);
code = new PreAdjFissDiagnosisCode();
code.setDcn("dcn");
code.setPriority((short) 1);
code.setDiagCd2("code-2");
code.setDiagPoaInd("N");
code.setBitFlags("4321");
code.setLastUpdated(claim.getLastUpdated());
claim.getDiagCodes().add(code);
changeBuilder.setSeq(MIN_SEQUENCE_NUM).setChangeType(ChangeType.CHANGE_TYPE_UPDATE).setClaim(claimBuilder.build());
PreAdjFissClaim transformed = transformer.transformClaim(changeBuilder.build()).getClaim();
assertThat(transformed, samePropertyValuesAs(claim));
TransformerTestUtils.assertListContentsHaveSamePropertyValues(claim.getDiagCodes(), transformed.getDiagCodes(), PreAdjFissDiagnosisCode::getPriority);
}
Aggregations