Search in sources :

Example 1 with McsClaim

use of gov.cms.mpsm.rda.v1.mcs.McsClaim in project beneficiary-fhir-data by CMSgov.

the class RandomMcsClaimGeneratorTest method randomClaim.

@Test
public void randomClaim() throws InvalidProtocolBufferException {
    final Clock july1 = Clock.fixed(Instant.ofEpochMilli(1625172944844L), ZoneOffset.UTC);
    final RandomMcsClaimGenerator generator = new RandomMcsClaimGenerator(1, true, july1);
    final McsClaim claim = generator.randomClaim();
    final String json = JsonFormat.printer().print(claim);
    assertEquals(claim.getIdrDtlCnt(), claim.getMcsDetailsList().size());
    for (McsDiagnosisCode diagnosisCode : claim.getMcsDiagnosisCodesList()) {
        assertEquals(claim.getIdrClmHdIcn(), diagnosisCode.getIdrClmHdIcn());
    }
    assertEquals("{\n" + "  \"idrClmHdIcn\": \"84555\",\n" + "  \"idrContrId\": \"99\",\n" + "  \"idrHic\": \"48\",\n" + "  \"idrClaimTypeEnum\": \"CLAIM_TYPE_MEDICAL\",\n" + "  \"idrDtlCnt\": 3,\n" + "  \"idrBeneLast16\": \"mtrdh\",\n" + "  \"idrBeneFirstInit\": \"t\",\n" + "  \"idrBeneMidInit\": \"g\",\n" + "  \"idrBeneSexEnum\": \"BENEFICIARY_SEX_FEMALE\",\n" + "  \"idrStatusCodeEnum\": \"STATUS_CODE_ACTIVE_SEPARATE_HISTORY\",\n" + "  \"idrStatusDate\": \"2021-05-05\",\n" + "  \"idrBillProvNpi\": \"cs2\",\n" + "  \"idrBillProvNum\": \"4601656\",\n" + "  \"idrBillProvEin\": \"9\",\n" + "  \"idrBillProvType\": \"n\",\n" + "  \"idrBillProvSpec\": \"jd\",\n" + "  \"idrBillProvPriceSpec\": \"w\",\n" + "  \"idrBillProvCounty\": \"c\",\n" + "  \"idrBillProvLoc\": \"qc\",\n" + "  \"idrTotAllowed\": \"12749.95\",\n" + "  \"idrCoinsurance\": \"0.69\",\n" + "  \"idrDeductible\": \"322.93\",\n" + "  \"idrBillProvStatusCdEnum\": \"BILLING_PROVIDER_STATUS_CODE_PARTICIPATING\",\n" + "  \"idrTotBilledAmt\": \"0.01\",\n" + "  \"idrClaimReceiptDate\": \"2021-03-06\",\n" + "  \"idrClaimMbi\": \"5qbm7h08gds\",\n" + "  \"mcsDiagnosisCodes\": [{\n" + "    \"idrClmHdIcn\": \"84555\",\n" + "    \"idrDiagCode\": \"8\",\n" + "    \"idrDiagIcdTypeUnrecognized\": \"d\"\n" + "  }, {\n" + "    \"idrClmHdIcn\": \"84555\",\n" + "    \"idrDiagIcdTypeEnum\": \"DIAGNOSIS_ICD_TYPE_ICD10\",\n" + "    \"idrDiagCode\": \"7gzz\"\n" + "  }, {\n" + "    \"idrClmHdIcn\": \"84555\",\n" + "    \"idrDiagIcdTypeEnum\": \"DIAGNOSIS_ICD_TYPE_ICD9\",\n" + "    \"idrDiagCode\": \"9v5vws5\"\n" + "  }, {\n" + "    \"idrClmHdIcn\": \"84555\",\n" + "    \"idrDiagIcdTypeEnum\": \"DIAGNOSIS_ICD_TYPE_ICD9\",\n" + "    \"idrDiagCode\": \"f\"\n" + "  }, {\n" + "    \"idrClmHdIcn\": \"84555\",\n" + "    \"idrDiagCode\": \"wgghm8q\",\n" + "    \"idrDiagIcdTypeUnrecognized\": \"m\"\n" + "  }, {\n" + "    \"idrClmHdIcn\": \"84555\",\n" + "    \"idrDiagIcdTypeEnum\": \"DIAGNOSIS_ICD_TYPE_ICD10\",\n" + "    \"idrDiagCode\": \"ns1p\"\n" + "  }],\n" + "  \"mcsDetails\": [{\n" + "    \"idrDtlStatusEnum\": \"DETAIL_STATUS_SENT\",\n" + "    \"idrDtlFromDate\": \"2021-01-10\",\n" + "    \"idrDtlToDate\": \"2021-05-07\",\n" + "    \"idrProcCode\": \"5ft\",\n" + "    \"idrModOne\": \"r\",\n" + "    \"idrModTwo\": \"49\",\n" + "    \"idrModThree\": \"d\",\n" + "    \"idrModFour\": \"ft\",\n" + "    \"idrDtlDiagIcdTypeEnum\": \"DIAGNOSIS_ICD_TYPE_ICD10\",\n" + "    \"idrDtlPrimaryDiagCode\": \"4\",\n" + "    \"idrKPosLnameOrg\": \"wkxvrqnwgg\",\n" + "    \"idrKPosFname\": \"pdvdqcg\",\n" + "    \"idrKPosMname\": \"s\",\n" + "    \"idrKPosAddr1\": \"nkvxbx79m\",\n" + "    \"idrKPosAddr21st\": \"4\",\n" + "    \"idrKPosAddr22nd\": \"r7sj6k5\",\n" + "    \"idrKPosCity\": \"htxmccdbvztmwjpz\",\n" + "    \"idrKPosState\": \"xc\",\n" + "    \"idrKPosZip\": \"88523\",\n" + "    \"idrTosUnrecognized\": \"4\",\n" + "    \"idrTwoDigitPosEnum\": \"TWO_DIGIT_PLAN_OF_SERVICE_MILITARY_TREATMENT_FACILITY\",\n" + "    \"idrDtlRendType\": \"m\",\n" + "    \"idrDtlRendSpec\": \"t\",\n" + "    \"idrDtlRendNpi\": \"4\",\n" + "    \"idrDtlRendProv\": \"9p\",\n" + "    \"idrKDtlFacProvNpi\": \"9kn4mf5\",\n" + "    \"idrDtlAmbPickupAddres1\": \"k\",\n" + "    \"idrDtlAmbPickupAddres2\": \"vfgt24x80mpd4tt\",\n" + "    \"idrDtlAmbPickupCity\": \"0tp9p\",\n" + "    \"idrDtlAmbPickupState\": \"vk\",\n" + "    \"idrDtlAmbPickupZipcode\": \"h1bmsg1\",\n" + "    \"idrDtlAmbDropoffName\": \"vmvt12dc2\",\n" + "    \"idrDtlAmbDropoffAddrL1\": \"p9p4tq8vn6mkjqnx\",\n" + "    \"idrDtlAmbDropoffAddrL2\": \"52b2rkwhd2f16\",\n" + "    \"idrDtlAmbDropoffCity\": \"t56t3wn99\",\n" + "    \"idrDtlAmbDropoffState\": \"fm\",\n" + "    \"idrDtlAmbDropoffZipcode\": \"23\"\n" + "  }, {\n" + "    \"idrDtlFromDate\": \"2021-02-05\",\n" + "    \"idrDtlToDate\": \"2021-06-16\",\n" + "    \"idrProcCode\": \"mqx8\",\n" + "    \"idrModOne\": \"0x\",\n" + "    \"idrModTwo\": \"v5\",\n" + "    \"idrModThree\": \"xn\",\n" + "    \"idrModFour\": \"4n\",\n" + "    \"idrDtlDiagIcdTypeEnum\": \"DIAGNOSIS_ICD_TYPE_ICD10\",\n" + "    \"idrDtlPrimaryDiagCode\": \"706bbxz\",\n" + "    \"idrKPosLnameOrg\": \"zzdvgzfmbnjg\",\n" + "    \"idrKPosFname\": \"cvrwphbnjzzmrsffktghpp\",\n" + "    \"idrKPosMname\": \"pnqdgpndhjstrwhkgxcxhppm\",\n" + "    \"idrKPosAddr1\": \"874v7njdfftt5hq678b79220qk\",\n" + "    \"idrKPosAddr21st\": \"pj787q5gc2w030hphj5rzf479sb\",\n" + "    \"idrKPosAddr22nd\": \"zmkp5zh25t42b8smzn0nk\",\n" + "    \"idrKPosCity\": \"xmvbrqzqbbdwpjwndfxpgfhcnxg\",\n" + "    \"idrKPosState\": \"jp\",\n" + "    \"idrKPosZip\": \"99794163594\",\n" + "    \"idrDtlStatusUnrecognized\": \"g\",\n" + "    \"idrTosEnum\": \"TYPE_OF_SERVICE_SECOND_OPINION_ON_ELECTIVE_SURGERY\",\n" + "    \"idrTwoDigitPosUnrecognized\": \"w\",\n" + "    \"idrDtlRendType\": \"f2\",\n" + "    \"idrDtlRendSpec\": \"zd\",\n" + "    \"idrDtlRendNpi\": \"c9j\",\n" + "    \"idrDtlRendProv\": \"mkh9\",\n" + "    \"idrKDtlFacProvNpi\": \"m\",\n" + "    \"idrDtlAmbPickupAddres1\": \"41mwjmfsx494s3t8dkrf\",\n" + "    \"idrDtlAmbPickupAddres2\": \"q5z7b4n1g1fs\",\n" + "    \"idrDtlAmbPickupCity\": \"d0vs1tvjq2r\",\n" + "    \"idrDtlAmbPickupState\": \"1\",\n" + "    \"idrDtlAmbPickupZipcode\": \"pg\",\n" + "    \"idrDtlAmbDropoffName\": \"b49d5nh8m6vsfpfd83w9\",\n" + "    \"idrDtlAmbDropoffAddrL1\": \"tcz5mf1vkcx2\",\n" + "    \"idrDtlAmbDropoffAddrL2\": \"xx1r\",\n" + "    \"idrDtlAmbDropoffCity\": \"fxsv92xjqs\",\n" + "    \"idrDtlAmbDropoffState\": \"4\",\n" + "    \"idrDtlAmbDropoffZipcode\": \"ww6v2pg5j\"\n" + "  }, {\n" + "    \"idrDtlFromDate\": \"2021-02-15\",\n" + "    \"idrDtlToDate\": \"2021-05-21\",\n" + "    \"idrProcCode\": \"d4\",\n" + "    \"idrModOne\": \"0j\",\n" + "    \"idrModTwo\": \"w\",\n" + "    \"idrModThree\": \"8\",\n" + "    \"idrModFour\": \"3\",\n" + "    \"idrDtlPrimaryDiagCode\": \"3c1\",\n" + "    \"idrKPosLnameOrg\": \"qfctrvzmkbp\",\n" + "    \"idrKPosFname\": \"btmbqbvjq\",\n" + "    \"idrKPosMname\": \"msgrzsmdmzwrzmvqpmdxr\",\n" + "    \"idrKPosAddr1\": \"34wfj8krbjjt1pq\",\n" + "    \"idrKPosAddr21st\": \"58np59mcrvh25f2sb7tmsd1sh\",\n" + "    \"idrKPosAddr22nd\": \"8bp5xdf3twwsmdtfkwqr\",\n" + "    \"idrKPosCity\": \"wrchbkddjksntc\",\n" + "    \"idrKPosState\": \"s\",\n" + "    \"idrKPosZip\": \"561\",\n" + "    \"idrDtlDiagIcdTypeUnrecognized\": \"s\",\n" + "    \"idrDtlStatusUnrecognized\": \"k\",\n" + "    \"idrTosEnum\": \"TYPE_OF_SERVICE_ALTERNATE_PAYMENT_FOR_MAINTENANCE_DIALYSIS\",\n" + "    \"idrTwoDigitPosEnum\": \"TWO_DIGIT_PLAN_OF_SERVICE_HOSPICE\",\n" + "    \"idrDtlRendType\": \"0\",\n" + "    \"idrDtlRendSpec\": \"1d\",\n" + "    \"idrDtlRendNpi\": \"tx89pbx\",\n" + "    \"idrDtlRendProv\": \"kz4d\",\n" + "    \"idrKDtlFacProvNpi\": \"7b9vtb3p\",\n" + "    \"idrDtlAmbPickupAddres1\": \"np5br9bt8\",\n" + "    \"idrDtlAmbPickupAddres2\": \"rk1bqrsk75pz1sc\",\n" + "    \"idrDtlAmbPickupCity\": \"rd9\",\n" + "    \"idrDtlAmbPickupState\": \"xj\",\n" + "    \"idrDtlAmbPickupZipcode\": \"f8w6sk9f\",\n" + "    \"idrDtlAmbDropoffName\": \"3t0ww0ntfxr3hhzk9g78\",\n" + "    \"idrDtlAmbDropoffAddrL1\": \"540gnf\",\n" + "    \"idrDtlAmbDropoffAddrL2\": \"d7\",\n" + "    \"idrDtlAmbDropoffCity\": \"1r5jkcc95\",\n" + "    \"idrDtlAmbDropoffState\": \"m\",\n" + "    \"idrDtlAmbDropoffZipcode\": \"xb6\"\n" + "  }],\n" + "  \"idrBillProvGroupIndUnrecognized\": \"s\",\n" + "  \"idrHdrFromDos\": \"2021-01-10\",\n" + "  \"idrHdrToDos\": \"2021-06-16\",\n" + "  \"idrAssignmentUnrecognized\": \"b\",\n" + "  \"idrClmLevelIndEnum\": \"CLAIM_LEVEL_INDICATOR_ADJUSTED\",\n" + "  \"idrHdrAudit\": 1223,\n" + "  \"idrHdrAuditIndEnum\": \"AUDIT_INDICATOR_IDR_HDR_AUDIT_IS_ZEROES\",\n" + "  \"idrUSplitReasonUnrecognized\": \"s\",\n" + "  \"idrJReferringProvNpi\": \"wf24p5mx\",\n" + "  \"idrJFacProvNpi\": \"3k0bth5\",\n" + "  \"idrUDemoProvNpi\": \"2v\",\n" + "  \"idrUSuperNpi\": \"fx1njn\",\n" + "  \"idrUFcadjBilNpi\": \"q6ftzx226\",\n" + "  \"idrAmbPickupAddresLine1\": \"s0g4rqqx9qp24pb3rh\",\n" + "  \"idrAmbPickupAddresLine2\": \"165ttc3cdnq42s3tkj\",\n" + "  \"idrAmbPickupCity\": \"1hgc8hrc5p47khhhn046\",\n" + "  \"idrAmbPickupState\": \"fr\",\n" + "  \"idrAmbPickupZipcode\": \"sg26\",\n" + "  \"idrAmbDropoffName\": \"38pgrm3s4wb7qhvqh3c96zd\",\n" + "  \"idrAmbDropoffAddrLine1\": \"t852\",\n" + "  \"idrAmbDropoffAddrLine2\": \"vrb\",\n" + "  \"idrAmbDropoffCity\": \"sdtkrmm3q85t\",\n" + "  \"idrAmbDropoffState\": \"r\",\n" + "  \"idrAmbDropoffZipcode\": \"k06k06\",\n" + "  \"mcsAudits\": [{\n" + "    \"idrJAuditNum\": 26057,\n" + "    \"idrJAuditIndEnum\": \"CUTBACK_AUDIT_INDICATOR__AUDIT_NUM_IS_ZEROES\",\n" + "    \"idrJAuditDispUnrecognized\": \"f\"\n" + "  }, {\n" + "    \"idrJAuditNum\": 26111,\n" + "    \"idrJAuditIndUnrecognized\": \"h\",\n" + "    \"idrJAuditDispEnum\": \"CUTBACK_AUDIT_DISPOSITION_SPLIT_THE_DETAIL\"\n" + "  }, {\n" + "    \"idrJAuditNum\": 22190,\n" + "    \"idrJAuditIndUnrecognized\": \"r\",\n" + "    \"idrJAuditDispEnum\": \"CUTBACK_AUDIT_DISPOSITION_NULL\"\n" + "  }, {\n" + "    \"idrJAuditNum\": 21392,\n" + "    \"idrJAuditIndUnrecognized\": \"4\",\n" + "    \"idrJAuditDispEnum\": \"CUTBACK_AUDIT_DISPOSITION_CUTBACK_TO_LIMIT\"\n" + "  }],\n" + "  \"mcsLocations\": [{\n" + "    \"idrLocClerk\": \"1c0\",\n" + "    \"idrLocCode\": \"c\",\n" + "    \"idrLocDate\": \"2021-02-11\",\n" + "    \"idrLocActvCodeEnum\": \"LOCATION_ACTIVITY_CODE_AGED_OUT_OF_PREVIOUS_LOCATION\"\n" + "  }, {\n" + "    \"idrLocClerk\": \"m7ww\",\n" + "    \"idrLocCode\": \"hc\",\n" + "    \"idrLocDate\": \"2021-02-06\",\n" + "    \"idrLocActvCodeUnrecognized\": \"w\"\n" + "  }, {\n" + "    \"idrLocClerk\": \"g9w\",\n" + "    \"idrLocCode\": \"h8\",\n" + "    \"idrLocDate\": \"2021-02-10\",\n" + "    \"idrLocActvCodeEnum\": \"LOCATION_ACTIVITY_CODE_LOCATION_ADJUSTMENT_ACTIVITY\"\n" + "  }, {\n" + "    \"idrLocClerk\": \"1\",\n" + "    \"idrLocCode\": \"hv\",\n" + "    \"idrLocDate\": \"2021-02-22\",\n" + "    \"idrLocActvCodeEnum\": \"LOCATION_ACTIVITY_CODE_ACTIVATION_ACTIVITY\"\n" + "  }],\n" + "  \"mcsAdjustments\": [{\n" + "    \"idrAdjDate\": \"2021-06-18\",\n" + "    \"idrXrefIcn\": \"z\",\n" + "    \"idrAdjClerk\": \"gm0x\",\n" + "    \"idrInitCcn\": \"8m1f\",\n" + "    \"idrAdjChkWrtDt\": \"2021-06-02\",\n" + "    \"idrAdjBEombAmt\": \"29.97\",\n" + "    \"idrAdjPEombAmt\": \"24.16\"\n" + "  }]\n" + "}", json);
}
Also used : McsDiagnosisCode(gov.cms.mpsm.rda.v1.mcs.McsDiagnosisCode) Clock(java.time.Clock) McsClaim(gov.cms.mpsm.rda.v1.mcs.McsClaim) Test(org.junit.jupiter.api.Test)

Example 2 with McsClaim

use of gov.cms.mpsm.rda.v1.mcs.McsClaim 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());
    });
}
Also used : McsClaimTransformer(gov.cms.bfd.pipeline.rda.grpc.source.McsClaimTransformer) Instant(java.time.Instant) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail) McsDetail(gov.cms.mpsm.rda.v1.mcs.McsDetail) Clock(java.time.Clock) LocalDate(java.time.LocalDate) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail) McsDiagnosisCode(gov.cms.mpsm.rda.v1.mcs.McsDiagnosisCode) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) Mbi(gov.cms.bfd.model.rda.Mbi) IdHasher(gov.cms.bfd.pipeline.sharedutils.IdHasher) 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 McsClaim

use of gov.cms.mpsm.rda.v1.mcs.McsClaim 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 4 with McsClaim

use of gov.cms.mpsm.rda.v1.mcs.McsClaim in project beneficiary-fhir-data by CMSgov.

the class McsClaimStreamCaller method callService.

/**
 * Calls the getMcsClaims RPC. The Iterator from the RPC call is wrapped with a transforming
 * Iterator that converts the API McsClaim objects into database PreAdjMcsClaim entity objects.
 *
 * @param channel an already open channel to the service being called
 * @param startingSequenceNumber specifies the sequence number to send to the RDA API server
 * @return a blocking GrpcResponseStream of PreAdjMcsClaim entity objects
 * @throws Exception passes through any gRPC framework exceptions
 */
@Override
public GrpcResponseStream<McsClaimChange> callService(ManagedChannel channel, CallOptions callOptions, long startingSequenceNumber) throws Exception {
    logger.info("calling service");
    Preconditions.checkNotNull(channel);
    final ClaimRequest request = ClaimRequest.newBuilder().setSince(startingSequenceNumber).build();
    final MethodDescriptor<ClaimRequest, McsClaimChange> method = RDAServiceGrpc.getGetMcsClaimsMethod();
    final ClientCall<ClaimRequest, McsClaimChange> call = channel.newCall(method, callOptions);
    final Iterator<McsClaimChange> apiResults = ClientCalls.blockingServerStreamingCall(call, request);
    return new GrpcResponseStream<>(call, apiResults);
}
Also used : ClaimRequest(gov.cms.mpsm.rda.v1.ClaimRequest) McsClaimChange(gov.cms.mpsm.rda.v1.McsClaimChange)

Example 5 with McsClaim

use of gov.cms.mpsm.rda.v1.mcs.McsClaim in project beneficiary-fhir-data by CMSgov.

the class McsClaimTransformer method transformMessageArrays.

private void transformMessageArrays(McsClaim from, PreAdjMcsClaim to, DataTransformer transformer, Instant now, String namePrefix) {
    for (short index = 0; index < from.getMcsDetailsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "detail" + "-" + index + "-";
        final McsDetail itemFrom = from.getMcsDetails(index);
        final PreAdjMcsDetail itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getDetails().add(itemTo);
    }
    for (short index = 0; index < from.getMcsDiagnosisCodesCount(); ++index) {
        final String itemNamePrefix = namePrefix + "diagCode" + "-" + index + "-";
        final McsDiagnosisCode itemFrom = from.getMcsDiagnosisCodes(index);
        final PreAdjMcsDiagnosisCode itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getDiagCodes().add(itemTo);
    }
    for (short index = 0; index < from.getMcsAdjustmentsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "adjustment" + "-" + index + "-";
        final McsAdjustment itemFrom = from.getMcsAdjustments(index);
        final PreAdjMcsAdjustment itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getAdjustments().add(itemTo);
    }
    for (short index = 0; index < from.getMcsAuditsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "audit" + "-" + index + "-";
        final McsAudit itemFrom = from.getMcsAudits(index);
        final PreAdjMcsAudit itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getAudits().add(itemTo);
    }
    for (short index = 0; index < from.getMcsLocationsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "location" + "-" + index + "-";
        final McsLocation itemFrom = from.getMcsLocations(index);
        final PreAdjMcsLocation itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getLocations().add(itemTo);
    }
}
Also used : McsDiagnosisCode(gov.cms.mpsm.rda.v1.mcs.McsDiagnosisCode) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) PreAdjMcsAudit(gov.cms.bfd.model.rda.PreAdjMcsAudit) McsAudit(gov.cms.mpsm.rda.v1.mcs.McsAudit) PreAdjMcsAudit(gov.cms.bfd.model.rda.PreAdjMcsAudit) PreAdjMcsAdjustment(gov.cms.bfd.model.rda.PreAdjMcsAdjustment) McsLocation(gov.cms.mpsm.rda.v1.mcs.McsLocation) PreAdjMcsLocation(gov.cms.bfd.model.rda.PreAdjMcsLocation) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail) McsDetail(gov.cms.mpsm.rda.v1.mcs.McsDetail) PreAdjMcsAdjustment(gov.cms.bfd.model.rda.PreAdjMcsAdjustment) McsAdjustment(gov.cms.mpsm.rda.v1.mcs.McsAdjustment) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) PreAdjMcsLocation(gov.cms.bfd.model.rda.PreAdjMcsLocation) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail)

Aggregations

McsClaim (gov.cms.mpsm.rda.v1.mcs.McsClaim)8 Test (org.junit.jupiter.api.Test)7 McsClaimChange (gov.cms.mpsm.rda.v1.McsClaimChange)5 PreAdjMcsClaim (gov.cms.bfd.model.rda.PreAdjMcsClaim)3 McsDiagnosisCode (gov.cms.mpsm.rda.v1.mcs.McsDiagnosisCode)3 PreAdjMcsDetail (gov.cms.bfd.model.rda.PreAdjMcsDetail)2 PreAdjMcsDiagnosisCode (gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode)2 McsDetail (gov.cms.mpsm.rda.v1.mcs.McsDetail)2 Clock (java.time.Clock)2 Mbi (gov.cms.bfd.model.rda.Mbi)1 PreAdjMcsAdjustment (gov.cms.bfd.model.rda.PreAdjMcsAdjustment)1 PreAdjMcsAudit (gov.cms.bfd.model.rda.PreAdjMcsAudit)1 PreAdjMcsLocation (gov.cms.bfd.model.rda.PreAdjMcsLocation)1 RdaChange (gov.cms.bfd.pipeline.rda.grpc.RdaChange)1 JsonMessageSource (gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource)1 McsClaimTransformer (gov.cms.bfd.pipeline.rda.grpc.source.McsClaimTransformer)1 IdHasher (gov.cms.bfd.pipeline.sharedutils.IdHasher)1 ClaimRequest (gov.cms.mpsm.rda.v1.ClaimRequest)1 McsAdjustment (gov.cms.mpsm.rda.v1.mcs.McsAdjustment)1 McsAudit (gov.cms.mpsm.rda.v1.mcs.McsAudit)1