Search in sources :

Example 1 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformerV2 method transformClaim.

/**
 * @param claimGroup the {@link PreAdjFissClaim} to transform
 * @return a FHIR {@link Claim} resource that represents the specified {@link PreAdjFissClaim}
 */
private static Claim transformClaim(PreAdjFissClaim claimGroup) {
    Claim claim = new Claim();
    boolean isIcd9 = claimGroup.getStmtCovToDate() != null && claimGroup.getStmtCovToDate().isBefore(ICD_9_CUTOFF_DATE);
    claim.setId("f-" + claimGroup.getDcn());
    claim.setContained(List.of(getContainedPatient(claimGroup), getContainedProvider(claimGroup)));
    claim.setIdentifier(getIdentifier(claimGroup));
    claim.setExtension(getExtension(claimGroup));
    claim.setStatus(Claim.ClaimStatus.ACTIVE);
    claim.setType(getType(claimGroup));
    claim.setSupportingInfo(getSupportingInfo(claimGroup));
    claim.setBillablePeriod(getBillablePeriod(claimGroup));
    claim.setUse(Claim.Use.CLAIM);
    claim.setPriority(getPriority());
    claim.setTotal(getTotal(claimGroup));
    claim.setProvider(new Reference("#provider-org"));
    claim.setPatient(new Reference("#patient"));
    claim.setFacility(getFacility(claimGroup));
    claim.setDiagnosis(getDiagnosis(claimGroup, isIcd9));
    claim.setProcedure(getProcedure(claimGroup, isIcd9));
    claim.setInsurance(getInsurance(claimGroup));
    claim.setMeta(new Meta().setLastUpdated(Date.from(claimGroup.getLastUpdated())));
    claim.setCreated(new Date());
    return claim;
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) Reference(org.hl7.fhir.r4.model.Reference) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) Claim(org.hl7.fhir.r4.model.Claim) Date(java.util.Date) LocalDate(java.time.LocalDate)

Example 2 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimStreamCallerIT method basicCall.

@Test
public void basicCall() throws Exception {
    RdaServer.InProcessConfig.builder().serverName(getClass().getSimpleName()).fissSourceFactory(sequenceNumber -> WrappedClaimSource.wrapFissClaims(new JsonMessageSource<>(CLAIM_1 + System.lineSeparator() + CLAIM_2, JsonMessageSource::parseFissClaim), clock, sequenceNumber)).build().runWithChannelParam(channel -> {
        final FissClaimStreamCaller caller = new FissClaimStreamCaller();
        assertEquals(RdaService.RDA_PROTO_VERSION, caller.callVersionService(channel, CallOptions.DEFAULT));
        final GrpcResponseStream<FissClaimChange> results = caller.callService(channel, CallOptions.DEFAULT, 0L);
        assertTrue(results.hasNext());
        PreAdjFissClaim claim = transform(results.next());
        assertEquals("63843470", claim.getDcn());
        assertEquals(Long.valueOf(0), claim.getSequenceNumber());
        assertTrue(results.hasNext());
        claim = transform(results.next());
        assertEquals("2643602", claim.getDcn());
        assertEquals(Long.valueOf(1), claim.getSequenceNumber());
        assertFalse(results.hasNext());
    });
}
Also used : JsonMessageSource(gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource) FissClaimChange(gov.cms.mpsm.rda.v1.FissClaimChange) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) Test(org.junit.jupiter.api.Test)

Example 3 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformerTest method basicFieldsTestForInsuredPayerObjectTransformation.

/**
 * Basic smoke test for transformation of insured payer objects prior to all of the individual
 * field tests.
 */
@Test
public void basicFieldsTestForInsuredPayerObjectTransformation() {
    claimBuilder.setDcn("dcn").setHicNo("hicn").setCurrStatusEnum(FissClaimStatus.CLAIM_STATUS_MOVE).setCurrLoc1Enum(FissProcessingType.PROCESSING_TYPE_MANUAL).setCurrLoc2Enum(FissCurrentLocation2.CURRENT_LOCATION_2_FINAL).addFissPayers(FissPayer.newBuilder().setInsuredPayer(FissInsuredPayer.newBuilder().setPayersIdEnum(FissPayersCode.PAYERS_CODE_BLACK_LUNG).setPayersName("payers-name").setRelIndEnum(FissReleaseOfInformation.RELEASE_OF_INFORMATION_NO_RELEASE_ON_FILE).setAssignIndEnum(FissAssignmentOfBenefitsIndicator.ASSIGNMENT_OF_BENEFITS_INDICATOR_BENEFITS_ASSIGNED).setProviderNumber("provider-num").setAdjDcnIcn("dcn-icn").setPriorPmt("123.45").setEstAmtDue("234.56").setInsuredRelEnum(FissPatientRelationshipCode.PATIENT_RELATIONSHIP_CODE_EMPLOYEE).setInsuredName("insured-name").setInsuredSsnHic("ssn-hic").setInsuredGroupName("group-name").setInsuredGroupNbr("group-num").setTreatAuthCd("auth-code").setInsuredSexEnum(FissBeneficiarySex.BENEFICIARY_SEX_MALE).setInsuredRelX12Enum(FissPatientRelationshipCode.PATIENT_RELATIONSHIP_CODE_GRANDCHILD).setInsuredDobText("11222021").setInsuredDob("2021-11-22").build()).build());
    claim.setDcn("dcn");
    claim.setHicNo("hicn");
    claim.setCurrStatus('M');
    claim.setCurrLoc1('M');
    claim.setCurrLoc2("9997");
    claim.setLastUpdated(clock.instant());
    PreAdjFissPayer payer = new PreAdjFissPayer();
    payer.setDcn("dcn");
    payer.setPriority((short) 0);
    payer.setPayerType(PreAdjFissPayer.PayerType.Insured);
    payer.setPayersId("H");
    payer.setPayersName("payers-name");
    payer.setRelInd("N");
    payer.setAssignInd("Y");
    payer.setProviderNumber("provider-num");
    payer.setAdjDcnIcn("dcn-icn");
    payer.setPriorPmt(new BigDecimal("123.45"));
    payer.setEstAmtDue(new BigDecimal("234.56"));
    payer.setInsuredRel("08");
    payer.setInsuredName("insured-name");
    payer.setInsuredSsnHic("ssn-hic");
    payer.setInsuredGroupName("group-name");
    payer.setInsuredGroupNbr("group-num");
    payer.setTreatAuthCd("auth-code");
    payer.setInsuredSex("M");
    payer.setInsuredRelX12("13");
    payer.setInsuredDob(LocalDate.of(2021, 11, 22));
    payer.setInsuredDobText("11222021");
    payer.setLastUpdated(claim.getLastUpdated());
    claim.getPayers().add(payer);
    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.getPayers(), transformed.getPayers(), PreAdjFissPayer::getPriority);
}
Also used : PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) BigDecimal(java.math.BigDecimal) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer) Test(org.junit.jupiter.api.Test)

Example 4 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformerTest method basicFieldsTestForAuditTrailObjectTransformation.

/**
 * Basic smoke test for transformation of audit trail objects prior to all of the individual field
 * tests.
 */
@Test
public void basicFieldsTestForAuditTrailObjectTransformation() {
    claimBuilder.setDcn("dcn").setHicNo("hicn").setCurrStatusEnum(FissClaimStatus.CLAIM_STATUS_MOVE).setCurrLoc1Enum(FissProcessingType.PROCESSING_TYPE_MANUAL).setCurrLoc2Enum(FissCurrentLocation2.CURRENT_LOCATION_2_FINAL).addFissAuditTrail(FissAuditTrail.newBuilder().setBadtStatusEnum(FissClaimStatus.CLAIM_STATUS_MOVE).setBadtLoc("1").setBadtOperId("2").setBadtReas("3").setBadtCurrDateCymd("2021-12-03").build());
    claim.setDcn("dcn");
    claim.setHicNo("hicn");
    claim.setCurrStatus('M');
    claim.setCurrLoc1('M');
    claim.setCurrLoc2("9997");
    claim.setLastUpdated(clock.instant());
    PreAdjFissAuditTrail auditTrail = new PreAdjFissAuditTrail();
    auditTrail.setDcn("dcn");
    auditTrail.setPriority((short) 0);
    auditTrail.setBadtStatus("M");
    auditTrail.setBadtLoc("1");
    auditTrail.setBadtOperId("2");
    auditTrail.setBadtReas("3");
    auditTrail.setBadtCurrDate(LocalDate.of(2021, 12, 3));
    auditTrail.setLastUpdated(claim.getLastUpdated());
    claim.getAuditTrail().add(auditTrail);
    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.getAuditTrail(), transformed.getAuditTrail(), PreAdjFissAuditTrail::getPriority);
}
Also used : PreAdjFissAuditTrail(gov.cms.bfd.model.rda.PreAdjFissAuditTrail) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) Test(org.junit.jupiter.api.Test)

Example 5 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class RdaLoadJobIT method fissClaimsTest.

@Test
public void fissClaimsTest() throws Exception {
    RdaPipelineTestUtils.runTestWithTemporaryDb(RdaLoadJobIT.class, clock, (appState, entityManager) -> {
        assertTablesAreEmpty(entityManager);
        RdaServer.LocalConfig.builder().fissSourceFactory(fissJsonSource(fissClaimJson)).build().runWithPortParam(port -> {
            final RdaLoadOptions config = createRdaLoadOptions(port);
            final PipelineJob<?> job = config.createFissClaimsLoadJob(appState);
            job.call();
        });
        final ImmutableList<FissClaimChange> expectedClaims = JsonMessageSource.parseAll(fissClaimJson, JsonMessageSource::parseFissClaimChange);
        List<PreAdjFissClaim> claims = getPreAdjFissClaims(entityManager);
        assertEquals(expectedClaims.size(), claims.size());
        for (PreAdjFissClaim resultClaim : claims) {
            FissClaim expected = findMatchingFissClaim(expectedClaims, resultClaim);
            assertNotNull(expected);
            assertEquals(expected.getHicNo(), resultClaim.getHicNo());
            assertEquals(expected.getPracLocCity(), Strings.nullToEmpty(resultClaim.getPracLocCity()));
            assertEquals(expected.getFissProcCodesCount(), resultClaim.getProcCodes().size());
            assertEquals(expected.getFissDiagCodesCount(), resultClaim.getDiagCodes().size());
        }
    });
}
Also used : JsonMessageSource(gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) FissClaim(gov.cms.mpsm.rda.v1.fiss.FissClaim) FissClaimChange(gov.cms.mpsm.rda.v1.FissClaimChange) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) Test(org.junit.jupiter.api.Test)

Aggregations

PreAdjFissClaim (gov.cms.bfd.model.rda.PreAdjFissClaim)21 Test (org.junit.jupiter.api.Test)10 PreAdjFissDiagnosisCode (gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode)6 PreAdjFissPayer (gov.cms.bfd.model.rda.PreAdjFissPayer)6 PreAdjFissProcCode (gov.cms.bfd.model.rda.PreAdjFissProcCode)6 FissClaimChange (gov.cms.mpsm.rda.v1.FissClaimChange)4 LocalDate (java.time.LocalDate)4 MetricRegistry (com.codahale.metrics.MetricRegistry)3 PreAdjMcsClaim (gov.cms.bfd.model.rda.PreAdjMcsClaim)3 BigDecimal (java.math.BigDecimal)3 Date (java.util.Date)3 List (java.util.List)3 Claim (org.hl7.fhir.r4.model.Claim)3 Meta (org.hl7.fhir.r4.model.Meta)3 Reference (org.hl7.fhir.r4.model.Reference)3 Timer (com.codahale.metrics.Timer)2 Trace (com.newrelic.api.agent.Trace)2 RdaChange (gov.cms.bfd.pipeline.rda.grpc.RdaChange)2 JsonMessageSource (gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource)2 FissClaimStreamCaller (gov.cms.bfd.pipeline.rda.grpc.source.FissClaimStreamCaller)2