Search in sources :

Example 1 with ContractToContractCoverageMapping

use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.

the class CoverageDriverTest method before.

@BeforeEach
void before() {
    mapping = new ContractToContractCoverageMapping();
    // Set properties values in database
    addPropertiesTableValues();
    contract = dataSetup.setupContract("TST-12", AB2D_EPOCH.toOffsetDateTime());
    contract1 = dataSetup.setupContract("TST-45", AB2D_EPOCH.toOffsetDateTime());
    contractForCoverageDTO = new ContractForCoverageDTO("TST-12", AB2D_EPOCH.toOffsetDateTime(), ContractForCoverageDTO.ContractType.NORMAL);
    contractForCoverageDTO1 = new ContractForCoverageDTO("TST-45", AB2D_EPOCH.toOffsetDateTime(), ContractForCoverageDTO.ContractType.NORMAL);
    contractRepo.saveAndFlush(contract);
    january = coverageDataSetup.createCoveragePeriod(contract.getContractNumber(), 1, 2020);
    february = coverageDataSetup.createCoveragePeriod(contract.getContractNumber(), 2, 2020);
    march = coverageDataSetup.createCoveragePeriod(contract.getContractNumber(), 3, 2020);
    PdpClientDTO contractPdpClient = createClient(contract, "TST-12", SPONSOR_ROLE);
    pdpClientService.createClient(contractPdpClient);
    dataSetup.queueForCleanup(pdpClientService.getClientById("TST-12"));
    PdpClient pdpClient = dataSetup.setupPdpClient(List.of());
    job = new Job();
    job.setContractNumber(contract.getContractNumber());
    job.setJobUuid("unique");
    job.setOrganization(pdpClient.getOrganization());
    job.setStatus(gov.cms.ab2d.common.model.JobStatus.SUBMITTED);
    job.setCreatedAt(OffsetDateTime.now());
    job.setFhirVersion(STU3);
    jobRepo.saveAndFlush(job);
    dataSetup.queueForCleanup(job);
    bfdClient = mock(BFDClient.class);
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setMaxPoolSize(6);
    taskExecutor.setCorePoolSize(3);
    taskExecutor.initialize();
    processor = new CoverageProcessorImpl(coverageService, bfdClient, taskExecutor, MAX_ATTEMPTS, contractWorkerClient);
    driver = new CoverageDriverImpl(coverageSearchRepo, pdpClientService, coverageService, propertiesService, processor, searchLock, contractToContractCoverageMapping);
}
Also used : ContractForCoverageDTO(gov.cms.ab2d.coverage.model.ContractForCoverageDTO) PdpClientDTO(gov.cms.ab2d.common.dto.PdpClientDTO) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) Job(gov.cms.ab2d.common.model.Job) PdpClient(gov.cms.ab2d.common.model.PdpClient) BFDClient(gov.cms.ab2d.bfd.client.BFDClient) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ContractToContractCoverageMapping

use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.

the class CoverageMappingCallableTest method testTestContractYears.

@DisplayName("Test to see if it returns the correct year for test contracts")
@Test
void testTestContractYears() {
    ContractDTO contract = new ContractDTO("TESTING", "TESTING", OffsetDateTime.now(), Contract.ContractType.CLASSIC_TEST);
    CoveragePeriod period = new CoveragePeriod();
    period.setContractNumber(contract.getContractNumber());
    period.setYear(2020);
    period.setMonth(1);
    CoverageSearchEvent cse = new CoverageSearchEvent();
    cse.setCoveragePeriod(period);
    CoverageSearch search = new CoverageSearch();
    search.setPeriod(period);
    // First test that the corrected year modification works
    CoverageMapping mapping = new CoverageMapping(cse, search);
    ContractToContractCoverageMapping contractToContractCoverageMapping = new ContractToContractCoverageMapping();
    ContractForCoverageDTO contractForCoverageDTO = contractToContractCoverageMapping.map(contract);
    CoverageMappingCallable callable = new CoverageMappingCallable(STU3, mapping, bfdClient, mapping.getPeriod().getYear());
    assertEquals(3, contractForCoverageDTO.getCorrectedYear(2020));
    // Test that the corrected year modification is not applied to Synthea
    contractForCoverageDTO.setContractType(ContractForCoverageDTO.ContractType.SYNTHEA);
    assertEquals(2020, contractForCoverageDTO.getCorrectedYear(2020));
}
Also used : ContractDTO(gov.cms.ab2d.common.dto.ContractDTO) ContractForCoverageDTO(gov.cms.ab2d.coverage.model.ContractForCoverageDTO) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) CoverageMapping(gov.cms.ab2d.coverage.model.CoverageMapping) CoveragePeriod(gov.cms.ab2d.coverage.model.CoveragePeriod) CoverageSearch(gov.cms.ab2d.coverage.model.CoverageSearch) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) CoverageSearchEvent(gov.cms.ab2d.coverage.model.CoverageSearchEvent) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 3 with ContractToContractCoverageMapping

use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.

the class ContractProcessorUnitTest method setUp.

@BeforeEach
void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    patientClaimsProcessor = spy(PatientClaimsProcessorStub.class);
    mapping = new ContractToContractCoverageMapping();
    contract = createContractDTO();
    contractForCoverageDTO = mapping.map(contract);
    PdpClient pdpClient = createClient();
    job = createJob(pdpClient);
    job.setContractNumber(contract.getContractNumber());
    jobRepository = new StubJobRepository(job);
    JobProgressServiceImpl jobProgressImpl = new JobProgressServiceImpl(jobRepository);
    jobProgressImpl.initJob(jobUuid);
    ReflectionTestUtils.setField(jobProgressImpl, "reportProgressDbFrequency", 2);
    ReflectionTestUtils.setField(jobProgressImpl, "reportProgressLogFrequency", 3);
    jobChannelService = new JobChannelStubServiceImpl(jobProgressImpl);
    ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.initialize();
    SearchConfig searchConfig = new SearchConfig(efsMountTmpDir.toFile().getAbsolutePath(), STREAMING, FINISHED, 0, 0, 2, 1);
    ContractWorkerClient contractWorkerClient = new ContractWorkerClientMock();
    cut = new ContractProcessorImpl(contractWorkerClient, jobRepository, coverageDriver, patientClaimsProcessor, eventLogger, requestQueue, jobChannelService, jobProgressImpl, mapping, pool, searchConfig);
    // ReflectionTestUtils.setField(cut, "numberPatientRequestsPerThread", 2);
    var outputDirPath = Paths.get(efsMountTmpDir.toString(), jobUuid);
    Files.createDirectories(outputDirPath);
}
Also used : ContractWorkerClient(gov.cms.ab2d.worker.service.ContractWorkerClient) JobChannelStubServiceImpl(gov.cms.ab2d.worker.service.JobChannelStubServiceImpl) PatientClaimsProcessorStub(gov.cms.ab2d.worker.processor.stub.PatientClaimsProcessorStub) ContractWorkerClientMock(gov.cms.ab2d.worker.util.ContractWorkerClientMock) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) SearchConfig(gov.cms.ab2d.worker.config.SearchConfig) StubJobRepository(gov.cms.ab2d.worker.repository.StubJobRepository) PdpClient(gov.cms.ab2d.common.model.PdpClient) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with ContractToContractCoverageMapping

use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.

the class CoveragePeriodsPresentCheck method test.

@Override
public boolean test(ContractDTO contract) {
    ContractToContractCoverageMapping mapping = new ContractToContractCoverageMapping();
    List<String> missingPeriods = listMissingCoveragePeriods(this.coverageService, mapping.map(contract));
    this.issues.addAll(missingPeriods);
    return missingPeriods.isEmpty();
}
Also used : ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping)

Example 5 with ContractToContractCoverageMapping

use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.

the class CoveragePresentCheck method listCoveragePeriodsMissingEnrollment.

private List<String> listCoveragePeriodsMissingEnrollment(ContractDTO contract, List<CoverageCount> coverageCounts) {
    List<String> noEnrollment = new ArrayList<>();
    ZonedDateTime now = getEndDateTime().minusMonths(1);
    ZonedDateTime attestationTime = getAttestationTime(new ContractToContractCoverageMapping().map(contract));
    ListIterator<CoverageCount> countIterator = coverageCounts.listIterator();
    while (attestationTime.isBefore(now)) {
        int year = attestationTime.getYear();
        int month = attestationTime.getMonthValue();
        // If nothing in the iterator
        if (!countIterator.hasNext()) {
            logIssue(contract, year, month, noEnrollment);
        // If something in iterator make sure it matches expected
        } else {
            CoverageCount coverageCount = countIterator.next();
            if (year != coverageCount.getYear() || month != coverageCount.getMonth()) {
                countIterator.previous();
                logIssue(contract, year, month, noEnrollment);
            }
        }
        attestationTime = attestationTime.plusMonths(1);
    }
    return noEnrollment;
}
Also used : ZonedDateTime(java.time.ZonedDateTime) CoverageCount(gov.cms.ab2d.coverage.model.CoverageCount) ArrayList(java.util.ArrayList) ContractToContractCoverageMapping(gov.cms.ab2d.worker.config.ContractToContractCoverageMapping)

Aggregations

ContractToContractCoverageMapping (gov.cms.ab2d.worker.config.ContractToContractCoverageMapping)6 ContractDTO (gov.cms.ab2d.common.dto.ContractDTO)2 PdpClient (gov.cms.ab2d.common.model.PdpClient)2 ContractForCoverageDTO (gov.cms.ab2d.coverage.model.ContractForCoverageDTO)2 CoverageMapping (gov.cms.ab2d.coverage.model.CoverageMapping)2 CoveragePeriod (gov.cms.ab2d.coverage.model.CoveragePeriod)2 CoverageSearch (gov.cms.ab2d.coverage.model.CoverageSearch)2 CoverageSearchEvent (gov.cms.ab2d.coverage.model.CoverageSearchEvent)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 DisplayName (org.junit.jupiter.api.DisplayName)2 Test (org.junit.jupiter.api.Test)2 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)2 BFDClient (gov.cms.ab2d.bfd.client.BFDClient)1 PdpClientDTO (gov.cms.ab2d.common.dto.PdpClientDTO)1 Job (gov.cms.ab2d.common.model.Job)1 CoverageCount (gov.cms.ab2d.coverage.model.CoverageCount)1 SearchConfig (gov.cms.ab2d.worker.config.SearchConfig)1 PatientClaimsProcessorStub (gov.cms.ab2d.worker.processor.stub.PatientClaimsProcessorStub)1 StubJobRepository (gov.cms.ab2d.worker.repository.StubJobRepository)1 ContractWorkerClient (gov.cms.ab2d.worker.service.ContractWorkerClient)1