Search in sources :

Example 6 with PreAdjFissClaim

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

the class RdaServerJobIT method testS3.

@Test
public void testS3() throws Exception {
    AmazonS3 s3Client = createS3Client(REGION_DEFAULT);
    Bucket bucket = null;
    try {
        bucket = createTestBucket(s3Client);
        final String directoryPath = "files-go-here";
        final RdaServerJob.Config config = RdaServerJob.Config.builder().serverMode(RdaServerJob.Config.ServerMode.S3).serverName(SERVER_NAME).s3Bucket(bucket.getName()).s3Directory(directoryPath).build();
        final String fissObjectKey = config.getS3Sources().createFissObjectKey();
        final String mcsObjectKey = config.getS3Sources().createMcsObjectKey();
        uploadJsonToBucket(s3Client, bucket.getName(), fissObjectKey, fissClaimsSource);
        uploadJsonToBucket(s3Client, bucket.getName(), mcsObjectKey, mcsClaimsSource);
        final RdaServerJob job = new RdaServerJob(config);
        final ExecutorService exec = Executors.newCachedThreadPool();
        final Future<PipelineJobOutcome> outcome = exec.submit(job);
        try {
            waitForServerToStart(job);
            final ManagedChannel fissChannel = InProcessChannelBuilder.forName(SERVER_NAME).build();
            final FissClaimStreamCaller fissCaller = new FissClaimStreamCaller();
            final var fissStream = fissCaller.callService(fissChannel, CallOptions.DEFAULT, 1098);
            assertTrue(fissStream.hasNext());
            RdaChange<PreAdjFissClaim> fissChange = fissTransformer.transformClaim(fissStream.next());
            assertMatches(fissCaller.callVersionService(fissChannel, CallOptions.DEFAULT), "S3:\\d+:.*");
            assertEquals(1098L, fissChange.getSequenceNumber());
            assertTrue(fissStream.hasNext());
            fissChange = fissTransformer.transformClaim(fissStream.next());
            assertEquals(1099L, fissChange.getSequenceNumber());
            assertTrue(fissStream.hasNext());
            fissChange = fissTransformer.transformClaim(fissStream.next());
            assertEquals(1100L, fissChange.getSequenceNumber());
            assertFalse(fissStream.hasNext());
            final ManagedChannel mcsChannel = InProcessChannelBuilder.forName(SERVER_NAME).build();
            final McsClaimStreamCaller mcsCaller = new McsClaimStreamCaller();
            final var mcsStream = mcsCaller.callService(mcsChannel, CallOptions.DEFAULT, 1099);
            assertTrue(mcsStream.hasNext());
            RdaChange<PreAdjMcsClaim> mcsChange = mcsTransformer.transformClaim(mcsStream.next());
            assertMatches(mcsCaller.callVersionService(mcsChannel, CallOptions.DEFAULT), "S3:\\d+:.*");
            assertEquals(1099L, mcsChange.getSequenceNumber());
            assertTrue(mcsStream.hasNext());
            mcsChange = mcsTransformer.transformClaim(mcsStream.next());
            assertEquals(1100L, mcsChange.getSequenceNumber());
            assertFalse(mcsStream.hasNext());
        } finally {
            exec.shutdownNow();
            exec.awaitTermination(10, TimeUnit.SECONDS);
            assertEquals(PipelineJobOutcome.WORK_DONE, outcome.get());
        }
    } finally {
        deleteTestBucket(s3Client, bucket);
    }
}
Also used : AmazonS3(com.amazonaws.services.s3.AmazonS3) McsClaimStreamCaller(gov.cms.bfd.pipeline.rda.grpc.source.McsClaimStreamCaller) FissClaimStreamCaller(gov.cms.bfd.pipeline.rda.grpc.source.FissClaimStreamCaller) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) Bucket(com.amazonaws.services.s3.model.Bucket) PipelineJobOutcome(gov.cms.bfd.pipeline.sharedutils.PipelineJobOutcome) ExecutorService(java.util.concurrent.ExecutorService) ManagedChannel(io.grpc.ManagedChannel) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) Test(org.junit.jupiter.api.Test)

Example 7 with PreAdjFissClaim

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

the class FissClaimTransformer method transformClaim.

public RdaChange<PreAdjFissClaim> transformClaim(FissClaimChange change) {
    FissClaim from = change.getClaim();
    final DataTransformer transformer = new DataTransformer();
    final PreAdjFissClaim to = transformMessage(from, transformer, clock.instant());
    to.setSequenceNumber(change.getSeq());
    final List<DataTransformer.ErrorMessage> errors = transformer.getErrors();
    if (errors.size() > 0) {
        String message = String.format("failed with %d errors: dcn=%s errors=%s", errors.size(), from.getDcn(), errors);
        throw new DataTransformer.TransformationException(message, errors);
    }
    return new RdaChange<>(change.getSeq(), RdaApiUtils.mapApiChangeType(change.getChangeType()), to, transformer.instant(change.getTimestamp()));
}
Also used : RdaChange(gov.cms.bfd.pipeline.rda.grpc.RdaChange) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) FissClaim(gov.cms.mpsm.rda.v1.fiss.FissClaim) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim)

Example 8 with PreAdjFissClaim

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

the class FissClaimTransformer method transformMessage.

private PreAdjFissClaim transformMessage(FissClaim from, DataTransformer transformer, Instant now) {
    final PreAdjFissClaim to = transformMessageImpl(from, transformer, now, "");
    transformMessageArrays(from, to, transformer, now, "");
    return to;
}
Also used : PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim)

Example 9 with PreAdjFissClaim

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

the class RDATestUtils method fissTestDataA.

/**
 * One FISS claim for testing
 *
 * @return The FISS test claim A
 */
private PreAdjFissClaim fissTestDataA(Mbi mbi) {
    PreAdjFissClaim claim = PreAdjFissClaim.builder().sequenceNumber(1L).dcn("123456").hicNo("hicnumber").currStatus('a').currLoc1('z').currLoc2("Somda").medaProvId("meda12345").fedTaxNumber("tax12345").totalChargeAmount(new BigDecimal("1234.32")).receivedDate(LocalDate.ofEpochDay(0)).currTranDate(LocalDate.ofEpochDay(1)).admitDiagCode("admitcd").principleDiag("princcd").npiNumber("8876543211").mbiRecord(mbi).fedTaxNumber("abc123").lobCd("r").lastUpdated(Instant.ofEpochMilli(0)).stmtCovFromDate(LocalDate.ofEpochDay(200)).stmtCovToDate(LocalDate.ofEpochDay(200)).servTypeCd("A").freqCd("C").build();
    Set<PreAdjFissProcCode> procCodes = Set.of(PreAdjFissProcCode.builder().dcn("123456").priority((short) 0).procCode("CODEABC").procFlag("FLAG").procDate(LocalDate.ofEpochDay(200)).lastUpdated(Instant.ofEpochMilli(0)).build(), PreAdjFissProcCode.builder().dcn("123456").priority((short) 1).procCode("CODECBA").procFlag("FLA2").lastUpdated(Instant.ofEpochMilli(0)).build());
    Set<PreAdjFissDiagnosisCode> diagnosisCodes = Set.of(PreAdjFissDiagnosisCode.builder().dcn("123456").priority((short) 0).diagCd2("admitcd").diagPoaInd("Z").build(), PreAdjFissDiagnosisCode.builder().dcn("123456").priority((short) 1).diagCd2("other").diagPoaInd("U").build(), PreAdjFissDiagnosisCode.builder().dcn("123456").priority((short) 2).diagCd2("princcd").diagPoaInd("n").build());
    Set<PreAdjFissPayer> payers = Set.of(PreAdjFissPayer.builder().dcn("123456").priority((short) 0).beneFirstName("jim").beneMidInit("k").beneLastName("baker").beneSex("m").beneDob(LocalDate.of(1975, 3, 1)).payerType(PreAdjFissPayer.PayerType.BeneZ).payersName("MEDICARE").build(), PreAdjFissPayer.builder().dcn("123456").priority((short) 1).insuredName("BAKER  JIM  K").payerType(PreAdjFissPayer.PayerType.Insured).payersName("BCBS KC").build());
    claim.setPayers(payers);
    claim.setProcCodes(procCodes);
    claim.setDiagCodes(diagnosisCodes);
    return claim;
}
Also used : PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) PreAdjFissProcCode(gov.cms.bfd.model.rda.PreAdjFissProcCode) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) BigDecimal(java.math.BigDecimal) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer)

Example 10 with PreAdjFissClaim

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

the class RDATestUtils method fissTestDataB.

/**
 * One FISS claim for testing
 *
 * @return The FISS test claim B
 */
private PreAdjFissClaim fissTestDataB(Mbi mbi) {
    PreAdjFissClaim claim = PreAdjFissClaim.builder().sequenceNumber(2L).dcn("123457").hicNo("hicnumbe2").currStatus('t').currLoc1('r').currLoc2("Somdb").medaProvId("meda12346").fedTaxNumber("tax12345").totalChargeAmount(new BigDecimal("1235.32")).receivedDate(LocalDate.ofEpochDay(8)).currTranDate(LocalDate.ofEpochDay(12)).admitDiagCode("admitcc").principleDiag("princcc").npiNumber("8876543212").mbiRecord(mbi).fedTaxNumber("abc124").lobCd("k").lastUpdated(Instant.ofEpochMilli(5000)).stmtCovFromDate(LocalDate.ofEpochDay(211)).stmtCovToDate(LocalDate.ofEpochDay(211)).servTypeCd("A").freqCd("C").build();
    Set<PreAdjFissProcCode> procCodes = Set.of(PreAdjFissProcCode.builder().dcn("123457").priority((short) 0).procCode("CODEABD").procFlag("FLAC").procDate(LocalDate.ofEpochDay(211)).lastUpdated(Instant.ofEpochMilli(5000)).build());
    Set<PreAdjFissDiagnosisCode> diagnosisCodes = Set.of(PreAdjFissDiagnosisCode.builder().dcn("123457").priority((short) 0).diagCd2("princcc").diagPoaInd("Y").build(), PreAdjFissDiagnosisCode.builder().dcn("123457").priority((short) 1).diagCd2("other2").diagPoaInd("w").build(), PreAdjFissDiagnosisCode.builder().dcn("123457").priority((short) 2).diagCd2("admitcc").diagPoaInd("1").build());
    Set<PreAdjFissPayer> payers = Set.of(PreAdjFissPayer.builder().dcn("123457").priority((short) 0).beneFirstName("alice").beneMidInit("r").beneLastName("smith").beneSex("f").beneDob(LocalDate.of(1981, 8, 13)).payerType(PreAdjFissPayer.PayerType.BeneZ).payersName("MEDICARE").build(), PreAdjFissPayer.builder().dcn("123457").priority((short) 1).insuredName("SMITH  ALICE  R").payerType(PreAdjFissPayer.PayerType.Insured).payersName("BCBS KC").build());
    claim.setPayers(payers);
    claim.setProcCodes(procCodes);
    claim.setDiagCodes(diagnosisCodes);
    return claim;
}
Also used : PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) PreAdjFissProcCode(gov.cms.bfd.model.rda.PreAdjFissProcCode) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) BigDecimal(java.math.BigDecimal) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer)

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