Search in sources :

Example 1 with JsonMessageSource

use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource 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 2 with JsonMessageSource

use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.

the class RdaLoadJobIT method mcsClaimsTest.

@Test
public void mcsClaimsTest() throws Exception {
    RdaPipelineTestUtils.runTestWithTemporaryDb(RdaLoadJobIT.class, clock, (appState, entityManager) -> {
        assertTablesAreEmpty(entityManager);
        RdaServer.InProcessConfig.builder().serverName(RdaServerJob.Config.DEFAULT_SERVER_NAME).mcsSourceFactory(mcsJsonSource(mcsClaimJson)).build().runWithNoParam(() -> {
            final RdaLoadOptions config = createRdaLoadOptions(-1);
            final PipelineJob<?> job = config.createMcsClaimsLoadJob(appState);
            job.call();
        });
        final ImmutableList<McsClaimChange> expectedClaims = JsonMessageSource.parseAll(mcsClaimJson, JsonMessageSource::parseMcsClaimChange);
        List<PreAdjMcsClaim> claims = getPreAdjMcsClaims(entityManager);
        assertEquals(expectedClaims.size(), claims.size());
        for (PreAdjMcsClaim resultClaim : claims) {
            McsClaim expected = findMatchingMcsClaim(expectedClaims, resultClaim);
            assertNotNull(expected);
            assertEquals(expected.getIdrHic(), Strings.nullToEmpty(resultClaim.getIdrHic()));
            assertEquals(expected.getIdrClaimMbi(), Strings.nullToEmpty(resultClaim.getIdrClaimMbi()));
            assertEquals(expected.getMcsDetailsCount(), resultClaim.getDetails().size());
            assertEquals(expected.getMcsDiagnosisCodesCount(), resultClaim.getDiagCodes().size());
        }
    });
}
Also used : JsonMessageSource(gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) McsClaim(gov.cms.mpsm.rda.v1.mcs.McsClaim) McsClaimChange(gov.cms.mpsm.rda.v1.McsClaimChange) Test(org.junit.jupiter.api.Test)

Example 3 with JsonMessageSource

use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.

the class RdaLoadJobIT method mcsClaimsAreValid.

/**
 * All of our test claims should be valid for our IT tests to succeed. This test ensures this is
 * the case and catches any incompatibility issues when a new RDA API version contains breaking
 * changes.
 */
@Test
public void mcsClaimsAreValid() throws Exception {
    final ImmutableList<McsClaimChange> expectedClaims = JsonMessageSource.parseAll(mcsClaimJson, JsonMessageSource::parseMcsClaimChange);
    final McsClaimTransformer transformer = new McsClaimTransformer(clock, MbiCache.computedCache(new IdHasher.Config(1, "testing")));
    for (McsClaimChange claim : expectedClaims) {
        try {
            transformer.transformClaim(claim);
        } catch (DataTransformer.TransformationException ex) {
            fail(String.format("bad sample claim: seq=%d error=%s", claim.getSeq(), ex.getErrors()));
        }
    }
}
Also used : JsonMessageSource(gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource) McsClaimTransformer(gov.cms.bfd.pipeline.rda.grpc.source.McsClaimTransformer) DataTransformer(gov.cms.bfd.pipeline.rda.grpc.source.DataTransformer) McsClaimChange(gov.cms.mpsm.rda.v1.McsClaimChange) Test(org.junit.jupiter.api.Test)

Example 4 with JsonMessageSource

use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource 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)

Example 5 with JsonMessageSource

use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.

the class RdaLoadJobIT method fissClaimsAreValid.

/**
 * All of our test claims should be valid for our IT tests to succeed. This test ensures this is
 * the case and catches any incompatibility issues when a new RDA API version contains breaking
 * changes.
 */
@Test
public void fissClaimsAreValid() throws Exception {
    final ImmutableList<FissClaimChange> expectedClaims = JsonMessageSource.parseAll(fissClaimJson, JsonMessageSource::parseFissClaimChange);
    final FissClaimTransformer transformer = new FissClaimTransformer(clock, MbiCache.computedCache(new IdHasher.Config(1, "testing")));
    for (FissClaimChange claim : expectedClaims) {
        try {
            transformer.transformClaim(claim);
        } catch (DataTransformer.TransformationException ex) {
            fail(String.format("bad sample claim: seq=%d error=%s", claim.getSeq(), ex.getErrors()));
        }
    }
}
Also used : JsonMessageSource(gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource) DataTransformer(gov.cms.bfd.pipeline.rda.grpc.source.DataTransformer) FissClaimChange(gov.cms.mpsm.rda.v1.FissClaimChange) FissClaimTransformer(gov.cms.bfd.pipeline.rda.grpc.source.FissClaimTransformer) Test(org.junit.jupiter.api.Test)

Aggregations

JsonMessageSource (gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource)5 Test (org.junit.jupiter.api.Test)5 FissClaimChange (gov.cms.mpsm.rda.v1.FissClaimChange)3 PreAdjFissClaim (gov.cms.bfd.model.rda.PreAdjFissClaim)2 DataTransformer (gov.cms.bfd.pipeline.rda.grpc.source.DataTransformer)2 McsClaimChange (gov.cms.mpsm.rda.v1.McsClaimChange)2 PreAdjMcsClaim (gov.cms.bfd.model.rda.PreAdjMcsClaim)1 FissClaimTransformer (gov.cms.bfd.pipeline.rda.grpc.source.FissClaimTransformer)1 McsClaimTransformer (gov.cms.bfd.pipeline.rda.grpc.source.McsClaimTransformer)1 FissClaim (gov.cms.mpsm.rda.v1.fiss.FissClaim)1 McsClaim (gov.cms.mpsm.rda.v1.mcs.McsClaim)1